Push name/epoch/version/release macro before invoking depgens

Signed-off-by: Igor Gnatenko <ignatenkobrain@fedoraproject.org>
This commit is contained in:
Igor Gnatenko 2018-10-17 12:58:11 +02:00
parent 5460ad1e17
commit 69ee4d255a
No known key found for this signature in database
GPG Key ID: 695714BD1BBC5F4C
2 changed files with 66 additions and 1 deletions

View File

@ -0,0 +1,61 @@
From 0d2176c9a3ae44fd0a67c9983b1a5ba0a00388fd Mon Sep 17 00:00:00 2001
From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
Date: Mon, 15 Oct 2018 19:49:57 +0200
Subject: [PATCH] rpmfc: push name/epoch/version/release macro before invoking
depgens
Fixes: https://github.com/rpm-software-management/rpm/issues/502
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
---
build/rpmfc.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 2fbfc69ab..eccd6582a 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -1334,9 +1334,31 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
return rc;
}
+typedef const struct macroExport_s {
+ const char * name;
+ rpmTagVal tag;
+} * macroExport;
+
+static struct macroExport_s const macroExportList[] = {
+ { "name", RPMTAG_NAME },
+ { "epoch", RPMTAG_EPOCH },
+ { "version", RPMTAG_VERSION },
+ { "release", RPMTAG_RELEASE },
+ { NULL, 0 }
+};
+
rpmRC rpmfcApply(rpmfc fc)
{
rpmRC rc;
+ Package pkg = fc->pkg;
+ macroExport me;
+ for (me = macroExportList; me->name; me++) {
+ char *val = headerGetAsString(pkg->header, me->tag);
+ if (val) {
+ rpmPushMacro(NULL, me->name, NULL, val, RMIL_SPEC);
+ free(val);
+ }
+ }
/* If new-fangled dependency generation is disabled ... */
if (!rpmExpandNumeric("%{?_use_internal_dependency_generator}")) {
/* ... then generate dependencies using %{__find_requires} et al. */
@@ -1347,6 +1369,9 @@ rpmRC rpmfcApply(rpmfc fc)
/* ... otherwise generate per-file dependencies */
rc = rpmfcApplyInternal(fc);
}
+ for (me = macroExportList; me->name; me++)
+ if (headerIsEntry(pkg->header, me->tag))
+ rpmPopMacro(NULL, me->name);
return rc;
}
--
2.19.1

View File

@ -23,7 +23,7 @@
%global rpmver 4.14.2
#global snapver rc2
%global rel 8
%global rel 9
%global srcver %{version}%{?snapver:-%{snapver}}
%global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}
@ -61,6 +61,7 @@ Patch6: 0001-find-debuginfo.sh-decompress-DWARF-compressed-ELF-se.patch
# Patches already upstream:
Patch101: 0001-Fix-ancient-python-GIL-locking-bug-on-callback-RhBug.patch
Patch102: 0001-Resurrect-long-since-broken-Lua-library-path.patch
Patch103: 0001-rpmfc-push-name-epoch-version-release-macro-before-i.patch
# These are not yet upstream
Patch906: rpm-4.7.1-geode-i686.patch
@ -582,6 +583,9 @@ make check || (cat tests/rpmtests.log; exit 1)
%doc doc/librpm/html/*
%changelog
* Wed Oct 17 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.14.2-9
- Push name/epoch/version/release macro before invoking depgens
* Tue Oct 16 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 4.14.2-8
- Resurrect long since broken Lua library path