rpm/payloadformat.diff

41 lines
1.5 KiB
Diff

Check if the payloadformat really is "cpio", fail with an error
message if it is not. Use a different message for the "drpm"
delta-rpm format. rh#140052
Upstream proposes a different approach, patching the "Requires"
list, which the current deltarpm implementation can't do, because
it uses a verbatim copy of the original header. Sigh.
I still believe that rpm should check for known formats, i.e.
now that rpm understands ustar it should insist that the format
is either "cpio" or "ustar".
--- ./lib/rpminstall.c.orig 2005-12-14 21:01:09.000000000 +0000
+++ ./lib/rpminstall.c 2005-12-15 14:47:35.000000000 +0000
@@ -470,6 +470,7 @@ if (fileURL[0] == '=') {
eiu->fnp++, eiu->prevx++)
{
const char * fileName;
+ const char * payloadformat;
rpmMessage(RPMMESS_DEBUG, "============== %s\n", *eiu->fnp);
(void) urlPath(*eiu->fnp, &fileName);
@@ -510,6 +511,17 @@ if (fileURL[0] == '=') {
/*@switchbreak@*/ break;
}
+ payloadformat = 0;
+ if (!headerGetEntry(eiu->h, RPMTAG_PAYLOADFORMAT, NULL, (void **)&payloadformat, NULL))
+ payloadformat = 0;
+ if (payloadformat && strcmp(payloadformat, "cpio") != 0) {
+ if (!strcmp(payloadformat, "drpm"))
+ rpmMessage(RPMMESS_ERROR, _("%s is a deltarpm, create a real rpm from it first!\n"), *eiu->fnp);
+ else
+ rpmMessage(RPMMESS_ERROR, _("%s contains no cpio payload\n"), *eiu->fnp);
+ eiu->numFailed++; *eiu->fnp = NULL;
+ continue;
+ }
eiu->isSource = headerIsEntry(eiu->h, RPMTAG_SOURCEPACKAGE);
if (eiu->isSource) {