2018-08-12 02:26:38 +00:00
|
|
|
#!/usr/bin/make -f
|
2018-08-18 18:42:42 +00:00
|
|
|
# Copyright (C) 2018 Luke Shumaker
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# Runtime/user options #########################################################
|
2018-08-17 02:07:55 +00:00
|
|
|
GITREV ?= systemd/v239.0-2.parabola7
|
2018-08-13 05:16:36 +00:00
|
|
|
WORKDIR ?= workdir
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
################################################################################
|
|
|
|
# Main #
|
|
|
|
################################################################################
|
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
# Configure Make ###############################################################
|
2018-08-12 21:56:54 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.ONESHELL:
|
2018-08-12 21:56:54 +00:00
|
|
|
SHELL = bash
|
|
|
|
.SHELLFLAGS = -veE -o pipefail -c
|
|
|
|
.SILENT:
|
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.DELETE_ON_ERROR:
|
|
|
|
.SECONDARY:
|
2018-08-12 21:56:54 +00:00
|
|
|
|
|
|
|
.DEFAULT_GOAL = check
|
2018-08-12 01:58:39 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
################################################################################
|
2018-08-12 21:56:54 +00:00
|
|
|
|
2018-08-12 02:26:38 +00:00
|
|
|
.PHONY: FORCE
|
|
|
|
|
2018-08-18 18:19:41 +00:00
|
|
|
# git and phony targets ########################################################
|
2018-08-12 02:26:38 +00:00
|
|
|
${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
|
2018-08-12 21:56:54 +00:00
|
|
|
( cd $< && git rev-parse --verify '${GITREV}' ) | sed 's/^/COMMIT=/' | ./write-ifchanged '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
-include ${WORKDIR}/.COMMIT.mk
|
|
|
|
|
2018-08-18 18:19:41 +00:00
|
|
|
build: ${WORKDIR}/build-$(COMMIT)/pkgdest
|
|
|
|
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-integration.tap
|
2018-08-18 17:31:20 +00:00
|
|
|
check: ${WORKDIR}/build-$(COMMIT)/sd-tests-unit.tap
|
2018-08-18 18:19:41 +00:00
|
|
|
.PHONY: build check
|
|
|
|
|
|
|
|
check: ${WORKDIR}/build-232/pkgdest
|
2018-08-12 23:11:11 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# osi-mk base images ###########################################################
|
2018-08-15 01:15:21 +00:00
|
|
|
${WORKDIR}/base.raw: osi-mk.d/systemd-osi-shell.sh
|
2018-08-19 22:41:56 +00:00
|
|
|
${WORKDIR}/base.raw: osi-mk.d/utf8.sh
|
2018-08-12 21:56:54 +00:00
|
|
|
${WORKDIR}/base.raw:
|
2018-08-15 19:10:40 +00:00
|
|
|
rm -f -- '$@' '$@.tmp'
|
2018-08-12 21:56:54 +00:00
|
|
|
mkdir -p -- '$(@D)'
|
2018-08-15 19:10:40 +00:00
|
|
|
./osi-mk \
|
2018-08-16 05:48:21 +00:00
|
|
|
--size=2G \
|
2018-08-15 19:10:40 +00:00
|
|
|
--package='base' \
|
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-12 21:56:54 +00:00
|
|
|
|
|
|
|
${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:
|
2018-08-13 04:35:44 +00:00
|
|
|
rm -f -- '$@' '$@.tmp'
|
2018-08-14 20:04:07 +00:00
|
|
|
./osi-mk \
|
|
|
|
--edit='$(filter %.raw,$^)' \
|
2018-08-16 05:48:21 +00:00
|
|
|
--size=3G \
|
2018-08-14 20:04:07 +00:00
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
|
|
|
'$@.tmp'
|
2018-08-15 01:15:21 +00:00
|
|
|
./osi-shell '$@.tmp' <<-'EOF'
|
|
|
|
su testuser || exit
|
|
|
|
set -e
|
2018-08-13 02:32:44 +00:00
|
|
|
libreblacklist update
|
2018-08-15 19:10:40 +00:00
|
|
|
sudo librechroot make
|
2018-08-12 21:56:54 +00:00
|
|
|
EOF
|
2018-08-13 04:35:44 +00:00
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-12 21:56:54 +00:00
|
|
|
|
|
|
|
# build systemd ################################################################
|
|
|
|
|
|
|
|
# build systemd 232
|
|
|
|
${WORKDIR}/build-232/build.raw: ${WORKDIR}/build.raw
|
2018-08-12 22:49:35 +00:00
|
|
|
${WORKDIR}/build-232/build.raw: osi-mk.d/testuser.sh
|
2018-08-12 02:26:38 +00:00
|
|
|
${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:
|
2018-08-13 04:35:44 +00:00
|
|
|
rm -f -- '$@' '$@.tmp'
|
2018-08-12 22:16:27 +00:00
|
|
|
mkdir -p -- '$(@D)'
|
2018-08-06 01:56:44 +00:00
|
|
|
./osi-mk \
|
2018-08-14 20:04:07 +00:00
|
|
|
--edit='$(filter %.raw,$^)' \
|
2018-08-16 05:48:21 +00:00
|
|
|
--size=4G \
|
2018-08-12 21:56:54 +00:00
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
2018-08-12 22:16:27 +00:00
|
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
|
|
--directory='abs/systemd-232:/home/testuser/packages/abs/systemd' \
|
2018-08-13 04:35:44 +00:00
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
${WORKDIR}/build-232/build.log: %/build.log: %/build.raw
|
2018-08-16 18:39:08 +00:00
|
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
2018-08-15 01:15:21 +00:00
|
|
|
su testuser || exit
|
|
|
|
set -e
|
2018-08-10 00:22:41 +00:00
|
|
|
cd ~/packages/abs/systemd
|
2018-08-15 19:10:40 +00:00
|
|
|
sudo librechroot sync # on rebuild the downgrade in [repo] will confuse chcleanup
|
|
|
|
sudo libremakepkg
|
2018-08-10 00:22:41 +00:00
|
|
|
EOF
|
2018-08-13 04:35:44 +00:00
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-16 05:48:43 +00:00
|
|
|
touch -- '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# build the code under test
|
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: ${WORKDIR}/build.raw
|
2018-08-12 22:49:35 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: osi-mk.d/testuser.sh
|
2018-08-12 02:26:38 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: abs/systemd $(wildcard abs/systemd/*)
|
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/systemd.git
|
2018-08-13 02:50:29 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.raw: | ${WORKDIR}/.COMMIT.mk
|
2018-08-13 04:35:44 +00:00
|
|
|
rm -f -- '$@' '$@.tmp'
|
2018-08-12 02:26:38 +00:00
|
|
|
mkdir -p -- '$(@D)'
|
2018-08-10 00:22:41 +00:00
|
|
|
./osi-mk \
|
2018-08-14 20:04:07 +00:00
|
|
|
--edit='$(filter %.raw,$^)' \
|
2018-08-16 05:48:21 +00:00
|
|
|
--size=4G \
|
2018-08-12 21:56:54 +00:00
|
|
|
$(addprefix --module=,$(filter osi-mk.d/%.sh,$^)) \
|
2018-08-12 22:16:27 +00:00
|
|
|
--directory='${WORKDIR}/systemd.git:/home/testuser/packages/srcdest/systemd' \
|
|
|
|
--directory='abs/systemd:/home/testuser/packages/abs/systemd' \
|
2018-08-13 04:35:44 +00:00
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
${WORKDIR}/build-$(COMMIT)/build.log: %/build.log: %/build.raw
|
2018-08-16 18:39:08 +00:00
|
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
2018-08-15 01:15:21 +00:00
|
|
|
su testuser || exit
|
|
|
|
set -e
|
2018-08-06 00:09:42 +00:00
|
|
|
cd ~/packages/abs/systemd
|
2018-08-12 01:56:00 +00:00
|
|
|
sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD
|
2018-08-15 19:10:40 +00:00
|
|
|
sudo libremakepkg
|
2018-08-06 00:09:42 +00:00
|
|
|
EOF
|
2018-08-13 04:35:44 +00:00
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-16 05:48:43 +00:00
|
|
|
touch -- '$@'
|
2018-08-12 02:26:38 +00:00
|
|
|
|
|
|
|
%/pkgdest: %/build.log
|
|
|
|
rm -rf -- '$@'
|
|
|
|
./osi-extract '$*/build.raw' /home/testuser/packages/pkgdest '$@'
|
2018-08-12 23:18:05 +00:00
|
|
|
test -d '$@'
|
|
|
|
touch '$@'
|
2018-08-16 06:02:25 +00:00
|
|
|
|
|
|
|
# tests ########################################################################
|
|
|
|
|
2018-08-17 17:07:27 +00:00
|
|
|
%/sd-tests.raw: %/build.raw %/build.log
|
2018-08-16 06:02:25 +00:00
|
|
|
rm -f -- '$@' '$@.tmp'
|
|
|
|
./osi-mk \
|
|
|
|
--edit='$(filter %.raw,$^)' \
|
|
|
|
--package=base-devel \
|
2018-08-17 17:07:27 +00:00
|
|
|
'$@.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 \
|
2018-08-16 06:02:25 +00:00
|
|
|
--package=qemu \
|
2018-08-16 19:58:39 +00:00
|
|
|
--package=net-tools \
|
2018-08-16 06:02:25 +00:00
|
|
|
--package=dhclient \
|
2018-08-16 19:58:39 +00:00
|
|
|
--package=strace \
|
2018-08-17 01:50:05 +00:00
|
|
|
--package=openbsd-netcat \
|
|
|
|
--package=busybox \
|
2018-08-17 17:04:18 +00:00
|
|
|
--package=plymouth \
|
2018-08-16 06:02:25 +00:00
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-17 17:07:27 +00:00
|
|
|
%/sd-tests-integration.log: %/sd-tests-integration.raw
|
2018-08-16 21:20:19 +00:00
|
|
|
./osi-shell -- '$<' -m 1024 <<-'EOF' |& tee '$@.tmp'
|
2018-08-16 06:02:25 +00:00
|
|
|
set -e
|
2018-08-16 18:40:23 +00:00
|
|
|
mkdir -p /build
|
2018-08-16 06:02:25 +00:00
|
|
|
mount --bind /var/lib/archbuild/default/testuser/build /build
|
2018-08-16 19:58:39 +00:00
|
|
|
export BUILD_DIR=/build/systemd/src/build
|
2018-08-16 06:02:25 +00:00
|
|
|
export KERNEL_BIN=/boot/vmlinuz-linux-libre
|
2018-08-17 00:23:35 +00:00
|
|
|
export INITRD=/boot/initramfs-linux-libre-fallback.img
|
2018-08-17 15:21:45 +00:00
|
|
|
sed -i /SKIP_INITRD=yes/d /build/systemd/src/systemd/test/TEST-*/test.sh # Parabola (& Debian) kernels don't support SKIP_INITRD
|
2018-08-16 19:58:39 +00:00
|
|
|
cd /build/systemd/src/systemd
|
2018-08-18 18:19:41 +00:00
|
|
|
./test/run-integration-tests.sh setup run clean </dev/null || true
|
2018-08-16 18:39:08 +00:00
|
|
|
EOF
|
2018-08-16 06:02:25 +00:00
|
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
touch -- '$@'
|
2018-08-18 18:19:41 +00:00
|
|
|
%/sd-tests-integration.tap: %/sd-tests-integration.log
|
|
|
|
./integration2tap < '$<' > '$@'
|
2018-08-17 17:07:27 +00:00
|
|
|
|
|
|
|
%/sd-tests-unit.raw: %/sd-tests.raw
|
|
|
|
rm -f -- '$@' '$@.tmp'
|
|
|
|
./osi-mk \
|
|
|
|
--edit='$(filter %.raw,$^)' \
|
|
|
|
--size=5G \
|
2018-08-17 21:18:01 +00:00
|
|
|
--package=python-pyparsing \
|
2018-08-17 17:07:27 +00:00
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
2018-08-17 21:23:27 +00:00
|
|
|
%/sd-tests-unit.log: %/sd-tests-unit.raw
|
2018-08-17 17:07:27 +00:00
|
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
|
|
|
set -e
|
|
|
|
mkdir -p /build
|
|
|
|
mount --bind /var/lib/archbuild/default/testuser/build /build
|
2018-08-17 21:23:27 +00:00
|
|
|
|
2018-08-17 17:07:27 +00:00
|
|
|
su testuser
|
|
|
|
set -e
|
|
|
|
cd /build/systemd/src/build
|
|
|
|
meson configure -Dtests=unsafe -Dslow-tests=true
|
2018-08-17 18:59:13 +00:00
|
|
|
ninja
|
2018-08-17 21:23:27 +00:00
|
|
|
exit
|
|
|
|
|
2018-08-17 18:59:13 +00:00
|
|
|
ninja -C /build/systemd/src/build test
|
2018-08-17 17:07:27 +00:00
|
|
|
EOF
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
touch -- '$@'
|
2018-08-18 17:31:20 +00:00
|
|
|
%/sd-tests-unit.testlog.txt: %/sd-tests-unit.raw %/sd-tests-unit.log
|
|
|
|
./osi-extract '$<' /var/lib/archbuild/default/testuser/build/systemd/src/build/meson-logs/testlog.txt '$@'
|
|
|
|
|
|
|
|
%.tap: %.testlog.txt
|
|
|
|
./meson2tap < '$<' > '$@'
|