do not force rpm5 rpms to binary, the type info in the lead is always zero
authorMichael Schroeder <mls@suse.de>
Thu, 4 Oct 2012 13:42:27 +0000 (15:42 +0200)
committerMichael Schroeder <mls@suse.de>
Thu, 4 Oct 2012 13:42:27 +0000 (15:42 +0200)
ext/repo_rpmdb.c

index 2057d08..86b5471 100644 (file)
@@ -83,6 +83,7 @@
 #define TAG_CONFLICTFLAGS      1053
 #define TAG_CONFLICTNAME       1054
 #define TAG_CONFLICTVERSION    1055
+#define TAG_RPMVERSION         1064
 #define TAG_TRIGGERNAME                1066
 #define TAG_TRIGGERVERSION     1067
 #define TAG_TRIGGERFLAGS       1068
@@ -878,6 +879,7 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead,
   char *name;
   char *evr;
   char *sourcerpm;
+  int forcebinary = rpmhead->forcebinary;
 
   name = headstring(rpmhead, TAG_NAME);
   if (!strcmp(name, "gpg-pubkey"))
@@ -889,7 +891,13 @@ rpm2solv(Pool *pool, Repo *repo, Repodata *data, Solvable *s, RpmHead *rpmhead,
       return 0;
     }
   sourcerpm = headstring(rpmhead, TAG_SOURCERPM);
-  if (sourcerpm || rpmhead->forcebinary)
+  if (!sourcerpm && forcebinary)
+    {
+      char *rpmversion = headstring(rpmhead, TAG_RPMVERSION);
+      if (rpmversion && *rpmversion == '5')
+       forcebinary = 0;
+    }
+  if (sourcerpm || forcebinary)
     s->arch = pool_str2id(pool, headstring(rpmhead, TAG_ARCH), 1);
   else
     {
@@ -2252,6 +2260,7 @@ rpm_query(void *rpmhandle, Id what)
   const char *name, *arch, *sourcerpm;
   char *evr, *r;
   int l;
+  int forcebinary;
 
   RpmHead *rpmhead = rpmhandle;
   r = 0;
@@ -2262,7 +2271,14 @@ rpm_query(void *rpmhandle, Id what)
       if (!name)
        name = "";
       sourcerpm = headstring(rpmhead, TAG_SOURCERPM);
-      if (sourcerpm || rpmhead->forcebinary)
+      forcebinary = rpmhead->forcebinary;
+      if (!sourcerpm && forcebinary)
+       {
+         char *rpmversion = headstring(rpmhead, TAG_RPMVERSION);
+         if (rpmversion && *rpmversion == '5')
+           forcebinary = 0;
+       }
+      if (sourcerpm || forcebinary)
        arch = headstring(rpmhead, TAG_ARCH);
       else
        {