6bfa4a28aa
In an environment created by `hsh --initroot-only`: $ for i in /usr/lib/rpm/*; do rpm -qf --qf='%{name}: '"$i"'\n' "$i"; done | grep '^rpm:' rpm: /usr/lib/rpm/0ldconfig.filetrigger rpm: /usr/lib/rpm/GROUPS rpm: /usr/lib/rpm/find-package rpm: /usr/lib/rpm/functions rpm: /usr/lib/rpm/macros.d rpm: /usr/lib/rpm/pdeath_execute rpm: /usr/lib/rpm/platform rpm: /usr/lib/rpm/posttrans-filetriggers rpm: /usr/lib/rpm/postupdate rpm: /usr/lib/rpm/rpmd rpm: /usr/lib/rpm/rpmdb_loadcvt rpm: /usr/lib/rpm/rpme rpm: /usr/lib/rpm/rpmi rpm: /usr/lib/rpm/rpmk rpm: /usr/lib/rpm/rpmpopt-4.13.0.1 rpm: /usr/lib/rpm/rpmq rpm: /usr/lib/rpm/rpmu rpm: /usr/lib/rpm/rpmv The `scripts/functions` file is provided from the rpm project in real installations. Let's ensure scripts in this package use the functions file from this package.
120 lines
2.7 KiB
Bash
Executable File
120 lines
2.7 KiB
Bash
Executable File
#!/bin/sh -efu
|
|
#
|
|
# find-debuginfo-files - make %files list for debuginfo package
|
|
#
|
|
# Written by Alexey Tourbin <at@altlinux.org>.
|
|
# License: GPLv2+.
|
|
|
|
. @RPMCONFIGDIR@/rpmb-functions
|
|
ValidateBuildRoot
|
|
|
|
cd "$RPM_BUILD_ROOT"
|
|
|
|
rm -rf .tmp
|
|
mkdir .tmp
|
|
|
|
>.tmp/files
|
|
>.tmp/files-can
|
|
>.tmp/links
|
|
>.tmp/links-in
|
|
>.tmp/src
|
|
|
|
while read -r f; do
|
|
f=${f#$RPM_BUILD_ROOT}
|
|
|
|
[ -n "$f" ] || continue
|
|
|
|
if [ -z "${f##/boot/vmlinuz-*}" ]; then
|
|
# Redirect to vmlinux saved by debuginfo.brp into debug tree's
|
|
# %modules_dir.
|
|
kver=${f#/boot/vmlinuz-}
|
|
f=/usr/lib/debug/lib/modules/$kver/vmlinux
|
|
if [ -e ".$f" ]; then
|
|
printf '%s\n' "$f" >> .tmp/files
|
|
else
|
|
Warning "Expected $f not found."
|
|
fi
|
|
fi
|
|
fbin=$f # Actual binary for linking
|
|
|
|
if [ -z "${f#/lib/modules/*.ko.[gx]z}" ]; then
|
|
# For gzipped modules actual binary is kept in debug tree
|
|
# (placed by debuginfo.brp) and goes into -debuginfo package.
|
|
f=${f%.[gx]z}
|
|
fbin=/usr/lib/debug$f
|
|
if [ -e ".$fbin" ]; then
|
|
printf '%s\n' "$fbin" >> .tmp/files
|
|
else
|
|
Warning "Expected $fbin not found."
|
|
fi
|
|
fi
|
|
|
|
if [ -f .debuginfo/src/"$f" ]; then
|
|
LC_ALL=C sort -m -u -o .tmp/src .tmp/src .debuginfo/src/"$f"
|
|
fi
|
|
|
|
debugf=./usr/lib/debug$f.debug
|
|
[ -f "$debugf" ] || continue
|
|
if [ -L "$debugf" ]; then
|
|
# Save symlink for later filtering.
|
|
printf '%s\n' "$debugf" >> .tmp/links-in
|
|
continue
|
|
fi
|
|
printf '%s\n' "${debugf#.}" >> .tmp/files
|
|
|
|
# Save canonical file name for later symlinks filtering.
|
|
readlink -ve "$debugf" >> .tmp/files-can
|
|
|
|
id=$(debugedit -n -i "$debugf")
|
|
[ -n "$id" ] || continue
|
|
|
|
link=./usr/lib/debug/.build-id/${id:0:2}/${id:2}
|
|
if [ ! -L "$link" ]; then
|
|
mkdir -p "${link%/*}"
|
|
ln -snf "$(relative "$fbin" "${link#.}")" "$link"
|
|
ln -snf "$(relative "${debugf#.}" "${link#.}".debug)" "$link".debug
|
|
fi
|
|
to=$(readlink -vm "$link")
|
|
if [ "$to" = "$RPM_BUILD_ROOT$fbin" ]; then
|
|
printf '%s\n' "${link#.}" >> .tmp/links
|
|
printf '%s\n' "${link#.}".debug >> .tmp/links
|
|
fi
|
|
done
|
|
|
|
# Filter out symlinks pointing out of the package.
|
|
sort -u .tmp/links-in |
|
|
while read -r link; do
|
|
to=$(readlink -vm "$link")
|
|
if grep -Fqsxe "$to" .tmp/files-can; then
|
|
printf '%s\n' "${link#.}" >> .tmp/links
|
|
fi
|
|
done
|
|
|
|
sed 's|\(.*\)/.*|\1|' .tmp/files .tmp/links .tmp/src |sort -u |
|
|
while read -r dir; do
|
|
while [ -n "$dir" ]; do
|
|
case $dir in
|
|
/usr/lib/debug/usr/*/*)
|
|
printf '%s\n' "$dir" ;;
|
|
/usr/lib/debug/usr/*)
|
|
break ;;
|
|
/usr/lib/debug/*/*)
|
|
printf '%s\n' "$dir" ;;
|
|
/usr/lib/debug/*)
|
|
break ;;
|
|
/usr/src/debug/*)
|
|
printf '%s\n' "$dir" ;;
|
|
*)
|
|
break ;;
|
|
esac
|
|
dir=${dir%/*}
|
|
done
|
|
done |
|
|
sort -u |
|
|
sed 's/^/%dir /'
|
|
|
|
# Filter out directories from debugedit src list file.
|
|
grep -v '/$' < .tmp/src > .tmp/src-files ||:
|
|
|
|
sort .tmp/files .tmp/links .tmp/src-files
|