INCOMPATIBLE bindings change: modernize Dataiterator/Datamatch classes
[platform/upstream/libsolv.git] / tools / rpms2solv.c
index b388f97..7852b08 100644 (file)
@@ -25,6 +25,9 @@
 #include "solv_xfopen.h"
 #endif
 #include "repo_solv.h"
+#ifdef SUSE
+#include "repo_autopattern.h"
+#endif
 #include "common_write.h"
 
 static char *
@@ -65,8 +68,12 @@ main(int argc, char **argv)
 #ifdef ENABLE_PUBKEY
   int pubkeys = 0;
 #endif
+#ifdef SUSE
+  int add_auto = 0;
+#endif
+  int filtered_filelist = 0;
 
-  while ((c = getopt(argc, argv, "0kKb:m:")) >= 0)
+  while ((c = getopt(argc, argv, "0XkKb:m:F")) >= 0)
     {
       switch(c)
        {
@@ -79,6 +86,9 @@ main(int argc, char **argv)
        case '0':
          manifest0 = 1;
          break;
+       case 'F':
+         filtered_filelist = 1;
+         break;
 #ifdef ENABLE_PUBKEY
        case 'k':
          pubkeys = 1;
@@ -87,6 +97,11 @@ main(int argc, char **argv)
          pubkeys = 2;
          break;
 #endif
+       case 'X':
+#ifdef SUSE
+         add_auto = 1;
+#endif
+         break;
        default:
          exit(1);
        }
@@ -158,13 +173,17 @@ main(int argc, char **argv)
          continue;
         }
 #endif
-      if (repo_add_rpm(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE) == 0)
+      if (repo_add_rpm(repo, rpms[i], REPO_REUSE_REPODATA|REPO_NO_INTERNALIZE|(filtered_filelist ? RPM_ADD_FILTERED_FILELIST : 0)) == 0)
        {
          fprintf(stderr, "rpms2solv: %s\n", pool_errstr(pool));
          res = 1;
        }
     }
   repo_internalize(repo);
+#ifdef SUSE
+  if (add_auto)
+    repo_add_autopattern(repo, 0);
+#endif
   tool_write(repo, basefile, 0);
   pool_free(pool);
   for (c = 0; c < nrpms; c++)