Validate rpmlib dependencies on src.rpm install (RhBug:490613)

- other src.rpm dependencies are only relevant for building, but rpmlib
  features can affect src.rpm "install" too, such as unsupported file
  digests, payload compressors etc
This commit is contained in:
Panu Matilainen 2009-06-16 17:23:17 +03:00
parent 8f44f9159c
commit a4ac4e48ec
1 changed files with 29 additions and 0 deletions

View File

@ -214,6 +214,31 @@ static rpmRC markReplacedFiles(const rpmpsm psm)
return RPMRC_OK;
}
static int rpmlibDeps(Header h)
{
rpmds req = rpmdsInit(rpmdsNew(h, RPMTAG_REQUIRENAME, 0));
rpmds rpmlib = NULL;
rpmdsRpmlib(&rpmlib, NULL);
int rc = 1;
char *nvr = NULL;
while (rpmdsNext(req) >= 0) {
if (!(rpmdsFlags(req) & RPMSENSE_RPMLIB))
continue;
if (rpmdsSearch(rpmlib, req) < 0) {
if (!nvr) {
nvr = headerGetNEVRA(h, NULL);
rpmlog(RPMLOG_ERR, _("Missing rpmlib features for %s:\n"), nvr);
}
rpmlog(RPMLOG_ERR, "\t%s\n", rpmdsDNEVR(req)+2);
rc = 0;
}
}
rpmdsFree(req);
rpmdsFree(rpmlib);
free(nvr);
return rc;
}
rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
char ** specFilePtr, char ** cookie)
{
@ -248,6 +273,10 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
goto exit;
}
/* src.rpm install can require specific rpmlib features, check them */
if (!rpmlibDeps(h))
goto exit;
if (headerGet(h, RPMTAG_BASENAMES, &filenames, HEADERGET_ALLOC)) {
struct rpmtd_s td;
const char *str, *_cookie = NULL;