Build a single debug package for all packages from a PKGBUILD

We want to provide source files with debug symbol packages to allow easy
stepping through the program.  This becomes difficult with split packages due
to the binaries in many of these sharing source files across packages.

There are (at least) two solutions to this problem. #1: ensure common source
files are located in the debug package for the package lowest in the dependency
chain and add dependencies to the debug packages so all require source files
are present, or #2: create one debug package for all split packages in a
PKGBUILD.  The second is a more robust approach despite potentially creating
very large debug packages.

This patch creates a single $pkgbase-debug package and adds provides such that
installing $pkgname-debug will always work.

Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Allan McRae 2016-12-05 14:44:51 +10:00
parent c40ee73bc4
commit 9a4d616220
2 changed files with 13 additions and 7 deletions

View file

@ -88,7 +88,7 @@ tidy_strip() {
[[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S" [[ -z ${STRIP_STATIC+x} ]] && STRIP_STATIC="-S"
if check_option "debug" "y"; then if check_option "debug" "y"; then
dbgdir="$pkgdir-@DEBUGSUFFIX@/usr/lib/debug" dbgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@/usr/lib/debug"
mkdir -p "$dbgdir" mkdir -p "$dbgdir"
fi fi

View file

@ -787,18 +787,24 @@ create_debug_package() {
return return
fi fi
pkgdir="${pkgdir}-@DEBUGSUFFIX@" pkgdir="$pkgdirbase/$pkgbase-@DEBUGSUFFIX@"
# check if we have any debug symbols to package # check if we have any debug symbols to package
if dir_is_empty "$pkgdir/usr/lib/debug"; then if dir_is_empty "$pkgdir/usr/lib/debug"; then
return return
fi fi
depends=("$pkgname=$(get_full_version)") unset groups depends optdepends provides conflicts replaces backup install changelog
pkgdesc="Detached debugging symbols for $pkgname"
pkgname=$pkgname-@DEBUGSUFFIX@
unset groups optdepends provides conflicts replaces backup install changelog local pkg
for pkg in ${pkgname[@]}; do
if [[ $pkg != $pkgbase ]]; then
provides+=("$pkg-@DEBUGSUFFIX@")
fi
done
pkgdesc="Detached debugging symbols for $pkgname"
pkgname=$pkgbase-@DEBUGSUFFIX@
create_package create_package
} }
@ -1169,10 +1175,10 @@ run_split_packaging() {
tidy_install tidy_install
lint_package || exit 1 lint_package || exit 1
create_package create_package
create_debug_package
restore_package_variables restore_package_variables
done done
pkgname=("${pkgname_backup[@]}") pkgname=("${pkgname_backup[@]}")
create_debug_package
} }
usage() { usage() {