build/interdep.c: diagnose non-strict dependencies between subpackages

warning: util-linux: non-strict dependency on libblkid
warning: util-linux: non-strict dependency on libuuid
warning: util-linux: non-strict dependency on libmount
warning: mount: non-strict dependency on libblkid
warning: cfdisk: non-strict dependency on libblkid
warning: fdisk: non-strict dependency on libblkid
warning: libblkid: non-strict dependency on libuuid
warning: libblkid-devel: non-strict dependency on libuuid-devel
warning: libmount-devel: non-strict dependency on libblkid-devel
warning: util-linux-debuginfo: non-strict dependency on libblkid-debuginfo
warning: util-linux-debuginfo: non-strict dependency on libuuid-debuginfo
warning: util-linux-debuginfo: non-strict dependency on libmount-debuginfo
warning: mount-debuginfo: non-strict dependency on libblkid-debuginfo
warning: cfdisk-debuginfo: non-strict dependency on libblkid-debuginfo
warning: fdisk-debuginfo: non-strict dependency on libblkid-debuginfo
warning: libblkid-debuginfo: non-strict dependency on libuuid-debuginfo

Note that the right time for this check is after strict dependencies
are propagated, and also after debuginfo dependencies have been lifted.
This commit is contained in:
Alexey Tourbin 2011-02-08 06:57:03 +03:00
parent d92517ed56
commit 7891bc3a46

View File

@ -109,6 +109,40 @@ void makeReq1(struct Req *r, Package pkg1, Package pkg2, int warn)
reqVv = hfd(reqVv, RPM_STRING_ARRAY_TYPE); reqVv = hfd(reqVv, RPM_STRING_ARRAY_TYPE);
} }
#include "al.h"
// check if pkg1 has (possibly non-strict) dependency on pkg2
static
int depRequires(Package pkg1, Package pkg2)
{
int reqc = 0;
const char **reqNv = NULL;
const char **reqVv = NULL;
const int *reqFv = NULL;
const HGE_t hge = (HGE_t) headerGetEntryMinMemory;
int ok =
hge(pkg1->header, RPMTAG_REQUIRENAME, NULL, (void **) &reqNv, &reqc) &&
hge(pkg1->header, RPMTAG_REQUIREVERSION, NULL, (void **) &reqVv, NULL) &&
hge(pkg1->header, RPMTAG_REQUIREFLAGS, NULL, (void **) &reqFv, NULL);
if (!ok)
return 0;
availableList proval = alloca(sizeof proval);
alCreate(proval);
alAddPackage(proval, pkg2->header, NULL, NULL, NULL);
int i;
struct availablePackage *ap = NULL;
for (i = 0; i < reqc; i++) {
ap = alSatisfiesDepend(proval, reqNv[i], reqVv[i], reqFv[i]);
if (ap)
break;
}
const HFD_t hfd = (HFD_t) headerFreeData;
reqNv = hfd(reqNv, RPM_STRING_ARRAY_TYPE);
reqVv = hfd(reqVv, RPM_STRING_ARRAY_TYPE);
alFree(proval);
return ap ? 1 : 0;
}
static static
struct Req *makeRequires(Spec spec, int warn) struct Req *makeRequires(Spec spec, int warn)
{ {
@ -118,8 +152,8 @@ struct Req *makeRequires(Spec spec, int warn)
Package pkg1, pkg2; Package pkg1, pkg2;
for (pkg1 = spec->packages; pkg1; pkg1 = pkg1->next) for (pkg1 = spec->packages; pkg1; pkg1 = pkg1->next)
for (pkg2 = pkg1->next; pkg2; pkg2 = pkg2->next) { for (pkg2 = pkg1->next; pkg2; pkg2 = pkg2->next) {
makeReq1(r, pkg1, pkg2, warn); makeReq1(r, pkg1, pkg2, warn & 1);
makeReq1(r, pkg2, pkg1, warn); makeReq1(r, pkg2, pkg1, warn & 1);
} }
int propagated; int propagated;
do { do {
@ -144,6 +178,17 @@ struct Req *makeRequires(Spec spec, int warn)
} }
} }
while (propagated); while (propagated);
if ((warn & 2) == 0)
return r;
for (pkg1 = spec->packages; pkg1; pkg1 = pkg1->next)
for (pkg2 = pkg1->next; pkg2; pkg2 = pkg2->next) {
if (!Requires(r, pkg1, pkg2) && depRequires(pkg1, pkg2))
fprintf(stderr, "warning: %s: non-strict dependency on %s\n",
pkgName(pkg1), pkgName(pkg2));
if (!Requires(r, pkg2, pkg1) && depRequires(pkg2, pkg1))
fprintf(stderr, "warning: %s: non-strict dependency on %s\n",
pkgName(pkg2), pkgName(pkg1));
}
return r; return r;
} }
@ -394,37 +439,11 @@ void pruneDebuginfoSrc(struct Req *r, Spec spec)
processDependentDebuginfo(r, spec, pruneSrc1, 0); processDependentDebuginfo(r, spec, pruneSrc1, 0);
} }
#include "al.h"
// if pkg1 implicitly requires pkg2, add strict dependency // if pkg1 implicitly requires pkg2, add strict dependency
static static
void liftDeps1(Package pkg1, Package pkg2) void liftDeps1(Package pkg1, Package pkg2)
{ {
int reqc = 0; if (!depRequires(pkg1, pkg2))
const char **reqNv = NULL;
const char **reqVv = NULL;
const int *reqFv = NULL;
const HGE_t hge = (HGE_t) headerGetEntryMinMemory;
int ok =
hge(pkg1->header, RPMTAG_REQUIRENAME, NULL, (void **) &reqNv, &reqc) &&
hge(pkg1->header, RPMTAG_REQUIREVERSION, NULL, (void **) &reqVv, NULL) &&
hge(pkg1->header, RPMTAG_REQUIREFLAGS, NULL, (void **) &reqFv, NULL);
if (!ok)
return;
availableList proval = alloca(sizeof proval);
alCreate(proval);
alAddPackage(proval, pkg2->header, NULL, NULL, NULL);
int i;
struct availablePackage *ap = NULL;
for (i = 0; i < reqc; i++) {
ap = alSatisfiesDepend(proval, reqNv[i], reqVv[i], reqFv[i]);
if (ap)
break;
}
const HFD_t hfd = (HFD_t) headerFreeData;
reqNv = hfd(reqNv, RPM_STRING_ARRAY_TYPE);
reqVv = hfd(reqVv, RPM_STRING_ARRAY_TYPE);
if (ap == NULL)
return; return;
const char *name = pkgName(pkg2); const char *name = pkgName(pkg2);
const char *evr = headerSprintf(pkg2->header, const char *evr = headerSprintf(pkg2->header,
@ -656,7 +675,7 @@ int processInterdep(Spec spec)
int optlevel = rpmExpandNumeric("%{?_deps_optimization}%{?!_deps_optimization:2}"); int optlevel = rpmExpandNumeric("%{?_deps_optimization}%{?!_deps_optimization:2}");
if (optlevel < 2) if (optlevel < 2)
return 0; return 0;
r = makeRequires(spec, 0); r = makeRequires(spec, 2);
pruneExtraDeps(r, spec); pruneExtraDeps(r, spec);
pruneExtraRDeps(r, spec); pruneExtraRDeps(r, spec);
r = freeRequires(r); r = freeRequires(r);