From: Marek Blaha Date: Fri, 4 May 2018 14:30:41 +0000 (+0200) Subject: source/binary rpm detection heuristic when ENABLE_RPMPKG_LIBRPM used X-Git-Tag: 0.6.35~55^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8e1dcb6e23a4ee7ea329609d3a05d17aa0201b87;p=thirdparty%2Flibsolv.git source/binary rpm detection heuristic when ENABLE_RPMPKG_LIBRPM used 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 --- diff --git a/ext/repo_rpmdb.c b/ext/repo_rpmdb.c index cd14a9b4..d5f3bf8e 100644 --- a/ext/repo_rpmdb.c +++ b/ext/repo_rpmdb.c @@ -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