mirror of
https://abf.rosa.ru/djam/rpm.git
synced 2025-02-23 18:33:04 +00:00
86 lines
3 KiB
Diff
86 lines
3 KiB
Diff
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;
|
|
|
|
};
|
|
|