Subject: [alpine-aports] [PATCH 1/2] testing/samurai: remove check()

From: Michael Forney <[email-masked]>
Date: Mon, 18 Mar 2019 00:05:08 -0700

There is no provided test suite. The `build.ninja` is meant to be an
alternative build mechanism and requires modification to set desired
compile and link flags.

So, running `./samu` in check() will rebuild itself before packaging,
but without the CFLAGS and LDFLAGS set by abuild, resulting in an
unoptimized binary.
---
 testing/samurai/APKBUILD | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/testing/samurai/APKBUILD b/testing/samurai/APKBUILD
index fa51ea9a6d..befb1c1772 100644
--- a/testing/samurai/APKBUILD
+++ b/testing/samurai/APKBUILD
@@ -2,11 +2,12 @@
 # Maintainer: Drew DeVault <[email-masked]>
 pkgname=samurai
 pkgver=0.6
-pkgrel=0
+pkgrel=1
 pkgdesc="ninja-compatible build tool written in C"
 url="https://github.com/michaelforney/samurai"
 arch="all"
 license="Apache-2.0"
+options="!check"  # No test suite.
 subpackages="$pkgname-doc"
 source="$pkgname-$pkgver.tar.gz::https://github.com/michaelforney/$pkgname/archive/$pkgver.tar.gz"
 builddir="$srcdir/$pkgname-$pkgver"
@@ -16,12 +17,6 @@ build() {
 	make
 }
 
-check() {
-	cd "$builddir"
-	rm *.o
-	./samu
-}
-
 package() {
 	cd "$builddir"
 	make install PREFIX="/usr" DESTDIR="$pkgdir"
-- 
2.19.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Michael Forney <[email-masked]>
Date: Mon, 18 Mar 2019 00:05:09 -0700

The GitHub tag archives are not necessarily stable, so the upstream
provided one should be preferred.
---
 testing/samurai/APKBUILD | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/testing/samurai/APKBUILD b/testing/samurai/APKBUILD
index befb1c1772..51a9a3239f 100644
--- a/testing/samurai/APKBUILD
+++ b/testing/samurai/APKBUILD
@@ -2,14 +2,14 @@
 # Maintainer: Drew DeVault <[email-masked]>
 pkgname=samurai
 pkgver=0.6
-pkgrel=1
+pkgrel=2
 pkgdesc="ninja-compatible build tool written in C"
 url="https://github.com/michaelforney/samurai"
 arch="all"
 license="Apache-2.0"
 options="!check"  # No test suite.
 subpackages="$pkgname-doc"
-source="$pkgname-$pkgver.tar.gz::https://github.com/michaelforney/$pkgname/archive/$pkgver.tar.gz"
+source="https://github.com/michaelforney/$pkgname/releases/download/$pkgver/$pkgname-$pkgver.tar.gz"
 builddir="$srcdir/$pkgname-$pkgver"
 
 build() {
-- 
2.19.1

---

---

From: Drew DeVault <[email-masked]>
Date: Sun, 24 Mar 2019 21:57:01 -0400

Sorry I missed this - can you Cc me on future patches?

+1 on patch 2/2

> but without the CFLAGS and LDFLAGS set by abuild, resulting in an

Hm, I understand the problem, but having samu build itself seems like a
pretty good test. I'd rather fix the CFLAGS/LDFLAGS than nix the check()
entirely. Testing a full gcc bootstrap involves a similar process.

Thoughts?

---

---

From: Michael Forney <[email-masked]>
Date: Sun, 24 Mar 2019 20:00:36 -0700

> Sorry I missed this - can you Cc me on future patches?

Sure.

> entirely. Testing a full gcc bootstrap involves a similar process.

I think it's fine to build itself as a test, but I think that the
binary that gets installed should be the one produced in build(). I
don't know much about the Alpine build system, but I assume check()
does not get run for cross builds, and I think it would be bad to
build the binary two different ways depending on whether we were able
to run check().

So, maybe you could just rename the binary at the end of build(), and
install that version in package()? Or, extract the sources again
somewhere else and run `./samu -C $checkdir`.

---