Skip to content

pmb.parse._apkbuild: Fix subpackages with set arch but no custom function

Newbyte requested to merge newbyte/subpackage-no-custom-function-fix into master

If there are multiple sections to a subpackage declaration, the middle one (item 1 in the sequence in this case) is the custom function name which we should use instead of the deduced one.

For example:

$pkgname-something-separate:something_separate:noarch

Here, the subpackage is called $pkgname-something-separate, but function names cannot contain hyphens, so it's instead given the custom name something_separate where the hyphen is replaced by an underscore. At the end, the architecture of the subpackage is also overriden as noarch instead of whatever architecture the main package has.

However, it is also possible to only override architecture of a subpackage and not the function name.

In such cases, we get this:

$pkgname-something::noarch

We still have a "middle section" (item 1 in the sequence), but it will be empty. As such, we not only need to check whether there are more than 1 subpackage part, but also whether that extra subpackage part is an empty string or not.

This fixes an issue where pmbootstrap would not end up just setting the properties of subpackages with a set arch but no custom function as None instead of giving them proper depends, install, pkgdesc, et cetera properties.

Merge request reports