[pacman-dev] [PATCH v2 1/2] Make makepkg compute sizes properly

Santiago Torres santiago at archlinux.org
Tue Mar 12 01:18:15 UTC 2019


Makepkg used to use du --apparent-size to compute the size of the
package. Unfortunately, this would result in different sizes depending
on the filesystem used (e.g., btrfs vs ext4), which would affect
reproducible builds. Use a wc-based approach to compute sizes

Signed-off-by: Santiago Torres <santiago at archlinux.org>
---
 scripts/makepkg.sh.in | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index e12826af..d1724064 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -588,8 +588,8 @@ write_kv_pair() {
 }
 
 write_pkginfo() {
-	local size="$(@DUPATH@ @DUFLAGS@)"
-	size="$(( ${size%%[^0-9]*} * 1024 ))"
+
+	local size="$(find . -type f -exec cat {} + 2>/dev/null | wc -c)"
 
 	merge_arch_attrs
 
@@ -1347,7 +1347,7 @@ if (( INFAKEROOT )); then
 	else
 		run_split_packaging
 	fi
-	
+
 	create_debug_package
 
 	msg "$(gettext "Leaving %s environment.")" "fakeroot"
-- 
2.21.0


More information about the pacman-dev mailing list