blob: d7431704aceab675d5d2c317046ab1e2395e926a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
# Maintainer: Achilleas Koutsou <achilleas@koutsou.net>
pkgname=osbuild-composer
pkgdesc='An HTTP service for building bootable OS images'
pkgver=125
pkgrel=1
url="https://www.osbuild.org"
arch=(x86_64)
license=(Apache)
depends=('dnf' 'qemu' 'osbuild' 'systemd' 'btrfs-progs')
makedepends=('go' 'systemd')
checkdepends=('go')
optdepends=()
source=($pkgname-$pkgver.tar.gz::https://github.com/osbuild/osbuild-composer/archive/refs/tags/v${pkgver}.tar.gz)
sha256sums=('4277ad4a5a2508e6aacf5e904900cb2875c38fe55cbc076a6c2910b07f18775d')
prepare() {
cd $pkgname-$pkgver
mkdir -p build
# Arch doesn't use /usr/libexec: edit service files
sed -i 's,/usr/libexec,/usr/lib,g' distribution/osbuild-*.service
# configure path to depsolver
cat > osbuild-composer.toml << EOF
dnf-json = "/usr/lib/osbuild/osbuild-depsolve-dnf"
EOF
}
build() {
cd $pkgname-$pkgver
export LDFLAGS="-ldflags=-X=github.com/osbuild/osbuild-composer/internal/common.RpmVersion=${pkgname}-${pkgver}-${pkgrel}.${arch}"
export GOFLAGS="-buildmode=pie -trimpath -mod=vendor -modcacherw ${LDFLAGS}"
go build -o build/osbuild-composer ./cmd/osbuild-composer
go build -o build/osbuild-worker ./cmd/osbuild-worker
}
package() {
cd $pkgname-$pkgver
# binaries
install -Dm755 "build/osbuild-composer" "${pkgdir}/usr/lib/osbuild-composer/osbuild-composer"
install -Dm755 "build/osbuild-worker" "${pkgdir}/usr/lib/osbuild-composer/osbuild-worker"
# sysusers
install -Dm644 distribution/osbuild-composer.conf "${pkgdir}/usr/lib/sysusers.d/osbuild-composer.conf"
# systemd units
mkdir -p "${pkgdir}/usr/lib/systemd/system"
install -Dm644 distribution/*.service "${pkgdir}/usr/lib/systemd/system/"
install -Dm644 distribution/*.socket "${pkgdir}/usr/lib/systemd/system/"
# repositories
mkdir -p "${pkgdir}/usr/share/osbuild-composer/repositories"
install -Dm644 repositories/*.json "${pkgdir}/usr/share/osbuild-composer/repositories"
# config file
mkdir -p "${pkgdir}/etc/osbuild-composer/"
install -Dm 644 osbuild-composer.toml "${pkgdir}/etc/osbuild-composer/osbuild-composer.toml"
# license
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
check() {
cd $pkgname-$pkgver
# Some depsolve tests require an initialised rpmdb (at the default location
# /var/lib/rpm) but we need root to initialise it.
# Skip depsolve tests that require it if it's not found.
skips=""
if ! rpm -qa &> /dev/null; then
skips="TestErrorRepoInfo|TestDepsolver"
fi
export LDFLAGS="" # clear ldflags for test
export GOFLAGS="-buildmode=pie -trimpath -mod=vendor -modcacherw ${LDFLAGS}"
go test -skip "${skips}" ./...
if [[ ! -z "${skips}" ]]; then
echo "WARNING: Some tests were skipped because they require an initialised rpmdb"
fi
}
|