Received: from wolfsden.cz (wolfsden.cz [37.205.8.62]) by nld3-dev1.alpinelinux.org (Postfix) with ESMTPS id 3D998782D32 for <~alpine/devel@lists.alpinelinux.org>; Thu, 8 Apr 2021 23:14:50 +0000 (UTC) Received: by wolfsden.cz (Postfix, from userid 110) id E35D84B30FF; Thu, 8 Apr 2021 23:14:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on wolfsden X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_ALL,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.2 Received: from localhost (unknown [128.0.188.242]) by wolfsden.cz (Postfix) with ESMTPSA id 73D1A4B34D0; Thu, 8 Apr 2021 23:14:48 +0000 (UTC) From: Wolf To: ~alpine/devel@lists.alpinelinux.org Cc: Wolf Subject: [PATCH] Set non-zero size if there are any files in the package Date: Fri, 9 Apr 2021 01:14:26 +0200 Message-Id: <20210408231425.293613-1-wolf@wolfsden.cz> X-Mailer: git-send-email 2.31.0 In-Reply-To: <20210408094148.734c4091@vostro> References: <20210408094148.734c4091@vostro> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 ebeb919..5a66866 100644 --- a/abuild.in +++ b/abuild.in @@ -1052,6 +1052,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" -- 2.31.0