pmb.parse._apkbuild: Fix subpackages with set arch but no custom function (MR 2267)
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.
This commit is contained in:
parent
e0d5b49840
commit
71ac87e6af
|
@ -234,7 +234,18 @@ def _parse_subpackage(path, lines, apkbuild, subpackages, subpkg):
|
|||
subpkgparts = subpkg.split(":")
|
||||
subpkgname = subpkgparts[0]
|
||||
subpkgsplit = subpkgname[subpkgname.rfind("-") + 1:]
|
||||
if len(subpkgparts) > 1:
|
||||
# If there are multiple sections to the subpackage, 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-subpkg:something_subpkg:noarch"
|
||||
#
|
||||
# But only actually use it if the custom function is not an empty string, as in
|
||||
# those cases it is not meant to be set here. For example:
|
||||
#
|
||||
# "$pkgname-something::noarch"
|
||||
#
|
||||
if len(subpkgparts) > 1 and subpkgparts[1] != "":
|
||||
subpkgsplit = subpkgparts[1]
|
||||
|
||||
# Find start and end of package function
|
||||
|
|
Loading…
Reference in New Issue