Subject: [PATCH] testing/yggdrasil-go: new aport

From: opal hart <[email-masked]>
Date: Sun, 14 Jun 2020 15:43:40 +0000

cc neilalexander to see if we can do `go test` already or if we should
keep options=!check in APKBUILD

otherwise, the package works, currently using on two systems
---
 testing/yggdrasil/APKBUILD        | 51 +++++++++++++++++++++++++++++++
 testing/yggdrasil/yggdrasil.initd | 23 ++++++++++++++
 2 files changed, 74 insertions(+)
 create mode 100644 testing/yggdrasil/APKBUILD
 create mode 100644 testing/yggdrasil/yggdrasil.initd

diff --git a/testing/yggdrasil/APKBUILD b/testing/yggdrasil/APKBUILD
new file mode 100644
index 0000000000..9413364823
--- /dev/null
+++ b/testing/yggdrasil/APKBUILD
@@ -0,0 +1,51 @@
+# Contributor: opal hart <[email-masked]>
+# Maintainer: opal hart <[email-masked]>
+pkgname=yggdrasil-go
+pkgver=0.3.14
+pkgrel=0
+pkgdesc="An experiment in scalable routing as an encrypted IPv6 overlay network"
+url="https://yggdrasil-network.github.io/"
+arch="x86_64"
+license="LGPL-3 MIT Apache-2.0 BSD ZLIB"
+makedepends="go"
+source="
+	https://github.com/yggdrasil-network/yggdrasil-go/archive/v$pkgver/yggdrasil-go-$pkgver.tar.gz
+	yggdrasil.initd
+"
+builddir="$srcdir/src/github.com/yggdrasil-network/yggdrasil-go"
+options="!check"
+
+export GOPATH="$srcdir"
+
+prepare() {
+	default_prepare
+	cd "$srcdir"
+	mkdir -p "$(dirname "$builddir")"
+	ln -s "$srcdir/$pkgname-$pkgver" "$builddir"
+}
+
+build() {
+	pkgsrc="github.com/yggdrasil-network/yggdrasil-go/src/version"
+	LDFLAGS="-X ${pkgsrc}.buildName=${pkgname} -X ${pkgsrc}.buildVersion=${pkgver}"
+	for cmd in yggdrasil yggdrasilctl; do
+		go build -ldflags="$LDFLAGS" "./cmd/$cmd"
+	done
+}
+
+package() {
+	install -Dm755 yggdrasil \
+		"$pkgdir"/usr/sbin/yggdrasil
+	install -Dm755 yggdrasilctl \
+		"$pkgdir"/usr/sbin/yggdrasilctl
+	install -Dm644 README.md \
+		"$pkgdir"/usr/share/doc/$pkgname/README.md
+	install -m755 -D "$srcdir"/yggdrasil.initd "$pkgdir"/etc/init.d/yggdrasil
+}
+
+cleanup_srcdir() {
+	go clean -modcache
+	default_cleanup_srcdir
+}
+
+sha512sums="3c3e92c7d49a08d2390a5d7226387c83b5575d55ae90b1209a103b50659ae60d978e39ee9247f548efe90228c3ce544b17bb205f9dcbc7f67262beaf9b7c38bf  yggdrasil-go-0.3.14.tar.gz
+f80848803109c67d27f2e381fd6dac2218bf6df338addcc648e9e2178adb5075700356a5f253c0b80db6354b6ab54f3d884ca13837b6238d00adea674ca92748  yggdrasil.initd"
diff --git a/testing/yggdrasil/yggdrasil.initd b/testing/yggdrasil/yggdrasil.initd
new file mode 100644
index 0000000000..b0ab6aad91
--- /dev/null
+++ b/testing/yggdrasil/yggdrasil.initd
@@ -0,0 +1,23 @@
+#!/sbin/openrc-run
+
+: "${YGGDRASIL_CONF=/etc/yggdrasil.conf}"
+
+description="End-to-end encrypted IPv6 networking"
+
+command="/usr/sbin/yggdrasil"
+command_args="--useconffile ${YGGDRASIL_CONF}"
+start_stop_daemon_args="--make-pidfile --pidfile /run/yggdrasil.pid --background -1 /var/log/yggdrasil.log"
+
+depend() {
+	need net
+	after firewall
+	use dns
+}
+
+start_pre() {
+	if [ ! -f "${YGGDRASIL_CONF}" ]; then
+		eerror "Cannot find '${YGGDRASIL_CONF}'."
+		eerror "Generate a sample config with `yggdrasil -genconf > /etc/yggdrasil.conf` and edit."
+		return 2
+	fi
+}
-- 
2.26.2

---

From: Leo <[email-masked]>
Date: Sun, 14 Jun 2020 13:03:10 -0300

On Sun, 14 Jun 2020 15:43:40 +0000
opal hart <[email-masked]> wrote:

>  testing/yggdrasil/APKBUILD        | 51
> +++++++++++++++++++++++++++++++ testing/yggdrasil/yggdrasil.initd |
> 23 ++++++++++++++ 2 files changed, 74 insertions(+)
> +pkgdesc="An experiment in scalable routing as an encrypted IPv6
> overlay network" +url="https://yggdrasil-network.github.io/"
> +arch="x86_64"
> https://github.com/yggdrasil-network/yggdrasil-go/archive/v$pkgver/yggdrasil-go-$pkgver.tar.gz
> +	yggdrasil.initd
> +"
> pkgsrc="github.com/yggdrasil-network/yggdrasil-go/src/version"
> +	install -m755 -D "$srcdir"/yggdrasil.initd
> "$pkgdir"/etc/init.d/yggdrasil +}
> +
> +cleanup_srcdir() {
> +	go clean -modcache
> +	default_cleanup_srcdir
> +}
> +
> +f80848803109c67d27f2e381fd6dac2218bf6df338addcc648e9e2178adb5075700356a5f253c0b80db6354b6ab54f3d884ca13837b6238d00adea674ca92748
>  yggdrasil.initd" diff --git a/testing/yggdrasil/yggdrasil.initd
> b/testing/yggdrasil/yggdrasil.initd new file mode 100644 index
> 0000000000..b0ab6aad91 --- /dev/null
> +start_stop_daemon_args="--make-pidfile --pidfile /run/yggdrasil.pid
> --background -1 /var/log/yggdrasil.log" +
> +depend() {
> +	need net
> +	after firewall
> +	use dns
> +}
> +
> +start_pre() {
> +		eerror "Generate a sample config with `yggdrasil
> -genconf > /etc/yggdrasil.conf` and edit."
> +		return 2
> +	fi
> +}

Hello

Could you submit this as an MR in our GitLab[1] ?

It allows us to test if the package builds with pipelines and is the
canonical place for testing

Regards
Leo

[1] https://gitlab.alpinelinux.org/alpine/aports