pmb/export/symlinks: add support for a single 'flavor' (MR 2093)

This commit is contained in:
Clayton Craft 2021-08-29 12:36:27 -07:00
parent 91bb682755
commit 453ce35b8c
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -7,6 +7,7 @@ import glob
import pmb.build import pmb.build
import pmb.chroot.apk import pmb.chroot.apk
import pmb.config import pmb.config
import pmb.config.pmaports
import pmb.flasher import pmb.flasher
import pmb.helpers.file import pmb.helpers.file
@ -16,35 +17,43 @@ def symlinks(args, flavor, folder):
Create convenience symlinks to the rootfs and boot files. Create convenience symlinks to the rootfs and boot files.
""" """
# Backwards compatibility with old mkinitfs (pma#660)
suffix = f"-{flavor}"
pmaports_cfg = pmb.config.pmaports.read_config(args)
if pmaports_cfg.get("supported_mkinitfs_without_flavors", False):
suffix = ""
# File descriptions # File descriptions
info = { info = {
"boot.img-" + flavor: "Fastboot compatible boot.img file," f"boot.img{suffix}": ("Fastboot compatible boot.img file,"
" contains initramfs and kernel", " contains initramfs and kernel"),
"dtbo.img": "Fastboot compatible dtbo image", "dtbo.img": "Fastboot compatible dtbo image",
"initramfs-" + flavor: "Initramfs", f"initramfs{suffix}": "Initramfs",
"initramfs-" + flavor + "-extra": "Extra initramfs files in /boot", f"initramfs{suffix}-extra": "Extra initramfs files in /boot",
"uInitrd-" + flavor: "Initramfs, legacy u-boot image format", f"uInitrd{suffix}": "Initramfs, legacy u-boot image format",
"uImage-" + flavor: "Kernel, legacy u-boot image format", f"uImage{suffix}": "Kernel, legacy u-boot image format",
"vmlinuz-" + flavor: "Linux kernel", f"vmlinuz{suffix}": "Linux kernel",
args.device + ".img": "Rootfs with partitions for /boot and /", f"{args.device}.img": "Rootfs with partitions for /boot and /",
args.device + "-boot.img": "Boot partition image", f"{args.device}-boot.img": "Boot partition image",
args.device + "-root.img": "Root partition image", f"{args.device}-root.img": "Root partition image",
"pmos-" + args.device + ".zip": "Android recovery flashable zip", f"pmos-{args.device}.zip": "Android recovery flashable zip",
} }
# Generate a list of patterns # Generate a list of patterns
path_native = args.work + "/chroot_native" path_native = args.work + "/chroot_native"
path_boot = args.work + "/chroot_rootfs_" + args.device + "/boot" path_boot = args.work + "/chroot_rootfs_" + args.device + "/boot"
path_buildroot = args.work + "/chroot_buildroot_" + args.deviceinfo["arch"] path_buildroot = args.work + "/chroot_buildroot_" + args.deviceinfo["arch"]
patterns = [path_boot + "/*-" + flavor, patterns = [f"{path_boot}/boot.img{suffix}",
path_boot + "/*-" + flavor + "-extra", f"{path_boot}/initramfs{suffix}*",
path_boot + "/dtbo.img", f"{path_boot}/uInitrd{suffix}",
path_native + "/home/pmos/rootfs/" + args.device + ".img", f"{path_boot}/uImage{suffix}",
path_native + "/home/pmos/rootfs/" + args.device + "-boot.img", f"{path_boot}/vmlinuz{suffix}",
path_native + "/home/pmos/rootfs/" + args.device + "-root.img", f"{path_boot}/dtbo.img",
path_buildroot + f"{path_native}/home/pmos/rootfs/{args.device}.img",
"/var/lib/postmarketos-android-recovery-installer/pmos-" + f"{path_native}/home/pmos/rootfs/{args.device}-boot.img",
args.device + ".zip"] f"{path_native}/home/pmos/rootfs/{args.device}-root.img",
f"{path_buildroot}/var/lib/postmarketos-android-recovery-" +
f"installer/pmos-{args.device}.zip"]
# Generate a list of files from the patterns # Generate a list of files from the patterns
files = [] files = []