blob: 4ae8e87ceb6773e48e996b7a96f08203a288f9db (
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
|
#!/bin/sh
# vim: ft=sh
set -e
. common
if [ -n "$CLEAN" ]; then
echo_stage "Remove root"
flock --exclusive "$WORKSPACE/root.lock" uroot rm -rf "$WORKSPACE/root"
exit 0
fi
cat >abuild-system.conf <<EOF
export CFLAGS="-Os -fomit-frame-pointer"
export CXXFLAGS="\$CFLAGS"
export CPPFLAGS="\$CFLAGS"
export LDFLAGS="-Wl,--as-needed"
export JOBS=4
export MAKEFLAGS=-j\$JOBS
USE_COLORS=1
SRCDEST=/var/cache/distfiles
REPODEST=\$HOME/packages/
CLEANUP="srcdir bldroot pkgdir deps"
ERROR_CLEANUP="bldroot deps"
EOF
export ROOT="$WORKSPACE/root"
# TODO get latest uri from latest-releases.yml file
flock --exclusive "$WORKSPACE/root.lock" /bin/sh -se <<EOF
. utils
if [ ! -d "$ROOT" ]; then
echo_stage "Setting up new root"
wget "http://dl-cdn.alpinelinux.org/alpine/edge/releases/x86_64/alpine-minirootfs-3.8.0-x86_64.tar.gz" -O alpine.tar.gz
gunzip alpine.tar.gz
tar -f alpine.tar --delete ./dev/null
mkdir "$ROOT"
uroot tar -xf alpine.tar -C "$ROOT"
chmod 755 "$ROOT" # This is intentional, tar changes access rights
uchroot "$ROOT" root /bin/sh -sxe <<EEOF
apk update
apk add alpine-sdk lua-aports
adduser -s /bin/sh -D build
addgroup build abuild
mkdir -p /var/cache/distfiles
chgrp abuild /var/cache/distfiles
chmod g+w /var/cache/distfiles
EEOF
uchroot "$ROOT" build:build /bin/sh -sxe <<EEOF
cd && mkdir .abuild
echo 'PACKAGER_PRIVKEY="/home/build/.abuild/key.rsa"' > .abuild/abuild.conf
EEOF
uroot cp ~/alpinelinux.rsa.key "$ROOT/home/build/.abuild/key.rsa"
uroot cp abuild-system.conf "$ROOT/etc/abuild.conf"
fi
echo_stage "Update system"
uchroot "$ROOT" root /bin/sh -ce 'apk update && apk upgrade'
echo_stage "Update package sources"
git_clone "git@cynerd.cz:alpine-personal-pkgs" "aports"
uroot rm -rf "$ROOT/home/build/aports"
uroot mv aports "$ROOT/home/build/aports"
uchroot "$ROOT" root chown -R build:build /home/build/aports
echo_stage "Build packages"
# TODO generate list of repositories automatically
uchroot "$ROOT" build:build buildrepo --purge personal hacked
EOF
|