summaryrefslogtreecommitdiff
path: root/lib/package.c
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2008-12-08 19:51:10 +0200
committerPanu Matilainen <pmatilai@redhat.com>2008-12-08 19:51:10 +0200
commit50a4ed783c300a92948f7933a3c726d4bd2d643d (patch)
treebd00ff18dc4e2ace7e7e3dd9154ade40003e714b /lib/package.c
parent826969f2c7307e7292f192fd10625d863d656723 (diff)
downloadrpm-50a4ed783c300a92948f7933a3c726d4bd2d643d.tar.gz
rpm-50a4ed783c300a92948f7933a3c726d4bd2d643d.tar.bz2
rpm-50a4ed783c300a92948f7933a3c726d4bd2d643d.zip
Work around broken packages which dont have RPMTAG_SOURCERPM
- check the lead type and headerIsSource() agree on the type and if not, fix it up based on the information in lead
Diffstat (limited to 'lib/package.c')
-rw-r--r--lib/package.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/package.c b/lib/package.c
index 08b94ca38..d3a093b36 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -596,6 +596,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
rpmVSFlags vsflags;
rpmRC rc = RPMRC_FAIL; /* assume failure */
int xx;
+ int leadtype = -1;
headerGetFlags hgeflags = HEADERGET_DEFAULT;
if (hdrp) *hdrp = NULL;
@@ -608,6 +609,7 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
if ((rc = rpmLeadCheck(l, &err)) == RPMRC_FAIL) {
rpmlog(RPMLOG_ERR, "%s: %s\n", fn, err);
}
+ leadtype = rpmLeadType(l);
}
l = rpmLeadFree(l);
@@ -838,6 +840,14 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp)
exit:
if (rc != RPMRC_FAIL && h != NULL && hdrp != NULL) {
+ /*
+ * Some binary packages in the wild don't have RPMTAG_SOURCERPM,
+ * confusing us greatly. Ensure RPMTAG_SOURCERPM is always set
+ * on binary packages.
+ */
+ if (leadtype == RPMLEAD_BINARY && headerIsSource(h)) {
+ headerPutString(h, RPMTAG_SOURCERPM, "");
+ }
/*
* Convert legacy headers on the fly. Not having "new" style compressed
* filenames is close enough estimate for legacy indication...