From: Michael Schroeder Date: Mon, 10 Sep 2018 08:42:59 +0000 (+0200) Subject: Move repodata_filelistfilter_matches into filelistfilter.c X-Git-Tag: 0.7.0~60 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=908a9d0c15d7b0e52a6d0487a5b3fb20a1da7b22;p=thirdparty%2Flibsolv.git Move repodata_filelistfilter_matches into filelistfilter.c We'll later extend this to support custom filelist filters. --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e8951f66..2e32968e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,7 +20,7 @@ SET (libsolv_SRCS transaction.c order.c rules.c problems.c linkedpkg.c cplxdeps.c chksum.c md5.c sha1.c sha2.c solvversion.c selection.c fileprovides.c diskusage.c suse.c solver_util.c cleandeps.c - userinstalled.c) + userinstalled.c filelistfilter.c) SET (libsolv_HEADERS bitmap.h evr.h hash.h policy.h poolarch.h poolvendor.h pool.h diff --git a/src/filelistfilter.c b/src/filelistfilter.c new file mode 100644 index 00000000..4dacdbe3 --- /dev/null +++ b/src/filelistfilter.c @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2018, SUSE LLC + * + * This program is licensed under the BSD license, read LICENSE.BSD + * for further information + */ + +/* + * filelistfilter.c + * + * Support repodata with a filelist filtered by a custom filter + */ + +#define _GNU_SOURCE +#include +#include + +#include +#include +#include +#include + +#include "repo.h" +#include "pool.h" +#include "util.h" + +int +repodata_filelistfilter_matches(Repodata *data, const char *str) +{ + /* '.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$' */ + /* for now hardcoded */ + if (strstr(str, "bin/")) + return 1; + if (!strncmp(str, "/etc/", 5)) + return 1; + if (!strcmp(str, "/usr/lib/sendmail")) + return 1; + return 0; +} + diff --git a/src/repodata.c b/src/repodata.c index e14038bb..aa1c4c9a 100644 --- a/src/repodata.c +++ b/src/repodata.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Novell Inc. + * Copyright (c) 2018, SUSE LLC. * * This program is licensed under the BSD license, read LICENSE.BSD * for further information @@ -1273,21 +1273,6 @@ datamatcher_checkbasename(Datamatcher *ma, const char *basename) return !strcmp(match, basename); } -int -repodata_filelistfilter_matches(Repodata *data, const char *str) -{ - /* '.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$' */ - /* for now hardcoded */ - if (strstr(str, "bin/")) - return 1; - if (!strncmp(str, "/etc/", 5)) - return 1; - if (!strcmp(str, "/usr/lib/sendmail")) - return 1; - return 0; -} - - enum { di_bye,