summaryrefslogtreecommitdiffstats
path: root/scripts/libmakepkg
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2020-05-11 06:16:30 +0200
committerAndrew Gregory <andrew@archlinux.org>2020-06-18 11:03:33 +0200
commit03cfe9e21c6aaecaac21e932229a55f5f1041a3c (patch)
tree0c89b711121f14615152f036c209790147b8d04e /scripts/libmakepkg
parentb3be0ce99b29e5384969c7b3e5ff6f4b0f581c4b (diff)
downloadpacman-03cfe9e21c6aaecaac21e932229a55f5f1041a3c.tar.gz
pacman-03cfe9e21c6aaecaac21e932229a55f5f1041a3c.tar.xz
libmakepkg/strip: don't re-add the same debug source multiple times
It's either a waste of work, or triggers edge cases in some packages (like coreutils-8.31) where the source file is readonly and cp gets a permission denied error trying to overwrite it with an identical copy of itself. Also while we are at it, make the variable names be something readable, because I could barely tell what this was doing while editing it. Signed-off-by: Eli Schwartz <eschwartz@archlinux.org> Signed-off-by: Allan McRae <allan@archlinux.org> (cherry picked from commit 3674144a74cfe897ec3ff46c18681df293290caa)
Diffstat (limited to 'scripts/libmakepkg')
-rw-r--r--scripts/libmakepkg/tidy/strip.sh.in11
1 files changed, 7 insertions, 4 deletions
diff --git a/scripts/libmakepkg/tidy/strip.sh.in b/scripts/libmakepkg/tidy/strip.sh.in
index 82ab1ce1..b04426c9 100644
--- a/scripts/libmakepkg/tidy/strip.sh.in
+++ b/scripts/libmakepkg/tidy/strip.sh.in
@@ -56,11 +56,14 @@ strip_file() {
fi
# copy source files to debug directory
- local f t
+ local file dest t
while IFS= read -r t; do
- f=${t/${dbgsrcdir}/"$srcdir"}
- mkdir -p "${dbgsrc/"$dbgsrcdir"/}${t%/*}"
- cp -- "$f" "${dbgsrc/"$dbgsrcdir"/}$t"
+ file=${t/${dbgsrcdir}/"$srcdir"}
+ dest="${dbgsrc/"$dbgsrcdir"/}$t"
+ if ! [[ -f $dest ]]; then
+ mkdir -p "${dest%/*}"
+ cp -- "$file" "$dest"
+ fi
done < <(source_files "$binary")
# copy debug symbols to debug directory