2018-08-12 02:26:38 +00:00
|
|
|
#!/usr/bin/make -f
|
2018-08-06 01:49:45 +00:00
|
|
|
# 2018 Luke Shumaker
|
2018-08-06 00:09:42 +00:00
|
|
|
|
2018-08-12 21:56:54 +00:00
|
|
|
# Runtime/user options #########################################################
|
2018-08-12 02:26:38 +00:00
|
|
|
GITREV ?= systemd/master
|
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-12 21:56:54 +00:00
|
|
|
# git ##########################################################################
|
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-12 23:11:11 +00:00
|
|
|
check: ${WORKDIR}/build-232/pkgdest
|
|
|
|
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
|
2018-08-16 06:02:25 +00:00
|
|
|
check: ${WORKDIR}/build-$(COMMIT)/integration-tests.log
|
2018-08-12 23:11:11 +00:00
|
|
|
.PHONY: check
|
|
|
|
|
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-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 ########################################################################
|
|
|
|
|
|
|
|
%/integration-tests.raw: %/build.raw %/build.log
|
|
|
|
rm -f -- '$@' '$@.tmp'
|
|
|
|
./osi-mk \
|
|
|
|
--edit='$(filter %.raw,$^)' \
|
|
|
|
--size=5G \
|
|
|
|
--package=base-devel \
|
|
|
|
--package=qemu \
|
|
|
|
--package=dhclient \
|
|
|
|
'$@.tmp'
|
|
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
%/integration-tests.log: %/integration-tests.raw
|
2018-08-16 18:39:08 +00:00
|
|
|
./osi-shell '$<' <<-'EOF' |& tee '$@.tmp'
|
2018-08-16 06:02:25 +00:00
|
|
|
set -e
|
|
|
|
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 --
|
|
|
|
mkdir /build
|
|
|
|
mount --bind /var/lib/archbuild/default/testuser/build /build
|
|
|
|
su testuser
|
|
|
|
set -e
|
|
|
|
cd /build/systemd/src/systemd
|
2018-08-16 18:39:08 +00:00
|
|
|
export BUILD_DIR=$$PWD/build
|
2018-08-16 06:02:25 +00:00
|
|
|
export KERNEL_BIN=/boot/vmlinuz-linux-libre
|
|
|
|
export INITRD=/boot/initramfs-linux-libre.img
|
|
|
|
./test/run-integration-tests.sh
|
2018-08-16 18:39:08 +00:00
|
|
|
EOF
|
2018-08-16 06:02:25 +00:00
|
|
|
mv -T -- '$@.tmp' '$@'
|
|
|
|
touch -- '$@'
|