From 719252b7b29749389730057387d5a43b5516f7fe Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Tue, 20 Feb 2018 22:03:13 -0600 Subject: system/abuild: add our custom patchset to abuild --- ...01-abuild-add-env-option-to-require-tests.patch | 33 ++++++++++ system/abuild/APKBUILD | 76 ++++++++++++++++++++++ system/abuild/abuild.pre-install | 5 ++ system/abuild/abuild.pre-upgrade | 1 + system/abuild/newapkbuild-cmake.patch | 35 ++++++++++ system/abuild/posix-abuild.patch | 68 +++++++++++++++++++ 6 files changed, 218 insertions(+) create mode 100644 system/abuild/0001-abuild-add-env-option-to-require-tests.patch create mode 100644 system/abuild/APKBUILD create mode 100644 system/abuild/abuild.pre-install create mode 120000 system/abuild/abuild.pre-upgrade create mode 100644 system/abuild/newapkbuild-cmake.patch create mode 100644 system/abuild/posix-abuild.patch (limited to 'system/abuild') diff --git a/system/abuild/0001-abuild-add-env-option-to-require-tests.patch b/system/abuild/0001-abuild-add-env-option-to-require-tests.patch new file mode 100644 index 000000000..49497421b --- /dev/null +++ b/system/abuild/0001-abuild-add-env-option-to-require-tests.patch @@ -0,0 +1,33 @@ +From d85a92478fc8a95bdcb4bf84c30c20ca935abc08 Mon Sep 17 00:00:00 2001 +From: Carlo Landmeter +Date: Tue, 24 Oct 2017 14:48:52 +0200 +Subject: [PATCH] abuild: add env option to require tests + +This adds an env option REQUIRE_CHECK to require testsuites to +be run. This does not clutter getopts so it can be safely removed +afterwards when we enforce tests globally. This will allow our CI +infrastructure to enforce testsuites where possible. +--- + abuild.in | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/abuild.in b/abuild.in +index 41b465d..7e3c818 100644 +--- a/abuild.in ++++ b/abuild.in +@@ -226,6 +226,12 @@ default_sanitycheck() { + check_secfixes_comment || return 1 + + makedepends_has 'g++' && ! options_has toolchain && warning "g++ should not be in makedepends" ++ ++ if ! options_has "!check" && [ -n "$REQUIRE_CHECK" ]; then ++ (unset check; . "$APKBUILD"; type check >/dev/null 2>&1) || \ ++ die "Testsuites (abuild check) are required or needs to be explicitly disabled!" ++ fi ++ + return 0 + } + +-- +2.14.2 + diff --git a/system/abuild/APKBUILD b/system/abuild/APKBUILD new file mode 100644 index 000000000..cd2bcb0ee --- /dev/null +++ b/system/abuild/APKBUILD @@ -0,0 +1,76 @@ +# Maintainer: Natanael Copa +pkgname=abuild +pkgver=3.1.0 +_ver=${pkgver%_git*} +pkgrel=1 +pkgdesc="Script to build Alpine Packages" +url="http://git.alpinelinux.org/cgit/abuild/" +arch="all" +license="GPL2" +depends="fakeroot sudo pax-utils openssl apk-tools>=2.0.7-r1 libc-utils + attr libarchive-tools pkgconf patch lzip" +if [ "$CBUILD" = "$CHOST" ]; then + depends="$depends curl" +fi +makedepends_build="pkgconfig" +makedepends_host="openssl-dev zlib-dev" +makedepends="$makedepends_host $makedepends_build" +install="$pkgname.pre-install $pkgname.pre-upgrade" +subpackages="apkbuild-cpan:cpan:noarch apkbuild-gem-resolver:gems:noarch + abuild-rootbld:_rootbld:noarch" +options="suid !check" +pkggroups="abuild" +source="http://dev.alpinelinux.org/archive/abuild/abuild-$_ver.tar.xz + posix-abuild.patch + newapkbuild-cmake.patch + 0001-abuild-add-env-option-to-require-tests.patch + " +builddir="$srcdir/$pkgname-$_ver" + +prepare() { + default_prepare + + cd "$builddir" + sed -i -e "/^CHOST=/s/=.*/=$CHOST/" abuild.conf +} + +build() { + cd "$builddir" + make VERSION="$pkgver-r$pkgrel" +} + +package() { + cd "$builddir" + + make install VERSION="$pkgver-r$pkgrel" DESTDIR="$pkgdir" + + install -m 644 abuild.conf "$pkgdir"/etc/abuild.conf + install -d -m 775 -g abuild "$pkgdir"/var/cache/distfiles +} + +cpan() { + pkgdesc="Script to generate perl APKBUILD from CPAN" + depends="perl perl-libwww perl-json perl-module-build-tiny" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/apkbuild-cpan "$subpkgdir"/usr/bin/ +} + +gems() { + pkgdesc="APKBUILD dependency resolver for RubyGems" + depends="ruby ruby-augeas" + + mkdir -p "$subpkgdir"/usr/bin + mv "$pkgdir"/usr/bin/apkbuild-gem-resolver "$subpkgdir"/usr/bin/ +} + +_rootbld() { + pkgdesc="Build packages in chroot" + depends="abuild bubblewrap gettext git" + mkdir -p "$subpkgdir" +} + +sha512sums="bb9093d67942e3a63e4e053692c0bca30940cae05955518206cd9f7029211a188b7f442456ae126e61cbdca224eddb31e967d5cf0637e16893163cc963871a52 abuild-3.1.0.tar.xz +86194084e95cdb42d4b1bc3d4ff2b8144125aa4e7f74f8c97023c55f2304d27d8c377baf5075666c9b43323506357b962d83d4a30a3f41cde7b53542889adf2d posix-abuild.patch +705c393b37c37a364473590190122a43a2962946290a873e6685cd4eb43c4874bfdf7489e7b655f870b332dee38edca5dcf2d3906461001875a55b9e6549b824 newapkbuild-cmake.patch +e02cc44c8ad9dd61c9b80684b8cf5b64477a6fd6221cde9efea2a7594c6e7ce01a51f8bd4b80d72f82f7caf93217979fb0b354c420983891fa93f34c4252a035 0001-abuild-add-env-option-to-require-tests.patch" diff --git a/system/abuild/abuild.pre-install b/system/abuild/abuild.pre-install new file mode 100644 index 000000000..fd3d39a36 --- /dev/null +++ b/system/abuild/abuild.pre-install @@ -0,0 +1,5 @@ +#!/bin/sh + +addgroup -S abuild 2>/dev/null + +exit 0 diff --git a/system/abuild/abuild.pre-upgrade b/system/abuild/abuild.pre-upgrade new file mode 120000 index 000000000..99e4a2144 --- /dev/null +++ b/system/abuild/abuild.pre-upgrade @@ -0,0 +1 @@ +abuild.pre-install \ No newline at end of file diff --git a/system/abuild/newapkbuild-cmake.patch b/system/abuild/newapkbuild-cmake.patch new file mode 100644 index 000000000..e83ba753a --- /dev/null +++ b/system/abuild/newapkbuild-cmake.patch @@ -0,0 +1,35 @@ +From 4e0fb906bb3c77f307763a9565295e7d23a3b5e7 Mon Sep 17 00:00:00 2001 +From: "A. Wilcox" +Date: Wed, 11 Oct 2017 17:47:23 -0500 +Subject: [PATCH] newapkbuild: add default check to CMake and RelWithDebugInfo + type + +--- + newapkbuild.in | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/newapkbuild.in b/newapkbuild.in +index c11aa39..d1cf2b9 100644 +--- a/newapkbuild.in ++++ b/newapkbuild.in +@@ -66,11 +66,16 @@ build_cmake() { + -DCMAKE_INSTALL_PREFIX=/usr \\ + -DCMAKE_INSTALL_LIBDIR=lib \\ + -DBUILD_SHARED_LIBS=True \\ +- -DCMAKE_BUILD_TYPE=Release \\ ++ -DCMAKE_BUILD_TYPE=RelWithDebugInfo \\ + -DCMAKE_CXX_FLAGS="\$CXXFLAGS" \\ + -DCMAKE_C_FLAGS="\$CFLAGS" \\ + \${CMAKE_CROSSOPTS} + make ++} ++ ++check() { ++ cd "\$builddir" ++ CTEST_OUTPUT_ON_FAILURE=TRUE ctest + __EOF__ + } + +-- +2.14.1 + diff --git a/system/abuild/posix-abuild.patch b/system/abuild/posix-abuild.patch new file mode 100644 index 000000000..ae95bec72 --- /dev/null +++ b/system/abuild/posix-abuild.patch @@ -0,0 +1,68 @@ +--- src/abuild.in 2017-09-19 07:02:57.000000000 -0500 ++++ src/abuild.in 2017-09-23 22:34:32.534221312 -0500 +@@ -1,4 +1,4 @@ +-#!/bin/ash -e ++#!/bin/sh -e + + # abuild - build apk packages (light version of makepkg) + # Copyright (c) 2008-2015 Natanael Copa +@@ -425,11 +425,11 @@ + tar -C "$srcdir" --lzip -xf "$s" || return 1;; + *.tar.lzma) + msg "Unpacking $s..." +- unlzma -c "$s" | tar -C "$srcdir" -x \ ++ unlzma -c "$s" | tar -C "$srcdir" -f - -x \ + || return 1;; + *.tar.xz) + msg "Unpacking $s..." +- unxz -c "$s" | tar -C "$srcdir" -x || return 1;; ++ unxz -c "$s" | tar -C "$srcdir" -f - -x || return 1;; + *.zip) + msg "Unpacking $s..." + unzip -n -q "$s" -d "$srcdir" || return 1;; +@@ -476,7 +476,7 @@ + subpkgarch=${_splitarch#*:} + if [ "$subpkgarch" = "$_splitarch" -o -z "$subpkgarch" ]; then + case "$subpkgname" in +- *-doc | *-lang | *-lang-*) subpkgarch="noarch" ;; ++ *-doc | *-lang | *-lang-* | *-openrc) subpkgarch="noarch" ;; + *) subpkgarch="$pkgarch" ;; + esac + fi +@@ -1395,7 +1395,7 @@ + touch .dummy + set -- .dummy + fi +- tar --xattrs -f - -c "$@" | abuild-tar --hash | gzip -9 >"$dir"/data.tar.gz ++ tar --format pax --xattrs -f - -c "$@" | abuild-tar --hash | gzip -9 >"$dir"/data.tar.gz + + msg "Create checksum..." + # append the hash for data.tar.gz +@@ -1404,7 +1404,7 @@ + + # control.tar.gz + cd "$dir" +- tar -f - -c $(cat "$dir"/.metafiles) | abuild-tar --cut \ ++ tar --format pax -f - -c $(cat "$dir"/.metafiles) | abuild-tar --cut \ + | gzip -9 > control.tar.gz + abuild-sign -q control.tar.gz || exit 1 + +@@ -1483,9 +1483,7 @@ + + # predefined function check + default_check() { +- warning "APKBUILD does not run any tests!" +- msg2 "Alpine policy will soon require that packages have any relevant testsuites run during the build process." +- msg2 "To fix, either define a check() function, or declare !check in \$options to indicate the package does not have a testsuite." ++ die "APKBUILD does not run any tests!" + } + + check() { +@@ -2337,6 +2335,7 @@ + } + + usage() { ++ echo "$program $program_version" + cat <<-EOF + usage: $program [options] [-P REPODEST] [-s SRCDEST] [-D DESCRIPTION] [cmd] ... + $program [-c] -n PKGNAME[-PKGVER] -- cgit v1.2.3-70-g09d2