From 29557a4a5432e084207ae7f746f50be4cfd9c070 Mon Sep 17 00:00:00 2001 From: Wolf Date: Fri, 9 Apr 2021 00:47:35 +0200 Subject: [PATCH] Set non-zero size if there are any files in the package If there are only empty files in the pkgdir, on some filesystems (discovered on btrfs), du might return 0 for the sum size of the files. But apk-tools considers packages with size = 0 to be virtual and skips extraction of any files contained. To work around that (until it is resolved in apk-tools 3), settings the size to 1 when it is zero AND some files are present should work fine. --- abuild.in | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/abuild.in b/abuild.in index d1c1632..303834c 100644 --- a/abuild.in +++ b/abuild.in @@ -1061,6 +1061,13 @@ prepare_metafiles() { esac local size=$(du -sk | awk '{print $1 * 1024}') + # If package contains only empty files, the size might be 0. But due to + # apk-tools 2 considering packages with size = 0 virtual, nothing is + # extracted. That will be solved in apk-tools 3. As a workaround we can + # set the size to 1 if any files are present. + if [ "$size" -eq 0 ] && [ -n "$(find . ! -name .)" ]; then + size=1 + fi if [ "$arch" != "$apkbuild_arch" ]; then local msg="Split function set arch=\"$arch\" for $name, use subpackages=pkg:split:arch format instead"