diff --git a/test/conftest.py b/test/conftest.py index c7969f97..e27fb39e 100644 --- a/test/conftest.py +++ b/test/conftest.py @@ -28,10 +28,13 @@ def config_file(tmp_path_factory, request): flavour = request.param out_file = tmp_path / "pmbootstrap_v3.cfg" - workdir = tmp_path / "work" - workdir.mkdir() + workdir = tmp_path / "cache" + if not (workdir / "git").exists(): + (workdir / "git").mkdir(exist_ok=True, parents=True) + # Copy our test pmaports to the workdir + shutil.copytree(Path("./test/data/pmaports"), (workdir / "cache/git/pmaports")) - configs = {"default": f"aports = {workdir / 'cache_git' / 'pmaports'}", "no-repos": "aports = "} + configs = {"default": f"aports = {workdir / 'cache/git/pmaports'}", "no-repos": "aports = "} file = _testdir / "pmbootstrap_v3.cfg" print(f"CONFIG: {out_file}") diff --git a/test/data/pmaports/channels.cfg b/test/data/pmaports/channels.cfg new file mode 100644 index 00000000..e2b419bf --- /dev/null +++ b/test/data/pmaports/channels.cfg @@ -0,0 +1,69 @@ +# Reference: https://postmarketos.org/channels.cfg +[channels.cfg] +recommended=edge + +[edge] +description=Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge +branch_pmaports=master +branch_aports=master +mirrordir_alpine=edge + +[v24.12] +description=Latest release / Recommended for best stability +branch_pmaports=v24.12 +branch_aports=3.21-stable +mirrordir_alpine=v3.21 + +[v24.06] +description=Old release (unsupported) +branch_pmaports=v24.06 +branch_aports=3.20-stable +mirrordir_alpine=v3.20 + +[v23.12] +description=Old release (unsupported) +branch_pmaports=v23.12 +branch_aports=3.19-stable +mirrordir_alpine=v3.19 + +[v23.06] +description=Old release (unsupported) +branch_pmaports=v23.06 +branch_aports=3.18-stable +mirrordir_alpine=v3.18 + +[v22.12] +description=Old release (unsupported) +branch_pmaports=v22.12 +branch_aports=3.17-stable +mirrordir_alpine=v3.17 + +[v22.06] +description=Old release (unsupported) +branch_pmaports=v22.06 +branch_aports=3.16-stable +mirrordir_alpine=v3.16 + +[v21.12] +description=Old release (unsupported) +branch_pmaports=v21.12 +branch_aports=3.15-stable +mirrordir_alpine=v3.15 + +[v21.06] +description=Old release (unsupported) +branch_pmaports=v21.06 +branch_aports=3.14-stable +mirrordir_alpine=v3.14 + +[v21.03] +description=Old release (unsupported) +branch_pmaports=v21.03 +branch_aports=3.13-stable +mirrordir_alpine=v3.13 + +[v20.05] +description=Old release (unsupported) +branch_pmaports=v20.05 +branch_aports=3.12-stable +mirrordir_alpine=v3.12 diff --git a/test/data/pmaports/device/main/device-qemu-amd64/APKBUILD b/test/data/pmaports/device/main/device-qemu-amd64/APKBUILD new file mode 100644 index 00000000..dc4c7b52 --- /dev/null +++ b/test/data/pmaports/device/main/device-qemu-amd64/APKBUILD @@ -0,0 +1,79 @@ +# Reference: +# Maintainer: Minecrell +# Co-Maintainer: Oliver Smith +pkgname=device-qemu-amd64 +pkgver=7 +pkgrel=1 +pkgdesc="Simulated device in QEMU (x86_64)" +url="https://postmarketos.org" +arch="x86_64" +license="MIT" +depends="postmarketos-base systemd-boot" +makedepends="devicepkg-dev" +# First kernel subpackage is default in pmbootstrap init! +subpackages=" + $pkgname-kernel-lts:kernel_lts + $pkgname-kernel-virt:kernel_virt + $pkgname-kernel-none:kernel_none + $pkgname-mce + $pkgname-sway + $pkgname-x11 + " +source=" + deviceinfo + modules-initfs + mce-display-blanking.conf + resolution-qemu-X11.conf + " +options="!check !archcheck" + +build() { + devicepkg_build $startdir $pkgname +} + +package() { + devicepkg_package $startdir $pkgname +} + +mce() { + pkgdesc="Prevents screen blanking for UI's using mce (Glacier, Asteroid)" + install_if="$pkgname=$pkgver-r$pkgrel mce" + install -Dm644 "$srcdir"/mce-display-blanking.conf \ + "$subpkgdir"/etc/mce/50display-blanking.conf +} + +sway() { + install_if="$pkgname=$pkgver-r$pkgrel postmarketos-ui-sway" + depends="postmarketos-ui-sway-logo-key-alt" + mkdir "$subpkgdir" +} + +x11() { + install_if="$pkgname=$pkgver-r$pkgrel xorg-server" + install -Dm644 "$srcdir"/resolution-qemu-X11.conf \ + "$subpkgdir"/usr/share/X11/xorg.conf.d/10-resolution-qemu-X11.conf +} + +kernel_none() { + pkgdesc="No kernel (does not boot! can be used during pmbootstrap testing to save time)" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_virt() { + pkgdesc="Alpine Virt kernel (minimal, no audio/mouse/network)" + depends="linux-virt" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +kernel_lts() { + pkgdesc="Alpine LTS kernel (recommended)" + depends="linux-lts linux-firmware-none" + devicepkg_subpackage_kernel $startdir $pkgname $subpkgname +} + +sha512sums=" +74dd746b16f17ce67f6d58b6b86878b6eebaaa473fa36f475074c2c14ed738386c1b5cfcf15ad07b58f94d303799e8a9ed356143061e7854cf38170bef999a0b deviceinfo +29766094e64a7ce881c8e96433203ea538057b8fd1d577fc69b9add6bc1217af04ddf60cbcf82333811c627897eda7537b0b1f862899e1fdfd93403b3f6425d7 modules-initfs +99d32eed6c5cda59e91516e982c5bd5165ff718133e2411a0dbba04e2057d1dfad49a75e5cc67140d0e0adcbe1383671bd2892335929b782a5b19f5472e635ad mce-display-blanking.conf +bfff3ebf11abb43d8ea45e778c19554b1bc8ef9e694d8160daaac0ef906b4d8eda772e5f984033cce52ebddfbbe76e5340c6805e68f967994a3240c1e10c8b5b resolution-qemu-X11.conf +" diff --git a/test/data/pmaports/device/main/device-qemu-amd64/deviceinfo b/test/data/pmaports/device/main/device-qemu-amd64/deviceinfo new file mode 100644 index 00000000..599a586b --- /dev/null +++ b/test/data/pmaports/device/main/device-qemu-amd64/deviceinfo @@ -0,0 +1,27 @@ +# Reference: +# Please use double quotes only. You can source this file in shell scripts. + +deviceinfo_format_version="0" +deviceinfo_name="QEMU amd64" +deviceinfo_manufacturer="QEMU" +deviceinfo_codename="qemu-amd64" +deviceinfo_arch="x86_64" + +# Device related +deviceinfo_gpu_accelerated="true" +deviceinfo_chassis="vm" +deviceinfo_keyboard="true" +deviceinfo_external_storage="true" +deviceinfo_screen_width="1024" +deviceinfo_screen_height="768" +deviceinfo_getty="ttyS0;115200" +deviceinfo_dev_internal_storage="/dev/vdb" +deviceinfo_dev_internal_storage_repartition="true" + +# Bootloader related +deviceinfo_flash_method="none" +deviceinfo_kernel_cmdline="console=tty1 console=ttyS0 PMOS_FORCE_PARTITION_RESIZE" +deviceinfo_disable_dhcpd="true" +deviceinfo_partition_type="gpt" +deviceinfo_boot_filesystem="fat32" +deviceinfo_generate_systemd_boot="true" diff --git a/test/data/pmaports/device/main/device-qemu-amd64/mce-display-blanking.conf b/test/data/pmaports/device/main/device-qemu-amd64/mce-display-blanking.conf new file mode 100644 index 00000000..fdc68549 --- /dev/null +++ b/test/data/pmaports/device/main/device-qemu-amd64/mce-display-blanking.conf @@ -0,0 +1 @@ +/system/osso/dsm/display/display_never_blank=1 diff --git a/test/data/pmaports/device/main/device-qemu-amd64/modules-initfs b/test/data/pmaports/device/main/device-qemu-amd64/modules-initfs new file mode 100644 index 00000000..aaa7396d --- /dev/null +++ b/test/data/pmaports/device/main/device-qemu-amd64/modules-initfs @@ -0,0 +1,6 @@ +virtio_pci +virtio_blk +virtio-gpu +virtio_input +evdev +vfat diff --git a/test/data/pmaports/device/main/device-qemu-amd64/resolution-qemu-X11.conf b/test/data/pmaports/device/main/device-qemu-amd64/resolution-qemu-X11.conf new file mode 100644 index 00000000..20d74c4a --- /dev/null +++ b/test/data/pmaports/device/main/device-qemu-amd64/resolution-qemu-X11.conf @@ -0,0 +1,6 @@ +Section "Screen" + Identifier "Virtual-1" + SubSection "Display" + Modes "800x600" + EndSubSection +EndSection diff --git a/test/data/pmaports/extra-repos/systemd/dbus/APKBUILD b/test/data/pmaports/extra-repos/systemd/dbus/APKBUILD new file mode 100644 index 00000000..61c9fa54 --- /dev/null +++ b/test/data/pmaports/extra-repos/systemd/dbus/APKBUILD @@ -0,0 +1,23 @@ +pkgname=dbus +pkgver=3.1 +pkgrel=0 +pkgdesc="FAKE dbus package (SYSTEMD override)" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname systemd repo" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/main/dbus/APKBUILD b/test/data/pmaports/main/dbus/APKBUILD new file mode 100644 index 00000000..af02f649 --- /dev/null +++ b/test/data/pmaports/main/dbus/APKBUILD @@ -0,0 +1,23 @@ +pkgname=dbus +pkgver=3.1 +pkgrel=0 +pkgdesc="FAKE dbus package" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/main/linus-lts/APKBUILD b/test/data/pmaports/main/linus-lts/APKBUILD new file mode 100644 index 00000000..e52d2384 --- /dev/null +++ b/test/data/pmaports/main/linus-lts/APKBUILD @@ -0,0 +1,23 @@ +pkgname=linux-lts +pkgver=6.12.4 +pkgrel=0 +pkgdesc="FAKE linux-lts package" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/main/linus-virt/APKBUILD b/test/data/pmaports/main/linus-virt/APKBUILD new file mode 100644 index 00000000..a5d3b420 --- /dev/null +++ b/test/data/pmaports/main/linus-virt/APKBUILD @@ -0,0 +1,23 @@ +pkgname=linux-virt +pkgver=6.12.4 +pkgrel=0 +pkgdesc="FAKE linux-virt package" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/main/postmarketos-base/APKBUILD b/test/data/pmaports/main/postmarketos-base/APKBUILD new file mode 100644 index 00000000..f1e36159 --- /dev/null +++ b/test/data/pmaports/main/postmarketos-base/APKBUILD @@ -0,0 +1,23 @@ +pkgname=postmarketos-base +pkgver=44 +pkgrel=3 +pkgdesc="FAKE postmarketos-base package" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/main/systemd-boot/APKBUILD b/test/data/pmaports/main/systemd-boot/APKBUILD new file mode 100644 index 00000000..b1d5572c --- /dev/null +++ b/test/data/pmaports/main/systemd-boot/APKBUILD @@ -0,0 +1,23 @@ +pkgname=systemd-boot +pkgver=257.3 +pkgrel=0 +pkgdesc="FAKE systemd-boot package" +url="https://postmarketos.org" +arch="noarch" +license="GPL-3.0-or-later" +makedepends="" +# Several of these dependencies come from alpine - base, as the upstream +# recommendation to not depend on openrc has been to copy them here: +# https: // gitlab.alpinelinux.org/alpine/aports/-/merge_requests/71686#note_435428 +depends=" + " + +prepare() { + default_prepare +} + +package() { + echo "$pkgname" > $pkgdir/fake-$pkgname +} + +sha512sums="" diff --git a/test/data/pmaports/pmaports.cfg b/test/data/pmaports/pmaports.cfg new file mode 100644 index 00000000..f55b3af4 --- /dev/null +++ b/test/data/pmaports/pmaports.cfg @@ -0,0 +1,25 @@ +# Reference: https://postmarketos.org/pmaports.cfg +[pmaports] +version=7 +pmbootstrap_min_version=2.3.3 +channel=edge +supported_root_filesystems=btrfs,ext4,f2fs +supported_firewall=nftables +supported_base_nofde=True +supported_install_boot_label=pmOS_i_boot +supported_mkinitfs_without_flavors=True +supported_arches=x86_64,x86,aarch64,armv7,armhf +supported_fastboot_depends=android-tools +supported_heimdall_depends=heimdall,android-tools + +[repo:systemd] +pmaports_dir=systemd +# Build forks of Alpine packages that support usr_merge +bootstrap_1=abuild +bootstrap_2=systemd +# Build systemd related pkgs without deps on each other +bootstrap_3=dbus linux-pam-pmos +# Build systemd related pkgs *with* deps on each other +bootstrap_4=systemd dbus linux-pam-pmos +# Marker that bootstrap is done, only needs to be built once +bootstrap_5=postmarketos-base-systemd