pmb.helpers.pmaports: search apkbuild path only if package exists (!1896)

This commit is contained in:
Daniele Debernardi 2020-03-25 22:32:53 +01:00 committed by Oliver Smith
parent 0c179a5cf9
commit 20de238ff6
No known key found for this signature in database
GPG Key ID: 5AE7F5513E0885CB
1 changed files with 20 additions and 17 deletions

View File

@ -44,11 +44,12 @@ def guess_main_dev(args, subpkgname):
:returns: full path to the pmaport or None
"""
pkgname = subpkgname[:-4]
paths = _glob_apkbuilds(args, pkgname)
if paths:
logging.debug(subpkgname + ": guessed to be a subpackage of " +
pkgname + " (just removed '-dev')")
return os.path.dirname(paths[0])
if pkgname in get_list(args):
paths = _glob_apkbuilds(args, pkgname)
if paths:
logging.debug(subpkgname + ": guessed to be a subpackage of " +
pkgname + " (just removed '-dev')")
return os.path.dirname(paths[0])
logging.debug(subpkgname + ": guessed to be a subpackage of " + pkgname +
", which we can't find in pmaports, so it's probably in"
@ -86,11 +87,12 @@ def guess_main(args, subpkgname):
pkgname = "-".join(words)
# Look in pmaports
paths = _glob_apkbuilds(args, pkgname)
if paths:
logging.debug(subpkgname + ": guessed to be a subpackage of " +
pkgname)
return os.path.dirname(paths[0])
if pkgname in get_list(args):
paths = _glob_apkbuilds(args, pkgname)
if paths:
logging.debug(subpkgname + ": guessed to be a subpackage of " +
pkgname)
return os.path.dirname(paths[0])
def find(args, package, must_exist=True):
@ -112,13 +114,14 @@ def find(args, package, must_exist=True):
raise RuntimeError("Invalid pkgname: " + package)
# Search in packages
paths = _glob_apkbuilds(args, package)
if len(paths) > 1:
raise RuntimeError("Package " + package + " found in multiple"
" aports subfolders. Please put it only in one"
" folder.")
elif len(paths) == 1:
ret = os.path.dirname(paths[0])
if package in get_list(args):
paths = _glob_apkbuilds(args, package)
if len(paths) > 1:
raise RuntimeError("Package " + package + " found in multiple"
" aports subfolders. Please put it only in one"
" folder.")
elif len(paths) == 1:
ret = os.path.dirname(paths[0])
# Search in subpackages and provides
if not ret: