]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
Move repodata_filelistfilter_matches into filelistfilter.c
authorMichael Schroeder <mls@suse.de>
Mon, 10 Sep 2018 08:42:59 +0000 (10:42 +0200)
committerMichael Schroeder <mls@suse.de>
Mon, 10 Sep 2018 08:42:59 +0000 (10:42 +0200)
We'll later extend this to support custom filelist filters.

src/CMakeLists.txt
src/filelistfilter.c [new file with mode: 0644]
src/repodata.c

index e8951f66603fe80aed1885b4ace7e04a40a6545b..2e32968e3a1a2a3e8093c653ca80326c20301c32 100644 (file)
@@ -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 (file)
index 0000000..4dacdbe
--- /dev/null
@@ -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 <string.h>
+#include <fnmatch.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <unistd.h>
+
+#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;
+}
+
index e14038bbbd1f0d94ce7279aa59189f6f77900202..aa1c4c9a8ab17619863f96f3ef3752b1b1262fc3 100644 (file)
@@ -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,