Skip to content

APKBUILD parser: recognize all top-level variables

A common pattern in APKBUILDs, is to introduce custom variables prefixed with underscores that get then used in makedepends and other variables.

For example:

_wlrootsmakedepends="
	eudev-dev
  	# ...
  	"
makedepends="
  	# ...
  	$_wlrootsmakedepends
  	"

Adjust the APKBUILD parser code, so it parses all top-level variables and can use them further below when referenced inside other variables. Before returning the parsed APKBUILD data, remove all variables that are not in pmbootstrap's list of known APKBUILD parsing attributes (so the result is the same).

I've compared "pmbootstrap apkbuild_parse" (which parses all APKBUILDs in the currently checked out pmaports dir), before and after this change, and the result is the same except for having more variables successfully replaced.

Fix #2215 (closed)

Edited by Oliver Smith

Merge request reports