libmakepkg - add wrapper function for objcopy
Using objcopy can result in file permission changes. We work around this by using "cat" to copy the temporary output file into the target. Extract this code into a utility function. Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
a2d029388c
commit
71afd4d88f
1 changed files with 9 additions and 4 deletions
|
@ -66,6 +66,14 @@ package_source_files() {
|
||||||
done < <(source_files "$binary")
|
done < <(source_files "$binary")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
safe_objcopy() {
|
||||||
|
local binary=$1; shift
|
||||||
|
local tempfile=$(mktemp "$binary.XXXXXX")
|
||||||
|
objcopy "$@" "$binary" "$tempfile"
|
||||||
|
cat "$tempfile" > "$binary"
|
||||||
|
rm "$tempfile"
|
||||||
|
}
|
||||||
|
|
||||||
collect_debug_symbols() {
|
collect_debug_symbols() {
|
||||||
local binary=$1; shift
|
local binary=$1; shift
|
||||||
|
|
||||||
|
@ -92,10 +100,7 @@ collect_debug_symbols() {
|
||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local tempfile=$(mktemp "$binary.XXXXXX")
|
safe_objcopy "$binary" --add-gnu-debuglink="$dbgdir/${binary#/}.debug"
|
||||||
objcopy --add-gnu-debuglink="$dbgdir/${binary#/}.debug" "$binary" "$tempfile"
|
|
||||||
cat "$tempfile" > "$binary"
|
|
||||||
rm "$tempfile"
|
|
||||||
|
|
||||||
# create any needed hardlinks
|
# create any needed hardlinks
|
||||||
while IFS= read -rd '' file ; do
|
while IFS= read -rd '' file ; do
|
||||||
|
|
Loading…
Add table
Reference in a new issue