abuild size differs depending on file system
abuild uses du -sk
to get the size of the package. This command includes the size of directories. The size of directories depends on the file system though. Eg. on ext4 the size is 4K and on a tmpfs it depends on the content. The same probably effects special files and symlinks too.
I suggest only counting the size of normal files. Something like this could be used instead:
(wasn't good)find . -type f -exec du -csb -- {} + 2>/dev/null | tail -n 1 | cut -f1
This would be as far as I can tell consistent with the apk3 behavior then.
Handles
- hardlinks
-
spaces in path
- newlines in path
- when no files exist
- files without read permission
-
files up to
2^31-1
bytes (fat32 limit) - multiple filesystems (inodes per filesystem)
-
directories without read/execute permission
- alternatively errors
Current best
{ echo 0; find . -type f -exec stat -c '%d:%i %s' -- {} + |
awk '!x[$1]++ {print $2}'; } | paste -sd+ | bc | tr -d '\\\n'
or
{ find . -type f -exec stat -c '%d:%i %s' -- {} + |
awk '!x[$1]++ {print $2}' | tr '\n' +; echo 0; } | bc | tr -d '\\\n'