Subject: How to build package and put it correctly into noarch

From: Wolf <[email-masked]>
Date: Thu, 11 Jul 2019 00:14:54 +0200

Greetings,

I'm in process of creating alpine package for few of the programs I use,
and I've hit a small road block. My package is arch=all, but it has -doc
subpackage, which is created as arch=noarch. But abuild puts them both
into x86_64 directory. Based on

https://lists.alpinelinux.org/~alpine/devel/%3CCABErt4f053VGtCzdonnt_00_hgyHqOj5m1jMEq_RodS3x2s-pQ%40mail.gmail.com%3E

my understanding is that arch=noarch packages should be in noarch
directory, so while currently my tree looks like

/alpine/
└── v3.10
    └── wolfsden
        └── x86_64
            ├── acme-client-0.2.1-r0.apk
            ├── acme-client-doc-0.2.1-r0.apk
            └── APKINDEX.tar.gz

it should look like

/alpine/
└── v3.10
    └── wolfsden
        ├── noarch
        │   └── acme-client-doc-0.2.1-r0.apk
        └── x86_64
            ├── acme-client-0.2.1-r0.apk
            └── APKINDEX.tar.gz

However, I'm not sure how to get it into such state. As said before,
abuild just puts everything into x86_64. Is there a script in alpine-sdk
or somewhere that would sort it into correct locations? Do I need to
write my up shell script or something to sort it out based on
APKINDEX.tar.gz content?

Thank you very much for any advice on how to tackle this ^_^

W.

Abuild invocation looks like:

$ sudo -u builder -- abuild -r

And here is my APKBUILD (if relevant):

# Contributor: Gray Wolf <[email-masked]>
# Maintainer: Gray Wolf <[email-masked]>
pkgname="acme-client"
pkgver="0.2.1"
pkgrel=0
pkgdesc="Port of OpenBSD's acme-client"
url="https://github.com/graywolf/acme-client-portable"
arch="all"
license="GPL-2.0-only"
depends="openssl libbsd"
makedepends="openssl-dev libbsd-dev"
install=""
subpackages="$pkgname-doc"
source="https://data.wolfsden.cz/sources/acme-client-${pkgver}.tar.xz"
builddir="$srcdir/"

build() {
	cd "$srcdir"/acme-client-"$pkgver"

	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var
	make
}

check() {
	cd "$srcdir"/acme-client-"$pkgver"

	make check
}

package() {
	cd "$srcdir"/acme-client-"$pkgver"

	make DESTDIR="$pkgdir" install
}

sha512sums="
b5786653c6f147a4ff258d08b0b66c7c9bb35120f75fbdbb760efbe9cd7217d45ae61805c578b6eb4651eb830cc9a6b85ae1025f62d6bd924118f49cb18d4b8f  acme-client-0.2.1.tar.xz
"

-- 
There are only two hard things in Computer Science:
cache invalidation, naming things and off-by-one errors.

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Wed, 10 Jul 2019 20:41:42 -0400

> Greetings,

Heya!

> abuild just puts everything into x86_64.

That is normal and expected! noarch is there for a different purpose.
Don't worry about it and carry on :)

---

From: Wolf <[email-masked]>
Date: Thu, 11 Jul 2019 08:39:21 +0200

Hello :),

> Don't worry about it and carry on :)

That's what I originally did but it did not work. Here's what I did
next:

1. rsync it to the server

	sending incremental file list
	./
	v3.10/
	v3.10/wolfsden/
	v3.10/wolfsden/x86_64/
	v3.10/wolfsden/x86_64/APKINDEX.tar.gz
		    808 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=2/7)
	v3.10/wolfsden/x86_64/acme-client-0.2.1-r0.apk
		 35,897 100%    4.89MB/s    0:00:00 (xfr#2, to-chk=1/7)
	v3.10/wolfsden/x86_64/acme-client-doc-0.2.1-r0.apk
		  5,856 100%  714.84kB/s    0:00:00 (xfr#3, to-chk=0/7)

	sent 42,651 bytes  received 470 bytes  28,747.33 bytes/sec
	total size is 42,561  speedup is 0.99

2. Add repository and public key to docker image to test it out

	/ # cat /etc/apk/repositories
	http://dl-cdn.alpinelinux.org/alpine/v3.10/main
	http://dl-cdn.alpinelinux.org/alpine/v3.10/community
	https://repo.wolfsden.cz/alpine/v3.10/wolfsden
	/ # cat /etc/apk/keys/[email-masked]
	-----BEGIN PUBLIC KEY-----
	MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzidab06xgdlSkBlj6UUP
	t2AA94dxFbSexVACiMQnnFD80f1rzlYnIr5Wf5//53w+JYzSl0CBQzmIUA4VtzK5
	N5IPVo5Wcq4BdT3H2802hI5xvYnmlW2RiXCVj+LDJwghFXmEGRjB5WgKxWZzacG8
	PJrcEhN6WwJChG9Cuck/OUXG4J6QKsP3yyoHJFbRc9UmoJDEYofRnPuIyU7TV3ZL
	oecr6G41JrRhLhQ/nKiP8S2feM/vH62lrmHTh6FiD3V+UNW26mB281TsiOErUqkx
	lH1khZvA7xOZIB++NkZcFYjy2PQXILyVqgYHsGUELSqyL6ldqOrEpTWxb1rJjmfZ
	1QIDAQAB
	-----END PUBLIC KEY-----

3. Try to install acme-client

	/ # apk update
	fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/main/x86_64/APKINDEX.tar.gz
	fetch http://dl-cdn.alpinelinux.org/alpine/v3.10/community/x86_64/APKINDEX.tar.gz
	fetch https://repo.wolfsden.cz/alpine/v3.10/wolfsden/x86_64/APKINDEX.tar.gz
	v3.10.0-43-ge7c8809914 [http://dl-cdn.alpinelinux.org/alpine/v3.10/main]
	v3.10.0-43-ge7c8809914 [http://dl-cdn.alpinelinux.org/alpine/v3.10/community]
	OK: 10330 distinct packages available
	/ # apk add acme-client
	(1/2) Installing libbsd (0.9.1-r0)
	(2/2) Installing acme-client (0.2.1-r0)
	Executing busybox-1.30.1-r2.trigger
	OK: 218 MiB in 62 packages

This works fine.

4. Try to install acme-client-doc

	/ # apk add acme-client-doc
	(1/1) Installing acme-client-doc (0.2.1-r0)
	ERROR: acme-client-doc-0.2.1-r0: package mentioned in index not found (try 'apk update')
	1 error; 218 MiB in 62 packages

This does not work since it cannot find the package.

But after I move it to noarch

	$ find /srv/http/repo.wolfsden.cz/alpine/
	/srv/http/repo.wolfsden.cz/alpine/
	/srv/http/repo.wolfsden.cz/alpine/v3.10
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden/noarch
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden/noarch/acme-client-doc-0.2.1-r0.apk
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden/x86_64
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden/x86_64/acme-client-0.2.1-r0.apk
	/srv/http/repo.wolfsden.cz/alpine/v3.10/wolfsden/x86_64/APKINDEX.tar.gz

It works

	/ # apk add acme-client-doc
	(1/1) Installing acme-client-doc (0.2.1-r0)
	OK: 218 MiB in 63 packages

So I'm not sure what am I doing wrong.

Thank

W.

---

From: Tuan Hoang <[email-masked]>
Date: Sat, 20 Jul 2019 18:48:51 +0200

Just spin up an Alpine 3.10 docker image, install acme-client-doc from
your repo just fine.

---

From: Wolf <[email-masked]>
Date: Mon, 22 Jul 2019 22:28:31 +0200

Hello,

> Just spin up an Alpine 3.10 docker image, install acme-client-doc from

In the mean time I've rebuild my repository with --rewrite-arch option.
Thank you for verifying that it works now :)

W.