[pacman-dev] [PATCH 2/2] makepkg: do not count hard linked file sizes multiple times
Ronan Pigott
rpigott314 at gmail.com
Sun Oct 27 03:11:34 UTC 2019
From: Ronan Pigott <rpigott at berkeley.edu>
---
scripts/makepkg.sh.in | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 997c8668..0725f582 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -584,7 +584,15 @@ write_kv_pair() {
}
write_pkginfo() {
- local size="$(find . -type f -exec cat {} + 2>/dev/null | wc -c)"
+ local inode size=0
+ declare -A files
+ while read -rd $'\0' file; do
+ inode=$( @INODECMD@ "$file" )
+ if [[ -z "${files[$inode]}" ]]; then
+ files[$inode]=$(wc -c < "$file")
+ size=$((size + ${files[$inode]}))
+ fi
+ done < <(find . -type f -print0)
merge_arch_attrs
--
2.23.0
More information about the pacman-dev
mailing list