213 lines
6.3 KiB
Makefile
Executable File
213 lines
6.3 KiB
Makefile
Executable File
#!/usr/bin/make -f
|
|
# 2018 Luke Shumaker
|
|
|
|
# Runtime/user options #########################################################
|
|
GITREV ?= systemd/v239.0-2.parabola7
|
|
WORKDIR ?= workdir
|
|
|
|
################################################################################
|
|
# Main #
|
|
################################################################################
|
|
|
|
# Configure Make ###############################################################
|
|
|
|
.ONESHELL:
|
|
SHELL = bash
|
|
.SHELLFLAGS = -veE -o pipefail -c
|
|
.SILENT:
|
|
|
|
.DELETE_ON_ERROR:
|
|
.SECONDARY:
|
|
|
|
.DEFAULT_GOAL = check
|
|
|
|
################################################################################
|
|
|
|
.PHONY: FORCE
|
|
|
|
# git ##########################################################################
|
|
${WORKDIR}/systemd.git: FORCE
|
|
mkdir -p -- '$(@D)'
|
|
gitget bare https://git.parabola.nu/~lukeshu/systemd.git '$@'
|
|
test -d '$@'
|
|
touch '$@'
|
|
|
|
${WORKDIR}/.COMMIT.mk: ${WORKDIR}/systemd.git
|
|
( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@'
|
|
-include ${WORKDIR}/.COMMIT.mk
|
|
|
|
check: ${WORKDIR}/build-232/pkgdest
|
|
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
|
|
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.log
|
|
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.log
|
|
.PHONY: check
|
|
|
|
# osi-mk base images ###########################################################
|
|
${WORKDIR}/base.raw: osi-mk.d/systemd-osi-shell.sh
|
|
${WORKDIR}/base.raw:
|
|
rm -f -- '$@' '$@.tmp'
|
|
mkdir -p -- '$(@D)'
|
|
./osi-mk \
|
|
--size=2G \
|
|
--package='base' \
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
'$@.tmp'
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
${WORKDIR}/build.raw: ${WORKDIR}/base.raw
|
|
${WORKDIR}/build.raw: osi-mk.d/libretools.sh
|
|
${WORKDIR}/build.raw: osi-mk.d/builddeps.sh
|
|
${WORKDIR}/build.raw: osi-mk.d/systemd-dhcpcd.sh
|
|
${WORKDIR}/build.raw:
|
|
rm -f -- '$@' '$@.tmp'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--size=3G \
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
'$@.tmp'
|
|
./osi-shell '$@.tmp' <<-'EOF'
|
|
su testuser || exit
|
|
set -e
|
|
libreblacklist update
|
|
sudo librechroot make
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
# build systemd ################################################################
|
|
|
|
# build systemd 232
|
|
${WORKDIR}/build-232/build.raw: ${WORKDIR}/build.raw
|
|
${WORKDIR}/build-232/build.raw: osi-mk.d/testuser.sh
|
|
${WORKDIR}/build-232/build.raw: abs/systemd-232 $(wildcard abs/systemd-232/*)
|
|
${WORKDIR}/build-232/build.raw: | ${WORKDIR}/systemd.git
|
|
${WORKDIR}/build-232/build.raw:
|
|
rm -f -- '$@' '$@.tmp'
|
|
mkdir -p -- '$(@D)'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--size=4G \
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
--directory='abs/systemd-232:/home/testuser/packages/abs/systemd' \
|
|
'$@.tmp'
|
|
mv -T -- '$@.tmp' '$@'
|
|
${WORKDIR}/build-232/build.log: %/build.log: %/build.raw
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
|
su testuser || exit
|
|
set -e
|
|
cd ~/packages/abs/systemd
|
|
sudo librechroot sync # on rebuild the downgrade in [repo] will confuse chcleanup
|
|
sudo libremakepkg
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
touch -- '$@'
|
|
|
|
# build the code under test
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/build.raw
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: osi-mk.d/testuser.sh
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: abs/systemd $(wildcard abs/systemd/*)
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/systemd.git
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/.COMMIT.mk
|
|
rm -f -- '$@' '$@.tmp'
|
|
mkdir -p -- '$(@D)'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--size=4G \
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
--directory='abs/systemd:/home/testuser/packages/abs/systemd' \
|
|
'$@.tmp'
|
|
mv -T -- '$@.tmp' '$@'
|
|
${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
|
su testuser || exit
|
|
set -e
|
|
cd ~/packages/abs/systemd
|
|
sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD
|
|
sudo libremakepkg
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
touch -- '$@'
|
|
|
|
%/pkgdest: %/build.log
|
|
rm -rf -- '$@'
|
|
./osi-extract '$*/build.raw' /home/testuser/packages/pkgdest '$@'
|
|
test -d '$@'
|
|
touch '$@'
|
|
|
|
# tests ########################################################################
|
|
|
|
%/sd-tests.raw: %/build.raw %/build.log
|
|
rm -f -- '$@' '$@.tmp'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--package=base-devel \
|
|
'$@.tmp'
|
|
./osi-shell '$@.tmp' <<-'EOF'
|
|
bsdtar xfO /home/testuser/packages/srcpkgdest/systemd-*.src.tar.gz systemd/.SRCINFO |
|
|
sed -nE -e 's/^\s+(|make|check)depends(|_\S*) = //p' -e '/^\s*pkgname/q' |
|
|
xargs pacman -S --needed --noconfirm --
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
%/sd-tests-integration.raw: %/sd-tests.raw
|
|
rm -f -- '$@' '$@.tmp'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--size=10G \
|
|
--package=qemu \
|
|
--package=net-tools \
|
|
--package=dhclient \
|
|
--package=strace \
|
|
--package=openbsd-netcat \
|
|
--package=busybox \
|
|
--package=plymouth \
|
|
'$@.tmp'
|
|
mv -T -- '$@.tmp' '$@'
|
|
%/sd-tests-integration.log: %/sd-tests-integration.raw
|
|
./osi-shell -- '$<' -m 1024 <<-'EOF' |& tee '$@.tmp'
|
|
set -e
|
|
mkdir -p /build
|
|
mount --bind /var/lib/archbuild/default/testuser/build /build
|
|
export BUILD_DIR=/build/systemd/src/build
|
|
export KERNEL_BIN=/boot/vmlinuz-linux-libre
|
|
export INITRD=/boot/initramfs-linux-libre-fallback.img
|
|
sed -i /SKIP_INITRD=yes/d /build/systemd/src/systemd/test/TEST-*/test.sh # Parabola (& Debian) kernels don't support SKIP_INITRD
|
|
cd /build/systemd/src/systemd
|
|
./test/run-integration-tests.sh setup run clean </dev/null
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
touch -- '$@'
|
|
|
|
%/sd-tests-unit.raw: %/sd-tests.raw
|
|
rm -f -- '$@' '$@.tmp'
|
|
./osi-mk \
|
|
--edit='$(filter %.raw,$^)' \
|
|
--size=5G \
|
|
--package=python-pyparsing \
|
|
'$@.tmp'
|
|
./osi-shell '$<' <<-'EOF'
|
|
set -e
|
|
echo en_US.UTF-8 UTF-8 >/etc/locale.gen
|
|
echo LANG=en_US.UTF-8 >/etc/locale.conf
|
|
locale-gen
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
%/sd-tests-unit.log: %/sd-tests-unit.raw
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
|
set -e
|
|
mkdir -p /build
|
|
mount --bind /var/lib/archbuild/default/testuser/build /build
|
|
|
|
su testuser
|
|
set -e
|
|
cd /build/systemd/src/build
|
|
meson configure -Dtests=unsafe -Dslow-tests=true
|
|
ninja
|
|
exit
|
|
|
|
ninja -C /build/systemd/src/build test
|
|
EOF
|
|
mv -T -- '$@.tmp' '$@'
|
|
touch -- '$@'
|