]> git.ipfire.org Git - thirdparty/libsolv.git/commitdiff
source/binary rpm detection heuristic when ENABLE_RPMPKG_LIBRPM used 264/head
authorMarek Blaha <marek.blaha@gmail.com>
Fri, 4 May 2018 14:30:41 +0000 (16:30 +0200)
committerMarek Blaha <marek.blaha@gmail.com>
Fri, 4 May 2018 14:59:13 +0000 (16:59 +0200)
The headerIsSource() simply checks a presence of the RPMTAG_SOURCERPM
tag in package header, which is not really useful in this context.
This patch provides the same "heuristic" as the librpm uses for
detecting source/binary rpm.

Relevant bug: https://bugzilla.redhat.com/show_bug.cgi?id=1572338

ext/repo_rpmdb.c

index cd14a9b4946ee1b1b0b5778e6a185f9979e49732..d5f3bf8e95495ce4b55c4d1a479d4d42b4dd0a4e 100644 (file)
@@ -457,7 +457,15 @@ headbinary(RpmHead *h, int tag, unsigned int *sizep)
 static int
 headissourceheuristic(RpmHead *h)
 {
-  return headerIsSource(h);
+  int issource = 0;
+  char **dn;
+  int dcnt;
+  dn = headstringarray(h, TAG_DIRNAMES, &dcnt);
+  if (dn) {
+      issource = dcnt == 1 && dn[0] && !*dn[0];
+      solv_free(dn);
+  }
+  return issource;
 }
 
 static inline void