pmaports.guess_main: new assumption for -dev pkgs (!1827)

Packages ending in -dev: just assume that the originating aport has the
same pkgname, except for the -dev at the end. Otherwise we may end up
with the wrong package.

For example, if something depends on plasma-framework-dev, and
plasma-framework is in Alpine, but plasma is in pmaports, then the
regular guess_main() algorithm below would pick plasma instead of
plasma-framework.

Fixes: build.postmarketos.org#52
This commit is contained in:
Oliver Smith 2019-10-20 19:53:54 +02:00
parent 8a5c8fcc3e
commit cf9d648ac9
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
2 changed files with 46 additions and 0 deletions

View file

@ -50,3 +50,18 @@ def test_guess_main(args, tmpdir):
assert func(args, "qemu-system-x86_64") == tmpdir + "/temp/qemu"
assert func(args, "some-pkg-sub-pkg") == tmpdir + "/main/some-pkg"
assert func(args, "qemuPackageWithoutDashes") is None
def test_guess_main_dev(args, tmpdir):
# Fake pmaports folder
tmpdir = str(tmpdir)
args.aports = tmpdir
os.makedirs(tmpdir + "/temp/plasma")
func = pmb.helpers.pmaports.guess_main_dev
assert func(args, "plasma-framework-dev") is None
assert func(args, "plasma-dev") == tmpdir + "/temp/plasma"
func = pmb.helpers.pmaports.guess_main
assert func(args, "plasma-framework-dev") is None
assert func(args, "plasma-randomsubpkg") == tmpdir + "/temp/plasma"