build: minor build system improvement.

This commit is contained in:
Alexandre Pujol 2025-08-12 18:51:39 +02:00
parent 5c8c5029e0
commit d8875ab826
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC

View file

@ -5,7 +5,7 @@
# Usage: `just` # Usage: `just`
# See https://apparmor.pujol.io/development/ for more information. # See https://apparmor.pujol.io/development/ for more information.
# Build setings # Build settings
destdir := "/" destdir := "/"
build := ".build" build := ".build"
pkgdest := `pwd` / ".pkg" pkgdest := `pwd` / ".pkg"
@ -251,7 +251,7 @@ create dist flavor:
--memorybacking source.type=memfd,access.mode=shared \ --memorybacking source.type=memfd,access.mode=shared \
--disk path={{vm}}/{{prefix}}{{dist}}-{{flavor}}.qcow2,format=qcow2,bus=virtio \ --disk path={{vm}}/{{prefix}}{{dist}}-{{flavor}}.qcow2,format=qcow2,bus=virtio \
--filesystem "`pwd`,0a31bc478ef8e2461a4b1cc10a24cc4",accessmode=passthrough,driver.type=virtiofs \ --filesystem "`pwd`,0a31bc478ef8e2461a4b1cc10a24cc4",accessmode=passthrough,driver.type=virtiofs \
--os-variant "`just get_osinfo {{dist}}`" \ --os-variant "`just _get_osinfo {{dist}}`" \
--graphics spice \ --graphics spice \
--audio id=1,type=spice \ --audio id=1,type=spice \
--sound model=ich9 \ --sound model=ich9 \
@ -282,18 +282,18 @@ destroy dist flavor:
[group('vm')] [group('vm')]
[doc('Connect to the machine')] [doc('Connect to the machine')]
ssh dist flavor: ssh dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` @ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}`
[group('vm')] [group('vm')]
[doc('Mount the shared directory on the machine')] [doc('Mount the shared directory on the machine')]
mount dist flavor: mount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ @ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}` \
sh -c 'mount | grep 0a31bc478ef8e2461a4b1cc10a24cc4 || sudo mount 0a31bc478ef8e2461a4b1cc10a24cc4' sh -c 'mount | grep 0a31bc478ef8e2461a4b1cc10a24cc4 || sudo mount 0a31bc478ef8e2461a4b1cc10a24cc4'
[group('vm')] [group('vm')]
[doc('Unmout the shared directory on the machine')] [doc('Unmout the shared directory on the machine')]
umount dist flavor: umount dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ @ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}` \
sh -c 'true; sudo umount /home/{{username}}/Projects/apparmor.d || true' sh -c 'true; sudo umount /home/{{username}}/Projects/apparmor.d || true'
[group('vm')] [group('vm')]
@ -307,6 +307,7 @@ list:
images: images:
#!/usr/bin/env bash #!/usr/bin/env bash
set -eu -o pipefail set -eu -o pipefail
mkdir -p {{base_dir}}
ls -lh {{base_dir}} | awk ' ls -lh {{base_dir}} | awk '
BEGIN { BEGIN {
printf("{{BOLD}}%-18s %-10s %-5s %s{{NORMAL}}\n", "Distribution", "Flavor", "Size", "Date") printf("{{BOLD}}%-18s %-10s %-5s %s{{NORMAL}}\n", "Distribution", "Flavor", "Size", "Date")
@ -343,19 +344,19 @@ init:
[group('tests')] [group('tests')]
[doc('Run the integration tests')] [doc('Run the integration tests')]
integration: integration name="":
bats --recursive --timing --print-output-on-failure tests/integration bats --recursive --timing --print-output-on-failure tests/integration/{{name}}
[group('tests')] [group('tests')]
[doc('Install dependencies for the integration tests (machine)')] [doc('Install dependencies for the integration tests (machine)')]
tests-init dist flavor: tests-init dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ @ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}` \
just --justfile /home/{{username}}/Projects/apparmor.d/Justfile init just --justfile /home/{{username}}/Projects/apparmor.d/Justfile init
[group('tests')] [group('tests')]
[doc('Synchronize the integration tests (machine)')] [doc('Synchronize the integration tests (machine)')]
tests-sync dist flavor: tests-sync dist flavor:
@ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ @ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}` \
rsync -a --delete /home/{{username}}/Projects/apparmor.d/tests/ /home/{{username}}/Projects/tests/ rsync -a --delete /home/{{username}}/Projects/apparmor.d/tests/ /home/{{username}}/Projects/tests/
[group('tests')] [group('tests')]
@ -367,18 +368,16 @@ tests-resync dist flavor: (mount dist flavor) \
[group('tests')] [group('tests')]
[doc('Run the integration tests (machine)')] [doc('Run the integration tests (machine)')]
tests-run dist flavor name="": (tests-resync dist flavor) tests-run dist flavor name="": (tests-resync dist flavor)
ssh {{sshopt}} {{username}}@`just get_ip {{dist}} {{flavor}}` \ ssh {{sshopt}} {{username}}@`just _get_ip {{dist}} {{flavor}}` \
bats --recursive --pretty --timing --print-output-on-failure \ bats --recursive --pretty --timing --print-output-on-failure \
/home/{{username}}/Projects/tests/integration/{{name}} /home/{{username}}/Projects/tests/integration/{{name}}
[private] _get_ip dist flavor:
get_ip dist flavor:
@virsh --quiet --readonly {{c}} domifaddr {{prefix}}{{dist}}-{{flavor}} | \ @virsh --quiet --readonly {{c}} domifaddr {{prefix}}{{dist}}-{{flavor}} | \
head -1 | \ head -1 | \
grep -E -o '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}' grep -E -o '([[:digit:]]{1,3}\.){3}[[:digit:]]{1,3}'
[private] _get_osinfo dist:
get_osinfo dist:
#!/usr/bin/env python3 #!/usr/bin/env python3
osinfo = { osinfo = {
"archlinux": "archlinux", "archlinux": "archlinux",