Sync from SUSE:SLFO:Main debugedit revision 7bfb6f41cbf709222f2de0a276a63186

This commit is contained in:
Adrian Schröter 2024-05-03 12:01:19 +02:00
commit 19dba5b278
12 changed files with 352 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -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

BIN
debugedit-5.0.tar.xz (Stored with Git LFS) Normal file

Binary file not shown.

BIN
debugedit-5.0.tar.xz.sig Normal file

Binary file not shown.

36
debugedit.changes Normal file
View File

@ -0,0 +1,36 @@
-------------------------------------------------------------------
Wed Nov 16 07:28:09 UTC 2022 - Ludwig Nussel <lnussel@suse.de>
- don't hard require gdb (boo#1205344)
-------------------------------------------------------------------
Sun Sep 4 10:29:29 UTC 2022 - Andreas Stieger <andreas.stieger@gmx.de>
- finddebuginfo.patch: convert obsolete egrep to grep -E
(boo#1203092)
-------------------------------------------------------------------
Wed Jul 6 12:43:49 UTC 2022 - Ludwig Nussel <lnussel@suse.de>
- move find-debuginfo and sepdebugcrcfix which are basically tools
for use by rpmbuild only to /usr/lib/rpm where they used to be
when debugedit was bundled with rpm.
-------------------------------------------------------------------
Mon Jun 27 11:36:59 UTC 2022 - Ludwig Nussel <lnussel@suse.de>
- refresh patches to apply clean
- add git url
- add requires
-------------------------------------------------------------------
Wed Jun 30 13:06:47 UTC 2021 - Callum Farmer <gmbr3@opensuse.org>
- 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

BIN
debugedit.keyring Normal file

Binary file not shown.

82
debugedit.spec Normal file
View File

@ -0,0 +1,82 @@
#
# spec file for package debugedit
#
# Copyright (c) 2022 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
#Git-Clone: https://sourceware.org/git/debugedit.git
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(libdw)
BuildRequires: pkgconfig(libelf)
# /usr/bin/gdb-add-index is optional
Suggests: gdb
Requires: binutils
Requires: coreutils
Requires: dwz
Requires: elfutils
Requires: findutils
Requires: gawk
Requires: grep
Requires: sed
Requires: xz
%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 -p0
%build
autoreconf -fiv
%configure
%make_build
%install
%make_install
mkdir -p %{buildroot}/usr/lib/rpm
mv %{buildroot}%{_bindir}/{find-debuginfo,sepdebugcrcfix} %{buildroot}/usr/lib/rpm
ln -s ../../bin/debugedit %{buildroot}/usr/lib/rpm
%files
%license COPYING3
%doc README
%{_bindir}/debugedit
/usr/lib/rpm/debugedit
/usr/lib/rpm/find-debuginfo
/usr/lib/rpm/sepdebugcrcfix
%{_mandir}/man1/debugedit.1%{?ext_man}
%{_mandir}/man1/find-debuginfo.1%{?ext_man}
%{_mandir}/man1/sepdebugcrcfix.1%{?ext_man}
%changelog

21
debuginfo-mono.patch Normal file
View File

@ -0,0 +1,21 @@
Index: scripts/find-debuginfo.in
===================================================================
--- scripts/find-debuginfo.in.orig
+++ scripts/find-debuginfo.in
@@ -434,6 +434,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

13
debuglink.patch Normal file
View File

@ -0,0 +1,13 @@
Index: scripts/find-debuginfo.in
===================================================================
--- scripts/find-debuginfo.in.orig
+++ scripts/find-debuginfo.in
@@ -407,7 +407,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}
}

43
debugsubpkg.patch Normal file
View File

@ -0,0 +1,43 @@
Index: scripts/find-debuginfo.in
===================================================================
--- scripts/find-debuginfo.in.orig
+++ scripts/find-debuginfo.in
@@ -643,19 +643,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.

View File

@ -0,0 +1,30 @@
From: Jan Blunck <jblunck@suse.de>
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 <jblunck@suse.de>
--- ./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()

91
finddebuginfo.patch Normal file
View File

@ -0,0 +1,91 @@
Index: scripts/find-debuginfo.in
===================================================================
--- scripts/find-debuginfo.in.orig
+++ scripts/find-debuginfo.in
@@ -412,12 +412,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 | grep -E -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
@@ -450,6 +456,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"} \
@@ -477,17 +485,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
@@ -646,12 +667,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"

10
remove-bad-shift.patch Normal file
View File

@ -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