support "notbyuser" in testcases
[platform/upstream/libsolv.git] / tools / rpmdb2solv.c
index c0a2fc3..2fbf558 100644 (file)
 #include "pool.h"
 #include "repo.h"
 #include "repo_rpmdb.h"
-#ifdef ENABLE_RPMDB_PUBKEY
-#include "repo_rpmdb_pubkey.h"
+#ifdef ENABLE_PUBKEY
+#include "repo_pubkey.h"
 #endif
 #include "repo_products.h"
 #include "repo_solv.h"
 #include "common_write.h"
+#ifdef ENABLE_APPDATA
+#include "repo_appdata.h"
+#endif
+#ifdef SUSE
+#include "repo_autopattern.h"
+#endif
+
 
 static void
 usage(int status)
@@ -63,15 +70,21 @@ main(int argc, char **argv)
   char *proddir = 0;
 #endif
   char *outfile = 0;
-#ifdef ENABLE_RPMDB_PUBKEY
+#ifdef ENABLE_PUBKEY
   int pubkeys = 0;
 #endif
+#ifdef ENABLE_APPDATA
+  int add_appdata = 0;
+#endif
+#ifdef SUSE
+  int add_auto = 0;
+#endif
 
   /*
    * parse arguments
    */
   
-  while ((c = getopt(argc, argv, "Phnkxb:r:p:o:")) >= 0)
+  while ((c = getopt(argc, argv, "APhnkxXb:r:p:o:")) >= 0)
     switch (c)
       {
       case 'h':
@@ -95,11 +108,21 @@ main(int argc, char **argv)
 #endif
        break;
       case 'x':
-        break;
+        break; /* extrapool no longer supported */
+      case 'X':
+#ifdef SUSE
+       add_auto = 1;
+#endif
+       break;
+      case 'A':
+#ifdef ENABLE_APPDATA
+       add_appdata = 1;
+#endif
+       break;
       case 'o':
         outfile = optarg;
         break;
-#ifdef ENABLE_RPMDB_PUBKEY
+#ifdef ENABLE_PUBKEY
       case 'k':
         nopacks = 1;
         pubkeys = 1;
@@ -150,10 +173,10 @@ main(int argc, char **argv)
          exit(1);
        }
     }
-#ifdef ENABLE_RPMDB_PUBKEY
+#ifdef ENABLE_PUBKEY
   if (pubkeys)
     {
-      if (repo_add_rpmdb_pubkeys(repo, REPO_USE_ROOTDIR | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE))
+      if (repo_add_rpmdb_pubkeys(repo, REPO_USE_ROOTDIR | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE | ADD_WITH_KEYSIGNATURES))
        {
          fprintf(stderr, "rpmdb2solv: %s\n", pool_errstr(pool));
          exit(1);
@@ -181,11 +204,21 @@ main(int argc, char **argv)
        }
     }
 #endif
+
+#ifdef ENABLE_APPDATA
+  if (add_appdata)
+    repo_add_appdata_dir(repo, "/usr/share/appdata", REPO_USE_ROOTDIR | REPO_REUSE_REPODATA | REPO_NO_INTERNALIZE);
+#endif
   repodata_internalize(data);
 
   if (reffp)
     fclose(reffp);
 
+#ifdef SUSE
+  if (add_auto)
+    repo_add_autopattern(repo, ADD_NO_AUTOPRODUCTS);
+#endif
+
   tool_write(repo, basefile, 0);
   pool_free(pool);
   exit(0);