diff options
-rw-r--r-- | lib/depends.c | 31 | ||||
-rw-r--r-- | lib/package.c | 30 | ||||
-rw-r--r-- | lib/rpmlib.h | 7 |
3 files changed, 31 insertions, 37 deletions
diff --git a/lib/depends.c b/lib/depends.c index 4db55d208..24ae7a5d4 100644 --- a/lib/depends.c +++ b/lib/depends.c @@ -50,6 +50,37 @@ static rpmds rpmlibP = NULL; #undef HASHKEYTYPE /** + * Check for supported payload format in header. + * @param h header to check + * @return RPMRC_OK if supported, RPMRC_FAIL otherwise + */ +static rpmRC headerCheckPayloadFormat(Header h) { + rpmRC rc = RPMRC_OK; + const char *payloadfmt = headerGetString(h, RPMTAG_PAYLOADFORMAT); + /* + * XXX Ugh, rpm 3.x packages don't have payload format tag. Instead + * of blindly allowing, should check somehow (HDRID existence or... ?) + */ + if (!payloadfmt) return rc; + + if (!rstreq(payloadfmt, "cpio")) { + char *nevra = headerGetAsString(h, RPMTAG_NEVRA); + if (payloadfmt && rstreq(payloadfmt, "drpm")) { + rpmlog(RPMLOG_ERR, + _("%s is a Delta RPM and cannot be directly installed\n"), + nevra); + } else { + rpmlog(RPMLOG_ERR, + _("Unsupported payload (%s) in package %s\n"), + payloadfmt ? payloadfmt : "none", nevra); + } + free(nevra); + rc = RPMRC_FAIL; + } + return rc; +} + +/** * Add removed package instance to ordered transaction set. * @param ts transaction set * @param h header diff --git a/lib/package.c b/lib/package.c index dc957efb7..a65a61a01 100644 --- a/lib/package.c +++ b/lib/package.c @@ -715,35 +715,5 @@ rpmRC rpmReadPackageFile(rpmts ts, FD_t fd, const char * fn, Header * hdrp) return rc; } -/** - * Check for supported payload format in header. - * @param h header to check - * @return RPMRC_OK if supported, RPMRC_FAIL otherwise - */ -rpmRC headerCheckPayloadFormat(Header h) { - rpmRC rc = RPMRC_OK; - const char *payloadfmt = headerGetString(h, RPMTAG_PAYLOADFORMAT); - /* - * XXX Ugh, rpm 3.x packages don't have payload format tag. Instead - * of blinly allowing, should check somehow (HDRID existence or... ?) - */ - if (!payloadfmt) return rc; - - if (!rstreq(payloadfmt, "cpio")) { - char *nevra = headerGetAsString(h, RPMTAG_NEVRA); - if (payloadfmt && rstreq(payloadfmt, "drpm")) { - rpmlog(RPMLOG_ERR, - _("%s is a Delta RPM and cannot be directly installed\n"), - nevra); - } else { - rpmlog(RPMLOG_ERR, - _("Unsupported payload (%s) in package %s\n"), - payloadfmt ? payloadfmt : "none", nevra); - } - free(nevra); - rc = RPMRC_FAIL; - } - return rc; -} diff --git a/lib/rpmlib.h b/lib/rpmlib.h index 5a0485e8e..e793ec6c7 100644 --- a/lib/rpmlib.h +++ b/lib/rpmlib.h @@ -122,13 +122,6 @@ void rpmFreeRpmrc(void); */ int rpmVersionCompare(Header first, Header second); -/** \ingroup header - * Check for supported payload format in header. - * @param h header to check - * @return RPMRC_OK if supported, RPMRC_FAIL otherwise - */ -rpmRC headerCheckPayloadFormat(Header h); - /** \ingroup header * Check header consistency, performing headerGetEntry() the hard way. * |