summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPanu Matilainen <pmatilai@redhat.com>2019-10-24 12:46:48 +0300
committerPanu Matilainen <pmatilai@redhat.com>2019-11-18 12:46:29 +0200
commitd93597e231223acc742a23031c01f7816f5d4698 (patch)
treedfb0f8396c5eed4315b1d7952ea5e2ac302d3506
parent71cd57925afd699b3704d2bc0f2f7fda991070e8 (diff)
downloadrpm-d93597e231223acc742a23031c01f7816f5d4698.tar.gz
Flag build-time rpmlib() dependencies in src.rpm as missingok
rpmlib() dependencies are an install-time barrier, but dependencies in src.rpm are considered build-time dependencies. This paradox is the crux of the problem in https://pagure.io/copr/copr/issue/1038. We could move the rpmlib(DynamicBuildRequires) someplace else (eg buildrecommends) to avoid the issue, but then the dependency has technically every right to be there, and changing it would break existing software (mock) relying on what we already released. Adding MISSINGOK flag allows rpm to legitimately skip it while installing, the build-side does its own checking independently. This is not ideal as it requires backporting of commit 1ac16611f0492ae450ca0f044c83632269c7e18d to older releases to fix, but this is the least-worst compromise we were able to come up with. (cherry picked from commit 819c6c8a3e0b8bd55a358af5644389add133f893)
-rw-r--r--build/reqprov.c8
-rw-r--r--tests/rpmbuild.at2
2 files changed, 7 insertions, 3 deletions
diff --git a/build/reqprov.c b/build/reqprov.c
index 9eedc133d..27bebe9ad 100644
--- a/build/reqprov.c
+++ b/build/reqprov.c
@@ -51,12 +51,16 @@ rpmRC addReqProvPkg(void *cbdata, rpmTagVal tagN,
int rpmlibNeedsFeature(Package pkg, const char * feature, const char * featureEVR)
{
char *reqname = NULL;
+ int flags = RPMSENSE_RPMLIB|RPMSENSE_LESS|RPMSENSE_EQUAL;
int res;
+ /* XXX HACK: avoid changing rpmlibNeedsFeature() for just one user */
+ if (rstreq(feature, "DynamicBuildRequires"))
+ flags |= RPMSENSE_MISSINGOK;
+
rasprintf(&reqname, "rpmlib(%s)", feature);
- res = addReqProv(pkg, RPMTAG_REQUIRENAME, reqname, featureEVR,
- RPMSENSE_RPMLIB|(RPMSENSE_LESS|RPMSENSE_EQUAL), 0);
+ res = addReqProv(pkg, RPMTAG_REQUIRENAME, reqname, featureEVR, flags, 0);
free(reqname);
diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at
index 009b71cc0..4a7ac5e30 100644
--- a/tests/rpmbuild.at
+++ b/tests/rpmbuild.at
@@ -1610,7 +1610,7 @@ runroot rpm -qpvR /build/SRPMS/buildrequires-1.0-1.buildreqs.nosrc.rpm
auto: foo > 1.3
auto: foo-bar = 2.0
rpmlib: rpmlib(CompressedFileNames) <= 3.0.4-1
-rpmlib: rpmlib(DynamicBuildRequires) <= 4.15.0-1
+rpmlib,missingok: rpmlib(DynamicBuildRequires) <= 4.15.0-1
rpmlib: rpmlib(FileDigests) <= 4.6.0-1
rpmlib: rpmlib(RichDependencies) <= 4.12.0-1
],