diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2008-04-15 09:16:05 +0300 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2008-04-15 09:16:05 +0300 |
commit | 55ebf2c079aa992f891ecc87d3f7aba0a844650d (patch) | |
tree | e7fef073ab982f8f48108253d48f4fb4b0f78f8f | |
parent | a2bb439b3ca2789f21b1e6efcbe0ffbaad8aca48 (diff) | |
download | rpm-55ebf2c079aa992f891ecc87d3f7aba0a844650d.tar.gz rpm-55ebf2c079aa992f891ecc87d3f7aba0a844650d.tar.bz2 rpm-55ebf2c079aa992f891ecc87d3f7aba0a844650d.zip |
Abort build on unknown payload compressor
- explicitly check for supported rpmio names, bail if not supported
-rw-r--r-- | build/pack.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/build/pack.c b/build/pack.c index 248b5747a..9c957bc87 100644 --- a/build/pack.c +++ b/build/pack.c @@ -371,16 +371,23 @@ rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName, } s = strchr(rpmio_flags, '.'); if (s) { + const char *compr = NULL; (void) headerAddEntry(h, RPMTAG_PAYLOADFORMAT, RPM_STRING_TYPE, "cpio", 1); - if (s[1] == 'g' && s[2] == 'z') - (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE, - "gzip", 1); - if (s[1] == 'b' && s[2] == 'z') { - (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE, - "bzip2", 1); + if (strcmp(s+1, "gzdio") == 0) { + compr = "gzip"; + } else if (strcmp(s+1, "bzdio") == 0) { + compr = "bzip2"; /* Add prereq on rpm version that understands bzip2 payloads */ (void) rpmlibNeedsFeature(h, "PayloadIsBzip2", "3.0.5-1"); + } else { + rpmlog(RPMLOG_ERR, _("Unknown payload compression: %s\n"), + rpmio_flags); + rc = RPMRC_FAIL; + goto exit; } + + (void) headerAddEntry(h, RPMTAG_PAYLOADCOMPRESSOR, RPM_STRING_TYPE, + compr, 1); buf = xstrdup(rpmio_flags); buf[s - rpmio_flags] = '\0'; (void) headerAddEntry(h, RPMTAG_PAYLOADFLAGS, RPM_STRING_TYPE, buf+1, 1); |