From 585c08bad5b055bb850fa1a57be0aab5415adc8f Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Wed, 15 Nov 2017 22:28:10 +0000 Subject: [PATCH] Workaround for Qemu aarch64 abuild-tar bug (#907) See also: --- main/abuild-aarch64-qemu-workaround/APKBUILD | 25 +++++++++++++++++++ ...build-aarch64-qemu-workaround.post-install | 2 ++ .../write-check-count.patch | 13 ++++++++++ 3 files changed, 40 insertions(+) create mode 100644 main/abuild-aarch64-qemu-workaround/APKBUILD create mode 100644 main/abuild-aarch64-qemu-workaround/abuild-aarch64-qemu-workaround.post-install create mode 100644 main/abuild-aarch64-qemu-workaround/write-check-count.patch diff --git a/main/abuild-aarch64-qemu-workaround/APKBUILD b/main/abuild-aarch64-qemu-workaround/APKBUILD new file mode 100644 index 000000000..05435e6e6 --- /dev/null +++ b/main/abuild-aarch64-qemu-workaround/APKBUILD @@ -0,0 +1,25 @@ +pkgname=abuild-aarch64-qemu-workaround +pkgver=3.1.0 +pkgrel=0 +pkgdesc="Patched abuild-tar that works with Qemu" +url="https://github.com/postmarketOS/pmbootstrap/issues/546" +arch="aarch64" +license="GPL2" +depends="" +install="$pkgname.post-install" +options="!check" +source="abuild-$pkgver.tar.gz::https://github.com/alpinelinux/abuild/archive/v$pkgver.tar.gz write-check-count.patch" +makedepends="libressl-dev" + +builddir="$srcdir/abuild-$pkgver" +build() { + make VERSION="$pkgver-r$pkgrel" abuild-tar +} + +package() { + cd "$builddir" + install -Dm755 abuild-tar "$pkgdir"/usr/bin/abuild-tar-patched +} + +sha512sums="fcdbef96b06a908148d6df41981fca19fe1767274b283efbb3f1adaefc074a4daa7b8eea8d49c533858c464e45b3954f97cd3d0185f0ed7e464244f9802001f5 abuild-3.1.0.tar.gz +a80c55fe6cb6cc410ca409558c1e1ab8edec9a675031c404cec84c19b4b8460fbbba92db5c1401c0027f8fc0f5be4b82177ec2fad9d734cbc50ca24bfe6e149f write-check-count.patch" diff --git a/main/abuild-aarch64-qemu-workaround/abuild-aarch64-qemu-workaround.post-install b/main/abuild-aarch64-qemu-workaround/abuild-aarch64-qemu-workaround.post-install new file mode 100644 index 000000000..590e19c56 --- /dev/null +++ b/main/abuild-aarch64-qemu-workaround/abuild-aarch64-qemu-workaround.post-install @@ -0,0 +1,2 @@ +#!/bin/sh +ln -svf /usr/bin/abuild-tar-patched /usr/local/bin/abuild-tar diff --git a/main/abuild-aarch64-qemu-workaround/write-check-count.patch b/main/abuild-aarch64-qemu-workaround/write-check-count.patch new file mode 100644 index 000000000..39ad73180 --- /dev/null +++ b/main/abuild-aarch64-qemu-workaround/write-check-count.patch @@ -0,0 +1,13 @@ +--- a/abuild-tar.c ++++ b/abuild-tar.c +@@ -156,7 +156,9 @@ static ssize_t full_write(int fd, const void *buf, size_t count) + count -= n; + } while (1); + +- if (total == 0 && n < 0) ++ // Workaround for Qemu bug: also check for count: ++ // ++ if (total == 0 && n < 0 && count) + return -errno; + + return total;