makepkg: avoid reporting bogus install size on btrfs

delayed allocation hoses us here and causes erroenous install sizes to
be reported. Add a short sleep to allow the transaction to be committed
to the filesystem and the stat buffers to be updated.

This is apparently a "feature", as per to some of the denizens of #btrfs
on freenode.

Signed-off-by: Dave Reisner <dreisner@archlinux.org>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Dave Reisner 2012-03-27 23:43:46 -04:00 committed by Dan McGee
parent be0e044404
commit 7f258619c6
1 changed files with 6 additions and 0 deletions

View File

@ -1120,6 +1120,12 @@ write_pkginfo() {
else
local packager="Unknown Packager"
fi
# btrfs's delayed allocation causes the stat buffers from the kernel to "lie"
# to us momentarily and report 0 blocks allocated (which is how du calculates
# size). Sleeping for a second here is about the dirtiest thing possible,
# but avoids reporting entirely bogus install sizes.
sleep 1
local size="$(@DUPATH@ -sk)"
size="$(( ${size%%[^0-9]*} * 1024 ))"