summaryrefslogtreecommitdiff
path: root/lib/package.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2009-01-30 08:28:57 +0200
committerPanu Matilainen <pmatilai@redhat.com>2009-01-30 08:28:57 +0200
commit64335052e35836168f18e190da464b8c2abe0373 (patch)
tree2618dbd687e8cc6ff082eb9b50d00037b720d897 /lib/package.c
parent81afe5e6a210171f58c989bc43bab1881821ddad (diff)
downloadrpm-64335052e35836168f18e190da464b8c2abe0373.tar.gz
rpm-64335052e35836168f18e190da464b8c2abe0373.tar.bz2
rpm-64335052e35836168f18e190da464b8c2abe0373.zip
Try to play nice with OpenPKG (rpm5.org) packages (rhbz#478907)
- rpm5.org writes populates lead with partially bogus data, but does have explicit RPMTAG_SOURCEPACKAGE for srpms, dont think of them as binaries - switches around the lead check in 50a4ed783c300a92948f7933a3c726d4bd2d643d to look at source type explicitly and retrofit RPMTAG_SOURCEPACKAGE for srpms early, this lets binaries without RPMTAG_SOURCERPM (which is documented as "information only") and with explicit RPMTAG_SOURCEPACKAGE be identified correctly
Diffstat (limited to 'lib/package.c')
-rw-r--r--lib/package.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/lib/package.c b/lib/package.c
index 15e94699f..2d1f6ee25 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -835,20 +835,25 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
exit:
if (rc != RPMRC_FAIL && h != NULL && hdrp != NULL) {
+ /* Retrofit RPMTAG_SOURCEPACKAGE to srpms for compatibility */
+ if (leadtype == RPMLEAD_SOURCE && headerIsSource(h)) {
+ if (!headerIsEntry(h, RPMTAG_SOURCEPACKAGE)) {
+ uint32_t one = 1;
+ headerPutUint32(h, RPMTAG_SOURCEPACKAGE, &one, 1);
+ }
+ }
/*
- * Some binary packages in the wild don't have RPMTAG_SOURCERPM,
- * confusing us greatly. Ensure RPMTAG_SOURCERPM is always set
- * on binary packages.
+ * Try to make sure binary rpms have RPMTAG_SOURCERPM set as that's
+ * what we use for differentiating binary vs source elsewhere.
*/
- if (leadtype == RPMLEAD_BINARY && headerIsSource(h)) {
- headerPutString(h, RPMTAG_SOURCERPM, "");
+ if (!headerIsEntry(h, RPMTAG_SOURCEPACKAGE) && headerIsSource(h)) {
+ headerPutString(h, RPMTAG_SOURCERPM, "(none)");
}
/*
* Convert legacy headers on the fly. Not having "new" style compressed
* filenames is close enough estimate for legacy indication...
- * Source rpms are retrofitted for the silly RPMTAG_SOURCEPACKAGE tag.
*/
- if (!headerIsEntry(h, RPMTAG_DIRNAMES) || headerIsSource(h)) {
+ if (!headerIsEntry(h, RPMTAG_DIRNAMES)) {
headerConvert(h, HEADERCONV_RETROFIT_V3);
}