testdata/APKBUILD.var-replacements: add custom var (MR 2300)

Extend the testdata and test case to show that the parser can now handle
custom variables.
This commit is contained in:
Oliver Smith 2024-04-17 16:46:31 +02:00
parent 85ee201cf5
commit 105b5ec0bf
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 3 additions and 2 deletions

View file

@ -136,7 +136,7 @@ def test_variable_replacements():
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.variable-replacements" path = pmb_test.const.testdata + "/apkbuild/APKBUILD.variable-replacements"
apkbuild = pmb.parse.apkbuild(path, check_pkgname=False) apkbuild = pmb.parse.apkbuild(path, check_pkgname=False)
assert apkbuild["pkgdesc"] == "this should not affect variable replacement" assert apkbuild["pkgdesc"] == "this should not affect variable replacement"
assert apkbuild["url"] == "replacements variable string-replacements" assert apkbuild["url"] == "replacements variable string-replacements 1234"
assert list(apkbuild["subpackages"].keys()) == ["replacements", "test"] assert list(apkbuild["subpackages"].keys()) == ["replacements", "test"]
assert apkbuild["subpackages"]["replacements"] is None assert apkbuild["subpackages"]["replacements"] is None

View file

@ -3,7 +3,8 @@ pkgver="1.0.0"
pkgrel=0 pkgrel=0
arch="armhf" arch="armhf"
pkgdesc="$pkgdesc$pkgname test" pkgdesc="$pkgdesc$pkgname test"
url="${pkgname/variable-} ${pkgname/-replacements/} ${pkgname/variable/string}" _custom_var="1234" # this variable is not known to pmbootstrap
url="${pkgname/variable-} ${pkgname/-replacements/} ${pkgname/variable/string} $_custom_var"
subpackages="${pkgdesc#variable-}:test_subpkg_func" subpackages="${pkgdesc#variable-}:test_subpkg_func"
pkgdesc="this should not affect variable replacement" pkgdesc="this should not affect variable replacement"