Patch: allow forcing AutoReq on top of %%__noautoreq

This commit is contained in:
Mikhail Novosyolov 2019-04-16 10:10:51 +03:00
parent 5e882d4ae7
commit 92afe09f91
2 changed files with 91 additions and 1 deletions

View file

@ -0,0 +1,86 @@
From d3fe91a3be1b0f05ef0b1a48da1e2ee7528637f9 Mon Sep 17 00:00:00 2001
From: Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
Date: Tue, 16 Apr 2019 10:07:38 +0300
Subject: [PATCH] Force AutoReq on top of noautoreq
Allow overriding %%__noautoreq by %%__forceautoreq
and %%__noautoreqfiles by %%__forceautoreqfiles
Will be used in the samba package
diff --git a/lib/rpmfc.c b/lib/rpmfc.c
index 8049ff5..2239a9e 100644
--- a/lib/rpmfc.c
+++ b/lib/rpmfc.c
@@ -976,7 +976,8 @@ fprintf(stderr, "*** rpmfcMergePR(%p, %p) %s\n", context, ds, tagName(rpmdsTagN(
case RPMTAG_REQUIRENAME:
if (!_filter_values
|| (!fc->skipReq
- && !rpmfcMatchRegexps(fc->Rmires, fc->Rnmire, ds->N[0], 'R')))
+ && !rpmfcMatchRegexps(fc->Rmires, fc->Rnmire, ds->N[0], 'R'))
+ || rpmfcMatchRegexps(fc->FARmires, fc->FARnmire, ds->N[0], 'R'))
{
/* Add to package requires. */
rc = rpmdsMerge(&fc->requires, ds);
@@ -1097,6 +1098,12 @@ rpmRC rpmfcApply(rpmfc fc)
if (fc->RFnmire > 0)
rpmlog(RPMLOG_DEBUG, D_("added %d %%__noautoreqfiles patterns.\n"),
fc->RFnmire);
+ /* files matching __forceautoreqfiles will overwrite matches in __noautoreqfiles */
+ fc->FQRnmire = 0;
+ fc->FQRmires = rpmfcExpandRegexps("%{?__forceautoreqfiles}", &fc->FQRnmire);
+ if (fc->FQRnmire > 0)
+ rpmlog(RPMLOG_DEBUG, D_("added %d %%__forceautoreqfiles patterns.\n"),
+ fc->FQRnmire);
fc->Pnmire = 0;
fc->Pmires = rpmfcExpandRegexps("%{?__noautoprov}", &fc->Pnmire);
if (fc->Pnmire > 0)
@@ -1107,6 +1114,12 @@ rpmRC rpmfcApply(rpmfc fc)
if (fc->Rnmire > 0)
rpmlog(RPMLOG_DEBUG, D_("added %d %%__noautoreq patterns.\n"),
fc->Rnmire);
+ /* reqs matching __forceautoreq will overwrite __noautoreq */
+ fc->FARnmire = 0;
+ fc->FARmires = rpmfcExpandRegexps("%{?__forceautoreq}", &fc->FARnmire);
+ if (fc->FARnmire > 0)
+ rpmlog(RPMLOG_DEBUG, D_("added %d %%__forceautoreq patterns.\n"),
+ fc->FARnmire);
}
/* Make sure something didn't go wrong previously! */
@@ -1171,6 +1184,18 @@ assert(fc->fn != NULL);
fc->skipReq = 1;
/*@innerbreak@*/ break;
}
+ /* Now check that file is not in list of files from expanded %%__forceautoreqfiles
+ * If yes, then remove skipReq */
+ if ((mire = (miRE)fc->FQRmires) != NULL)
+ for (j = 0; j < fc->FQRnmire; j++, mire++) {
+ fn = fc->fn[fc->ix] + fc->brlen;
+ if ((xx = mireRegexec(mire, fn, 0)) < 0)
+ /*@innercontinue@*/ continue;
+ rpmlog(RPMLOG_NOTICE, _("Forcing %s requires detection\n"),
+ fn);
+ fc->skipReq = 0;
+ /*@innerbreak@*/ break;
+ }
}
xx = (*fcat->func) (fc);
diff --git a/lib/rpmfc.h b/lib/rpmfc.h
index b5d5430..ff29d79 100644
--- a/lib/rpmfc.h
+++ b/lib/rpmfc.h
@@ -110,6 +110,12 @@ struct rpmfc_s {
/*@null@*/
void * RFmires; /*!< Filter patterns from %{__noautoreqfile} */
int RFnmire;
+/*@null@*/
+ void * FQRmires; /*!< Filter patterns from %{__forceautoreqfile} */
+ int FQRnmire;
+/*@null@*/
+ void * FARmires; /*!< Filter patterns from %{__forceautoreq} */
+ int FARnmire;
};

View file

@ -61,7 +61,7 @@ Summary: The RPM package management system
Name: rpm
Epoch: 1
Version: %{libver}.%{minorver}
Release: %{?prereldate:0.%{prereldate}.}87
Release: %{?prereldate:0.%{prereldate}.}88
License: LGPLv2.1+
Group: System/Configuration/Packaging
Url: http://rpm5.org/
@ -533,6 +533,7 @@ Patch520: rpm-5.4.10-Multithreaded-XZ.patch
Patch521: rpm-5.4.10-Use-multithreaded-XZ-by-default-for-both-binary-and-.patch
Patch522: rpm-5.4.10-multithreaded-xz-memlimit.patch
Patch523: rpm-5.4.10-Parse-private-dependencies-from-pkgconfig-files.patch
Patch524: rpm-5.4.10-Force-AutoReq-on-top-of-noautoreq.patch
BuildRequires: autoconf >= 2.57
BuildRequires: bzip2-devel
@ -1202,6 +1203,9 @@ This package contains the RPM API documentation generated in HTML format.
%patch521 -p1 -b .MultithreadedXZbyDefault
%patch522 -p1 -b .MultithreadedXZ32bitMemLimit
%patch523 -p1 -b .ParsePkgconfigPrivate
# rpm-5.4.10-Force-AutoReq-on-top-of-noautoreq.patch
# Apply it with offsets which appear because of a lot of previous patches
patch -p1 < %{PATCH524}
#required by P55, P80, P81, P94..
./autogen.sh