teknoraver / rpms / rpm

Forked from rpms/rpm 4 months ago
Clone

Blame 0009-Fix-debuginfo-etc-when-subpackages-have-different-ve.patch

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