pmb.aportgen: put dependencies on separate lines (MR 2024)

Generate APKBUILDs with dependencies sorted and placed one per line.
The dependency lists changed are
 - depends in pmb/aportgen/device.py
 - makedepends in pmb/aportgen/linux.py

Sort dependency lists in test/test_aportgen_device_wizard.py
assertions.
This commit is contained in:
nybbled 2021-02-08 22:57:24 +02:00 committed by Oliver Smith
parent df58d35e27
commit 5f485b8ad3
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
3 changed files with 33 additions and 19 deletions

View file

@ -10,7 +10,8 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
device = "-".join(pkgname.split("-")[1:])
carch = pmb.parse.arch.alpine_to_kernel(deviceinfo["arch"])
makedepends = "bash bc bison devicepkg-dev flex openssl-dev perl"
makedepends = ["bash", "bc", "bison", "devicepkg-dev", "flex", "openssl-dev",
"perl"]
build = """
unset LDFLAGS
@ -27,19 +28,19 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
soc_vendor = pmb.helpers.cli.ask(args, "SoC vendor", vendors,
vendors[-1], complete=vendors)
if soc_vendor == "spreadtrum":
makedepends += " dtbtool-sprd"
makedepends.append("dtbtool-sprd")
build += """
dtbTool-sprd -p scripts/dtc/ \\
-o "$_outdir/arch/$_carch/boot"/dt.img \\
"$_outdir/arch/$_carch/boot/dts/\""""
elif soc_vendor == "exynos":
codename = "-".join(pkgname.split("-")[2:])
makedepends += " dtbtool-exynos"
makedepends.append("dtbtool-exynos")
build += f"""
dtbTool-exynos -o "$_outdir/arch/$_carch/boot"/dt.img \\
$(find "$_outdir/arch/$_carch/boot/dts/" -name *{codename}*.dtb)"""
else:
makedepends += " dtbtool"
makedepends.append("dtbtool")
build += """
dtbTool -p scripts/dtc/ -o "$_outdir/arch/$_carch/boot"/dt.img \\
"$_outdir/arch/$_carch/boot/\""""
@ -47,6 +48,8 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
install -Dm644 "$_outdir/arch/$_carch/boot"/dt.img \\
"$pkgdir"/boot/dt.img"""
makedepends.sort()
makedepends = ("\n" + " " * 12).join(makedepends)
patches = ("\n" + " " * 12).join(patches)
content = f"""\
# Reference: <https://postmarketos.org/vendorkernel>
@ -62,7 +65,9 @@ def generate_apkbuild(args, pkgname, deviceinfo, patches):
url="https://kernel.org"
license="GPL-2.0-only"
options="!strip !check !tracedeps pmb:cross-native"
makedepends="{makedepends}"
makedepends="
{makedepends}
"
# Source
_repository="(CHANGEME!)"