pmb/parse/_apkbuild: Fix locating kernel subpackages with "-" in name (!1857)
When defining a new kernel subpackage with a "-" in it (e.g. $pkgname-kernel-mainline-modem), then pmbootstrap is unable to find the function that builds the subpackage: ERROR: Could not find subpackage function, no line starts with 'kernel_mainline-modem() {' This is because it assumes that a $pkgname-kernel-<name> subpackage is built by a kernel_<name> function, but this does not have to be the case. We should really respect the name of the subpackage function that is specified when defining the subpackage, but unfortunately it is stripped away in cut_off_function_names(). For now let's fix this by replacing "-" with "_", but ideally the APKBUILD parser API should be refactored to expose the subpackage function in the future.
This commit is contained in:
parent
2320e0100c
commit
7907e91879
|
@ -363,7 +363,9 @@ def kernels(args, device):
|
||||||
if not subpackage.startswith(subpackage_prefix):
|
if not subpackage.startswith(subpackage_prefix):
|
||||||
continue
|
continue
|
||||||
name = subpackage[len(subpackage_prefix):]
|
name = subpackage[len(subpackage_prefix):]
|
||||||
func = "kernel_" + name
|
# FIXME: We should use the specified function name here,
|
||||||
|
# but it's removed in cut_off_function_names()
|
||||||
|
func = "kernel_" + name.replace('-', '_')
|
||||||
desc = pmb.parse._apkbuild.subpkgdesc(apkbuild_path, func)
|
desc = pmb.parse._apkbuild.subpkgdesc(apkbuild_path, func)
|
||||||
ret[name] = desc
|
ret[name] = desc
|
||||||
|
|
||||||
|
|
|
@ -73,6 +73,13 @@ def test_kernels(args):
|
||||||
"mainline": "Mainline description"}
|
"mainline": "Mainline description"}
|
||||||
assert func(args, device) == ret
|
assert func(args, device) == ret
|
||||||
|
|
||||||
|
# Long kernel name (e.g. two different mainline kernels)
|
||||||
|
device = "wileyfox-crackling"
|
||||||
|
ret = {"mainline": "Mainline kernel (no modem)",
|
||||||
|
"mainline-modem": "Mainline kernel (with modem)",
|
||||||
|
"downstream": "Downstream kernel"}
|
||||||
|
assert func(args, device) == ret
|
||||||
|
|
||||||
|
|
||||||
def test_depends_in_depends(args):
|
def test_depends_in_depends(args):
|
||||||
path = pmb_src + "/test/testdata/apkbuild/APKBUILD.depends-in-depends"
|
path = pmb_src + "/test/testdata/apkbuild/APKBUILD.depends-in-depends"
|
||||||
|
|
59
test/testdata/init_questions_device/aports/device/device-wileyfox-crackling/APKBUILD
vendored
Normal file
59
test/testdata/init_questions_device/aports/device/device-wileyfox-crackling/APKBUILD
vendored
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
# Reference: <https://postmarketos.org/devicepkg>
|
||||||
|
pkgname="device-wileyfox-crackling"
|
||||||
|
pkgdesc="Wileyfox Swift"
|
||||||
|
pkgver=2
|
||||||
|
pkgrel=0
|
||||||
|
url="https://postmarketos.org"
|
||||||
|
license="MIT"
|
||||||
|
arch="aarch64"
|
||||||
|
options="!check !archcheck"
|
||||||
|
depends="postmarketos-base mkbootimg"
|
||||||
|
makedepends="devicepkg-dev"
|
||||||
|
subpackages="
|
||||||
|
$pkgname-kernel-mainline:kernel_mainline
|
||||||
|
$pkgname-kernel-mainline-modem:kernel_mainline_modem
|
||||||
|
$pkgname-kernel-downstream:kernel_downstream
|
||||||
|
$pkgname-nonfree-firmware:nonfree_firmware
|
||||||
|
$pkgname-nonfree-firmware-modem:nonfree_firmware_modem
|
||||||
|
"
|
||||||
|
|
||||||
|
source="deviceinfo"
|
||||||
|
|
||||||
|
build() {
|
||||||
|
devicepkg_build $startdir $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
devicepkg_package $startdir $pkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel_mainline() {
|
||||||
|
pkgdesc="Mainline kernel (no modem)"
|
||||||
|
depends="linux-postmarketos-qcom-msm8916 soc-qcom-msm8916"
|
||||||
|
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel_mainline_modem() {
|
||||||
|
pkgdesc="Mainline kernel (with modem)"
|
||||||
|
depends="linux-postmarketos-qcom-msm8916 soc-qcom-msm8916 soc-qcom-msm8916-modem"
|
||||||
|
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
kernel_downstream() {
|
||||||
|
pkgdesc="Downstream kernel"
|
||||||
|
depends="linux-wileyfox-crackling mesa-dri-swrast mdss-fb-init-hack"
|
||||||
|
devicepkg_subpackage_kernel $startdir $pkgname $subpkgname
|
||||||
|
}
|
||||||
|
|
||||||
|
nonfree_firmware() {
|
||||||
|
pkgdesc="GPU/WiFi/BT/Video firmware"
|
||||||
|
depends="linux-firmware-qcom firmware-wileyfox-crackling-venus firmware-wileyfox-crackling-wcnss"
|
||||||
|
mkdir "$subpkgdir"
|
||||||
|
}
|
||||||
|
|
||||||
|
nonfree_firmware_modem() {
|
||||||
|
pkgdesc="Modem firmware"
|
||||||
|
depends="firmware-wileyfox-crackling-modem"
|
||||||
|
install_if="$pkgname-nonfree-firmware $pkgname-kernel-mainline-modem"
|
||||||
|
mkdir "$subpkgdir"
|
||||||
|
}
|
Loading…
Reference in New Issue