140 lines
5.8 KiB
Diff
140 lines
5.8 KiB
Diff
From 53c9e8d00983b0d99caefc0ef94a18184c0ba85c Mon Sep 17 00:00:00 2001
|
|
Message-Id: <53c9e8d00983b0d99caefc0ef94a18184c0ba85c.1488964568.git.pmatilai@redhat.com>
|
|
In-Reply-To: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
References: <189b4f88c8e100155ec23a1e0b214bdc8473532a.1488964568.git.pmatilai@redhat.com>
|
|
From: Panu Matilainen <pmatilai@redhat.com>
|
|
Date: Wed, 9 Nov 2016 09:16:48 +0200
|
|
Subject: [PATCH 06/11] Fix debuginfo etc when subpackages have different
|
|
versions (RhBug:1051407)
|
|
|
|
Rpm has always been a bit dazed and confused when it comes to specs
|
|
with sub-packages having different version etc from the main package.
|
|
Many things work fine in that case .. except .. when they dont. Debuginfo
|
|
picking up wrong versions (RhBug:1051407) is just one example, there
|
|
are countless more in bugzilla wrt buildroot paths and whatnot.
|
|
The simple and sane solution would be not piling on them macros
|
|
from sub-packages, but that would surely break somebodys precious
|
|
spec tricks.
|
|
|
|
The ugly but brutally simple and compatible solution to this all is to
|
|
create separate set of macros when on the main package, this lets users
|
|
in and out of rpm pick which one (latest or main) they want. To hopefully
|
|
avoid stomping on anybodys toes, use uppercasing for the macro name (other
|
|
variants like %pkg_release are awfully commonly used). Pile 'em on, yay!
|
|
---
|
|
build/files.c | 2 +-
|
|
build/parsePreamble.c | 11 ++++++++++-
|
|
macros.in | 18 +++++++++---------
|
|
3 files changed, 20 insertions(+), 11 deletions(-)
|
|
|
|
diff --git a/build/files.c b/build/files.c
|
|
index 6215bf8..2ede463 100644
|
|
--- a/build/files.c
|
|
+++ b/build/files.c
|
|
@@ -1797,7 +1797,7 @@ static int generateBuildIDs(FileList fl)
|
|
int unique_debug_names =
|
|
rpmExpandNumeric("%{?_unique_debug_names}");
|
|
if (unique_debug_names == 1)
|
|
- vra = rpmExpand("-%{version}-%{release}.%{_arch}", NULL);
|
|
+ vra = rpmExpand("-%{VERSION}-%{RELEASE}.%{_arch}", NULL);
|
|
}
|
|
|
|
/* Now add a subdir and symlink for each buildid found. */
|
|
diff --git a/build/parsePreamble.c b/build/parsePreamble.c
|
|
index 933f734..6be4403 100644
|
|
--- a/build/parsePreamble.c
|
|
+++ b/build/parsePreamble.c
|
|
@@ -909,8 +909,17 @@ static rpmRC handlePreambleTag(rpmSpec spec, Package pkg, rpmTagVal tag,
|
|
goto exit;
|
|
}
|
|
|
|
- if (macro)
|
|
+ if (macro) {
|
|
addMacro(spec->macros, macro, NULL, field, RMIL_SPEC);
|
|
+ /* Add a separate uppercase macro for tags from the main package */
|
|
+ if (pkg == spec->packages) {
|
|
+ char *m = xstrdup(macro);
|
|
+ for (char *p = m; *p; ++p)
|
|
+ *p = rtoupper(*p);
|
|
+ addMacro(spec->macros, m, NULL, field, RMIL_SPEC);
|
|
+ free(m);
|
|
+ }
|
|
+ }
|
|
rc = RPMRC_OK;
|
|
exit:
|
|
return rc;
|
|
diff --git a/macros.in b/macros.in
|
|
index 68bf391..4d90282 100644
|
|
--- a/macros.in
|
|
+++ b/macros.in
|
|
@@ -180,7 +180,7 @@
|
|
# the script. See the script for details.
|
|
#
|
|
%__debug_install_post \
|
|
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{version}-%{release}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_include_gdb_index:-i} %{?_unique_build_ids:--ver-rel "%{VERSION}-%{RELEASE}"} %{?_unique_debug_names:--unique-debug-arch "%{_arch}"} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
|
|
%{nil}
|
|
|
|
# Template for debug information sub-package.
|
|
@@ -232,7 +232,7 @@ package or when debugging this package.\
|
|
%_buildrootdir %{_topdir}/BUILDROOT
|
|
|
|
# Build root path, where %install installs the package during build.
|
|
-%buildroot %{_buildrootdir}/%{name}-%{version}-%{release}.%{_arch}
|
|
+%buildroot %{_buildrootdir}/%{NAME}-%{VERSION}-%{RELEASE}.%{_arch}
|
|
|
|
# Directory where temporaray files can be created.
|
|
%_tmppath %{_var}/tmp
|
|
@@ -484,7 +484,7 @@ package or when debugging this package.\
|
|
|
|
# Whether build-ids should be made unique between package version/releases
|
|
# when generating debuginfo packages. If set to 1 this will pass
|
|
-# --ver-rel "%{version}-%{release}" to find-debuginfo.sh which will pass it
|
|
+# --ver-rel "%{VERSION}-%{RELEASE}" to find-debuginfo.sh which will pass it
|
|
# onto debugedit --build-id-seed to be used to prime the build-id note hash.
|
|
%_unique_build_ids 1
|
|
|
|
@@ -705,9 +705,9 @@ package or when debugging this package.\
|
|
export RPM_SOURCE_DIR RPM_BUILD_DIR RPM_OPT_FLAGS RPM_ARCH RPM_OS\
|
|
RPM_DOC_DIR=\"%{_docdir}\"\
|
|
export RPM_DOC_DIR\
|
|
- RPM_PACKAGE_NAME=\"%{name}\"\
|
|
- RPM_PACKAGE_VERSION=\"%{version}\"\
|
|
- RPM_PACKAGE_RELEASE=\"%{release}\"\
|
|
+ RPM_PACKAGE_NAME=\"%{NAME}\"\
|
|
+ RPM_PACKAGE_VERSION=\"%{VERSION}\"\
|
|
+ RPM_PACKAGE_RELEASE=\"%{RELEASE}\"\
|
|
export RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE\
|
|
LANG=C\
|
|
export LANG\
|
|
@@ -1146,7 +1146,7 @@ done \
|
|
%__scm_setup_hg(q)\
|
|
%{__hg} init %{-q} .\
|
|
%{__hg} add %{-q} .\
|
|
-%{__hg} commit %{-q} --user "%{__scm_author}" -m "%{name}-%{version} base"
|
|
+%{__hg} commit %{-q} --user "%{__scm_author}" -m "%{NAME}-%{VERSION} base"
|
|
|
|
%__scm_apply_hg(qp:m:)\
|
|
%{__hg} import - %{-p:-p%{-p*}} %{-q} -m %{-m*} --user "%{__scm_author}"
|
|
@@ -1158,7 +1158,7 @@ done \
|
|
%{__git} config user.email "%{__scm_usermail}"\
|
|
%{__git} add .\
|
|
%{__git} commit %{-q} -a\\\
|
|
- --author "%{__scm_author}" -m "%{name}-%{version} base"
|
|
+ --author "%{__scm_author}" -m "%{NAME}-%{VERSION} base"
|
|
|
|
%__scm_apply_git(qp:m:)\
|
|
%{__git} apply --index %{-p:-p%{-p*}} -\
|
|
@@ -1181,7 +1181,7 @@ done \
|
|
%{__bzr} init %{-q}\
|
|
%{__bzr} whoami --branch "%{__scm_author}"\
|
|
%{__bzr} add .\
|
|
-%{__bzr} commit %{-q} -m "%{name}-%{version} base"
|
|
+%{__bzr} commit %{-q} -m "%{NAME}-%{VERSION} base"
|
|
|
|
# bzr doesn't seem to have its own command to apply patches?
|
|
%__scm_apply_bzr(qp:m:)\
|
|
--
|
|
2.9.3
|
|
|