osi-tools/runtests

130 lines
4.0 KiB
Plaintext
Raw Normal View History

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 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
check: ${WORKDIR}/build-232/pkgdest
check: ${WORKDIR}/build-$(COMMIT)/pkgdest
.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:
rm -f -- '$@' '$@.tmp'
2018-08-12 21:56:54 +00:00
mkdir -p -- '$(@D)'
./osi-mk \
--size=4G \
--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'
./osi-mk \
--edit='$(filter %.raw,$^)' \
$(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
libreblacklist update
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 \
--edit='$(filter %.raw,$^)' \
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-15 01:15:21 +00:00
./osi-shell '$<' <<-EOF |& tee '$@.tmp'
su testuser || exit
set -e
2018-08-10 00:22:41 +00:00
cd ~/packages/abs/systemd
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-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
${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 \
--edit='$(filter %.raw,$^)' \
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-15 01:15:21 +00:00
./osi-shell '$<' <<-EOF |& tee '$@.tmp'
su testuser || exit
set -e
2018-08-06 00:09:42 +00:00
cd ~/packages/abs/systemd
sed 's:@COMMIT@:${COMMIT}:' < PKGBUILD.in > PKGBUILD
sudo libremakepkg
2018-08-06 00:09:42 +00:00
EOF
2018-08-13 04:35:44 +00:00
mv -T -- '$@.tmp' '$@'
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 '$@'