pmb.parse._apkbuild: Extend APKBUILD parser to work for subpackages (!1866)

At the moment we have a simple subpkgdesc() function that can only
parse "pkgdesc" from subpackages, without support for any variables.
But we have a quite nice variable parser now that can be extended
to work for subpackages.

Simply put this works by:
  - Finding the lines that belong to the subpackage function
  - Stripping indentation (tab)
  - Parsing relevant attributes similar to the apkbuild() function

The "subpackages" in the parsed APKBUILD are replaced by a dict
of subpkgname: {"pkgdesc": "...", "depends": "..."} which are
parsed from the subpackage function (if found).
This makes it possible to get the "depends" of a subpackage.
This commit is contained in:
Minecrell 2020-01-28 00:23:09 +01:00 committed by Alexey Min
parent 0dad22a112
commit 0e27713512
No known key found for this signature in database
GPG key ID: 463F84201DACD7B9
12 changed files with 178 additions and 104 deletions

View file

@ -49,7 +49,7 @@ def test_helpers_package_get_pmaports_and_cache(args, monkeypatch):
"provides": ["testprovide"],
"options": [],
"checkdepends": [],
"subpackages": [],
"subpackages": {},
"makedepends": [],
"pkgver": "1.0",
"pkgrel": "1"}