[Rpm-maint] [PATCH] Add option to have unique debug source dirs across version/release/arch.

2017-02-28 Thread Mark Wielaard
From: Mark Wielaard 

Introduce a new macro _unique_debug_srcs that when set will pass
--unique-debug-src-base "%{name}" to find-debuginfo.sh which will
move sources into a unique "--." directory
under /usr/src/debug/ and makes debugedit rewrite the source paths
in the debuginfo to use that unique directory name.

Traditionally the debug src dir was named after the builddir which
was defined through the %setup macro which used the -n name argument
to define the builddir name and source archive to use. The builddir
might not be unique though between package versions.

Now that debugedit doesn't have strict base and dest dir length
restrictions for rewriting the source dir paths this can now be made
more flexible.

The added testcases show the difference between the old and new way.
The hello2.spec file defines the name of the package as hello2, but
uses the %setup marcro with -n hello-1.0 to use the hello-1.0.tar.gz
archive. This would traditionally result in a hello-1.0 builddir
which would be moved under /usr/src/debug. Possibly conflicting
with any other package (version) that used the same builddir name.
When defining _unique_debug_srcs to 1 that builddir will be moved
to --. instead (hello2-1.0-1.).

The testcases check that both the actual package source filess under
/usr/debug/src/ and the source paths as found in the .debug files are
under the traditional or new unique directory names depending on whether
the new _unique_debug_srcs macro is defined.

Signed-off-by: Mark Wielaard 
---
 macros.in |  8 -
 scripts/find-debuginfo.sh | 39 ---
 tests/rpmbuild.at | 80 +++
 tests/rpmbuildid.at   |  5 +++
 4 files changed, 127 insertions(+), 5 deletions(-)

diff --git a/macros.in b/macros.in
index a838875..72d4a51 100644
--- a/macros.in
+++ b/macros.in
@@ -172,7 +172,7 @@
 #  the script.  See the script for details.
 #
 %__debug_install_post   \
-   %{_rpmconfigdir}/find-debuginfo.sh %{?_smp_mflags} 
%{?_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 %{?_smp_mflags} 
%{?_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}"} 
%{?_unique_debug_srcs:--unique-debug-src-base "%{name}"} 
%{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} 
"%{_builddir}/%{?buildsubdir}"\
 %{nil}
 
 #  Template for debug information sub-package.
@@ -505,6 +505,12 @@ package or when debugging this package.\
 # Requires _unique_build_ids.
 %_unique_debug_names   1
 
+# Whether the /usr/debug/src/ directories should be unique between
+# package version, release and architecture. If set to 1 this will pass
+# --unique-debug-src-base "%{name}" to find-debuginfo.sh to name the
+# directory under /usr/debug/src as --.
+%_unique_debug_srcs1
+
 #
 # Use internal dependency generator rather than external helpers?
 %_use_internal_dependency_generator1
diff --git a/scripts/find-debuginfo.sh b/scripts/find-debuginfo.sh
index 1524ac2..fd63779 100644
--- a/scripts/find-debuginfo.sh
+++ b/scripts/find-debuginfo.sh
@@ -67,6 +67,9 @@ ver_rel=
 # Arch given by --unique-debug-arch
 unique_debug_arch=
 
+# Base given by --unique-debug-src-base
+unique_debug_src_base=
+
 # Number of parallel jobs to spawn
 n_jobs=1
 
@@ -97,6 +100,10 @@ while [ $# -gt 0 ]; do
 unique_debug_arch=$2
 shift
 ;;
+  --unique-debug-src-base)
+unique_debug_src_base=$2
+shift
+;;
   -g)
 strip_g=true
 ;;
@@ -147,6 +154,11 @@ if test -z "$ver_rel" -a -n "$unique_debug_arch"; then
   exit 2
 fi
 
+if test -z "$unique_debug_arch" -a -n "$unique_debug_src_base"; then
+  echo >&2 "*** ERROR: --unique-debug-src-base (${unique_debug_src_base}) 
needs --unique-debug-arch (${unique_debug_arch})"
+  exit 2
+fi
+
 i=0
 while ((i < nout)); do
   outs[$i]="$BUILDDIR/${outs[$i]}"
@@ -305,7 +317,18 @@ do_file()
   if [ ! -z "$ver_rel" ]; then
 build_id_seed="--build-id-seed=$ver_rel"
   fi
-  id=$(${lib_rpm_dir}/debugedit -b "$RPM_BUILD_DIR" -d /usr/src/debug \
+  # See also cpio SOURCEFILE copy. Directories must match up.
+  debug_base_name="$RPM_BUILD_DIR"
+  debug_dest_name="/usr/src/debug"
+  if [ ! -z "$unique_debug_src_base" ]; then
+debug_base_name="$BUILDDIR"
+
debug_dest_name="/usr/src/debug/${unique_debug_src_base}-${ver_rel}.${unique_debug_arch}"
+  fi
+echo "RPM_BUILD_DIR: $RPM_BUILD_DIR"
+echo "BUILDDIR: $BUILDDIR"
+  echo ${lib_rpm_dir}/debugedit -b $debug_base_name -d $debug_dest_name \
+ -i 

Re: [Rpm-maint] [rpm-software-management/rpm] Upgrade lua library dependencies (#165)

2017-02-28 Thread daurnimator
> How's the compatibility record of these modules upstream?

Rather good incrementally; but 14 years is a lot of incremental changes...

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/165#issuecomment-282983033___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint


Re: [Rpm-maint] [rpm-software-management/rpm] Upgrade lua library dependencies (#165)

2017-02-28 Thread Panu Matilainen
How's the compatibility record of these modules upstream? The problem is, these 
modules are used from package scripts and we don't want to break (the same 
problem exists with Lua itself of course).
The other problem is that in particular the lposix module is forked to some 
extent to protect rpm.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/issues/165#issuecomment-282977769___
Rpm-maint mailing list
Rpm-maint@lists.rpm.org
http://lists.rpm.org/mailman/listinfo/rpm-maint