commit 722c780d452f8c2fb81d3b078064d55ce50c51c31bd89a0415a10b290ddc0bc0 Author: Thomas Renninger Date: Tue Sep 28 13:14:06 2021 +0000 Accepting request 919738 from home:gmbr3:rpm4.17 RPM 4.17 OBS-URL: https://build.opensuse.org/request/show/919738 OBS-URL: https://build.opensuse.org/package/show/Base:System/debugedit?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/debugedit-5.0.tar.xz b/debugedit-5.0.tar.xz new file mode 100644 index 0000000..287e2f9 --- /dev/null +++ b/debugedit-5.0.tar.xz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e9ecd7d350bebae1f178ce6776ca19a648b6fe8fa22f5b3044b38d7899aa553e +size 164820 diff --git a/debugedit-5.0.tar.xz.sig b/debugedit-5.0.tar.xz.sig new file mode 100644 index 0000000..9d6f510 Binary files /dev/null and b/debugedit-5.0.tar.xz.sig differ diff --git a/debugedit.changes b/debugedit.changes new file mode 100644 index 0000000..c858cca --- /dev/null +++ b/debugedit.changes @@ -0,0 +1,11 @@ +------------------------------------------------------------------- +Wed Jun 30 13:06:47 UTC 2021 - Callum Farmer + +- initial version 5.0 +- Added patches from rpm: + * finddebuginfo.patch + * finddebuginfo-absolute-links.patch + * debugsubpkg.patch + * debuglink.patch + * debuginfo-mono.patch +- Add patch to fix bad shift: remove-bad-shift.patch diff --git a/debugedit.keyring b/debugedit.keyring new file mode 100644 index 0000000..e58d475 Binary files /dev/null and b/debugedit.keyring differ diff --git a/debugedit.spec b/debugedit.spec new file mode 100644 index 0000000..3a8c5db --- /dev/null +++ b/debugedit.spec @@ -0,0 +1,66 @@ +# +# spec file for package debugedit +# +# Copyright (c) 2021 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + +Name: debugedit +Version: 5.0 +Release: 0 +Summary: Debuginfo extraction +License: GPL-3.0-or-later +Group: System/Packages +URL: https://www.sourceware.org/debugedit +Source0: https://sourceware.org/ftp/%{name}/%{version}/%{name}-%{version}.tar.xz +Source1: https://sourceware.org/ftp/%{name}/%{version}/%{name}-%{version}.tar.xz.sig +Source2: %{name}.keyring +Patch0: finddebuginfo.patch +Patch1: finddebuginfo-absolute-links.patch +Patch2: debugsubpkg.patch +Patch3: debuglink.patch +Patch4: debuginfo-mono.patch +Patch5: remove-bad-shift.patch +BuildRequires: autoconf +BuildRequires: automake +BuildRequires: help2man +BuildRequires: pkgconfig(libelf) +BuildRequires: pkgconfig(libdw) + +%description +debugedit provides programs and scripts for creating debuginfo and source file distributions, +collect build-ids and rewrite source paths in DWARF data for debugging, tracing and profiling. + +%prep +%autosetup -p1 + +%build +autoreconf -fiv +%configure +%make_build + +%install +%make_install + + +%files +%license COPYING3 +%doc README +%{_bindir}/debugedit +%{_bindir}/find-debuginfo +%{_bindir}/sepdebugcrcfix +%{_mandir}/man1/debugedit.1%{?ext_man} +%{_mandir}/man1/find-debuginfo.1%{?ext_man} +%{_mandir}/man1/sepdebugcrcfix.1%{?ext_man} + +%changelog diff --git a/debuginfo-mono.patch b/debuginfo-mono.patch new file mode 100644 index 0000000..0535dc1 --- /dev/null +++ b/debuginfo-mono.patch @@ -0,0 +1,19 @@ +--- ./scripts/find-debuginfo.in.orig 2017-12-01 15:40:27.006764372 +0000 ++++ ./scripts/find-debuginfo.in 2017-12-01 15:41:17.270619182 +0000 +@@ -348,6 +348,16 @@ while read nlinks inum f; do + ;; + *) continue ;; + esac ++ # double check that we really have an ELF file, ++ # to handle monodevelop-debugger-gdb and monodevelop-debugger-mdb ++ ftype=`/usr/bin/file $f | cut -d: -f2-` ++ case $ftype in ++ *ELF*) ;; ++ *) ++ echo "$f is not an ELF file, skipping" ++ continue ++ ;; ++ esac + if [ $nlinks -gt 1 ]; then + var=seen_$inum + if test -n "${!var}"; then diff --git a/debuglink.patch b/debuglink.patch new file mode 100644 index 0000000..cdbcf56 --- /dev/null +++ b/debuglink.patch @@ -0,0 +1,11 @@ +--- ./scripts/find-debuginfo.in.orig 2017-12-01 15:39:07.239994681 +0000 ++++ ./scripts/find-debuginfo.in 2017-12-01 15:39:34.942914702 +0000 +@@ -321,7 +321,7 @@ debug_link() + get_debugfn() + { + dn=$(dirname "${1#$RPM_BUILD_ROOT}") +- bn=$(basename "$1" .debug)${unique_debug_suffix}.debug ++ bn=$(basename "$1")${unique_debug_suffix}.debug + debugdn=${debugdir}${dn} + debugfn=${debugdn}/${bn} + } diff --git a/debugsubpkg.patch b/debugsubpkg.patch new file mode 100644 index 0000000..50f8cac --- /dev/null +++ b/debugsubpkg.patch @@ -0,0 +1,41 @@ +--- ./scripts/find-debuginfo.in.orig 2017-12-01 15:35:59.023537837 +0000 ++++ ./scripts/find-debuginfo.in 2017-12-01 15:36:30.351447397 +0000 +@@ -548,19 +548,25 @@ if $run_dwz \ + fi + fi + +-# For each symlink whose target has a .debug file, +-# make a .debug symlink to that file. +-find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print | +-while read f +-do +- t=$(readlink -m "$f").debug +- f=${f#$RPM_BUILD_ROOT} +- t=${t#$RPM_BUILD_ROOT} +- if [ -f "$debugdir$t" ]; then +- echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" +- debug_link "/usr/lib/debug$t" "${f}.debug" +- fi +-done ++# We used to make a .debug symlink for each symlink whose target ++# has a .debug file to that file. This is not necessary because ++# the debuglink section contains only the destination of those links. ++# Creating those links anyway results in debuginfo packages for ++# devel packages just because of the .so symlinks in them. ++ ++## For each symlink whose target has a .debug file, ++## make a .debug symlink to that file. ++#find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print | ++#while read f ++#do ++# t=$(readlink -m "$f").debug ++# f=${f#$RPM_BUILD_ROOT} ++# t=${t#$RPM_BUILD_ROOT} ++# if [ -f "$debugdir$t" ]; then ++# echo "symlinked /usr/lib/debug$t to /usr/lib/debug${f}.debug" ++# debug_link "/usr/lib/debug$t" "${f}.debug" ++# fi ++#done + + if [ -s "$SOURCEFILE" ]; then + # See also debugedit invocation. Directories must match up. diff --git a/finddebuginfo-absolute-links.patch b/finddebuginfo-absolute-links.patch new file mode 100644 index 0000000..62fe12a --- /dev/null +++ b/finddebuginfo-absolute-links.patch @@ -0,0 +1,30 @@ +From: Jan Blunck +Subject: Do the symbolic links right in the first place + +Since brp-symlink relinks symbolic links to enforce a certain policy we should +do it right in the first place. So this patch changes find-debuginfo.sh scripts +behavior to reflect that policy. + +Signed-off-by: Jan Blunck + +--- ./scripts/find-debuginfo.in.orig 2017-12-01 15:26:21.939199791 +0000 ++++ ./scripts/find-debuginfo.in 2017-12-01 15:27:03.153081225 +0000 +@@ -305,7 +305,17 @@ debug_link() + local l="/usr/lib/debug$2" + local t="$1" + echo >> "$LINKSFILE" "$l $t" +- link_relative "$t" "$l" "$RPM_BUILD_ROOT" ++ ++ # this should correspond to what brp-symlink is doing ++ case $t in ++ /usr*) ++ link_relative "$t" "$l" "$RPM_BUILD_ROOT" ++ ;; ++ *) ++ mkdir -p "$(dirname "$RPM_BUILD_ROOT$l")" && \ ++ ln -snf "$t" "$RPM_BUILD_ROOT$l" ++ ;; ++ esac + } + + get_debugfn() diff --git a/finddebuginfo.patch b/finddebuginfo.patch new file mode 100644 index 0000000..12ec95e --- /dev/null +++ b/finddebuginfo.patch @@ -0,0 +1,89 @@ +--- ./scripts/find-debuginfo.in.orig 2019-09-09 07:56:53.377788842 +0000 ++++ ./scripts/find-debuginfo.in 2019-10-02 11:11:56.878979662 +0000 +@@ -348,12 +348,18 @@ trap 'rm -rf "$temp"' EXIT + + # Build a list of unstripped ELF files and their hardlinks + touch "$temp/primary" +-find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \ +- \( -perm -0100 -or -perm -0010 -or -perm -0001 \) \ +- -print | LC_ALL=C sort | +-file -N -f - | sed -n -e 's/^\(.*\):[ ]*.*ELF.*, not stripped.*/\1/p' | +-xargs --no-run-if-empty stat -c '%h %D_%i %n' | ++find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*.debug" -type f \( -perm /111 -or -name "*.so*" -or -name "*.ko" \) ! -name "*.a" -print0 | LC_ALL=C sort -z | ++xargs --no-run-if-empty -0 stat -c '%h %D_%i %n' | + while read nlinks inum f; do ++ case $(objdump -h $f 2>/dev/null | egrep -o '(debug[\.a-z_]*|gnu.version)') in ++ *debuglink*) continue ;; ++ *debug*) ;; ++ *gnu.version*) ++ echo "WARNING: "`echo $f | sed -e "s,^$RPM_BUILD_ROOT/*,/,"`" is already stripped!" ++ continue ++ ;; ++ *) continue ;; ++ esac + if [ $nlinks -gt 1 ]; then + var=seen_$inum + if test -n "${!var}"; then +@@ -386,6 +392,8 @@ do_file() + if [ "$no_recompute_build_id" = "true" ]; then + no_recompute="-n" + fi ++ mode=$(stat -c %a "$f") ++ chmod +w "$f" + id=$(${install_dir}/debugedit -b "$debug_base_name" -d "$debug_dest_name" \ + $no_recompute -i \ + ${build_id_seed:+--build-id-seed="$build_id_seed"} \ +@@ -413,17 +421,30 @@ do_file() + # just has its file names collected and adjusted. + case "$dn" in + /usr/lib/debug/*) ++ chmod $mode "$f" + return ;; + esac + + mkdir -p "${debugdn}" +- if test -w "$f"; then +- strip_to_debug "${debugfn}" "$f" +- else +- chmod u+w "$f" +- strip_to_debug "${debugfn}" "$f" +- chmod u-w "$f" +- fi ++ objcopy --only-keep-debug "$f" "$debugfn" || : ++ ( ++ shopt -s extglob ++ strip_option="--strip-all" ++ case "$f" in ++ *.ko) ++ strip_option="--strip-debug" ;; ++ *$STRIP_KEEP_SYMTAB*) ++ if test -n "$STRIP_KEEP_SYMTAB"; then ++ strip_option="--strip-debug" ++ fi ++ ;; ++ esac ++ if test "$NO_DEBUGINFO_STRIP_DEBUG" = true ; then ++ strip_option= ++ fi ++ objcopy --add-gnu-debuglink="$debugfn" -R .comment -R .GCC.command.line $strip_option "$f" ++ chmod $mode "$f" ++ ) || : + + # strip -g implies we have full symtab, don't add mini symtab in that case. + # It only makes sense to add a minisymtab for executables and shared +@@ -581,12 +602,14 @@ if [ -s "$SOURCEFILE" ]; then + # and non-standard modes may be inherented from original directories, fixup + find "${RPM_BUILD_ROOT}${debug_dest_name}" -type d -print0 | + xargs --no-run-if-empty -0 chmod 0755 ++ find "${RPM_BUILD_ROOT}${debug_dest_name}" -type f -print0 | ++ xargs --no-run-if-empty -0 chmod a+r + fi + + if [ -d "${RPM_BUILD_ROOT}/usr/lib" ] || [ -d "${RPM_BUILD_ROOT}/usr/src" ]; then + ((nout > 0)) || + test ! -d "${RPM_BUILD_ROOT}/usr/lib" || +- (cd "${RPM_BUILD_ROOT}/usr/lib"; find debug -type d) | ++ (cd "${RPM_BUILD_ROOT}/usr/lib"; test ! -d debug || find debug -type d) | + sed 's,^,%dir /usr/lib/,' >> "$LISTFILE" + + (cd "${RPM_BUILD_ROOT}/usr" diff --git a/remove-bad-shift.patch b/remove-bad-shift.patch new file mode 100644 index 0000000..fd78b12 --- /dev/null +++ b/remove-bad-shift.patch @@ -0,0 +1,10 @@ +--- ./scripts/find-debuginfo.in.orig 2017-12-01 15:40:27.006764372 +0000 ++++ ./scripts/find-debuginfo.in 2017-12-01 15:41:17.270619182 +0000 +@@ -168,7 +168,6 @@ + ;; + --dwz-single-file-mode) + dwz_single_file_mode=true +- shift + ;; + --build-id-seed) + build_id_seed=$2