mirror of
https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
synced 2025-07-13 03:19:47 +03:00
pmb.helpers.pmaports: Clean up some strings
Use f-strings to make them easier to read and combine some not-so-long ones into one line for easier grepping. Part-of: https://gitlab.postmarketos.org/postmarketOS/pmbootstrap/-/merge_requests/2549
This commit is contained in:
parent
5783d1c507
commit
c426c14f47
1 changed files with 8 additions and 18 deletions
|
@ -26,8 +26,7 @@ def _find_apkbuilds(with_extra_repos: WithExtraRepos = "default") -> dict[str, P
|
||||||
pkgname = package.name
|
pkgname = package.name
|
||||||
if pkgname in apkbuilds:
|
if pkgname in apkbuilds:
|
||||||
raise RuntimeError(
|
raise RuntimeError(
|
||||||
f"Package {pkgname} found in multiple aports "
|
f"Package {pkgname} found in multiple aports subfolders. Please put it only in one folder."
|
||||||
"subfolders. Please put it only in one folder."
|
|
||||||
)
|
)
|
||||||
apkbuilds[pkgname] = package / "APKBUILD"
|
apkbuilds[pkgname] = package / "APKBUILD"
|
||||||
|
|
||||||
|
@ -54,16 +53,12 @@ def guess_main_dev(subpkgname: str) -> Path | None:
|
||||||
path = _find_apkbuilds().get(pkgname)
|
path = _find_apkbuilds().get(pkgname)
|
||||||
if path:
|
if path:
|
||||||
logging.verbose(
|
logging.verbose(
|
||||||
subpkgname + ": guessed to be a subpackage of " + pkgname + " (just removed '-dev')"
|
f"{subpkgname}: guessed to be a subpackage of {pkgname} (just removed '-dev')"
|
||||||
)
|
)
|
||||||
return path.parent
|
return path.parent
|
||||||
|
|
||||||
logging.verbose(
|
logging.verbose(
|
||||||
subpkgname
|
f"{subpkgname}: guessed to be a subpackage of {pkgname}, which we can't find in pmaports, so it's probably in Alpine"
|
||||||
+ ": guessed to be a subpackage of "
|
|
||||||
+ pkgname
|
|
||||||
+ ", which we can't find in pmaports, so it's probably in"
|
|
||||||
" Alpine"
|
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -84,15 +79,11 @@ def guess_main_cross(subpkgname: str) -> Path | None:
|
||||||
|
|
||||||
path = _find_apkbuilds().get(pkgname)
|
path = _find_apkbuilds().get(pkgname)
|
||||||
if path:
|
if path:
|
||||||
logging.verbose(subpkgname + ": guessed to be a subpackage of " + pkgname)
|
logging.verbose(f"{subpkgname}: guessed to be a subpackage of {pkgname}")
|
||||||
return path.parent
|
return path.parent
|
||||||
|
|
||||||
logging.verbose(
|
logging.verbose(
|
||||||
subpkgname
|
f"{subpkgname}: guessed to be a subpackage of {pkgname}, which we can't find in pmaports, so it's probably in Alpine"
|
||||||
+ ": guessed to be a subpackage of "
|
|
||||||
+ pkgname
|
|
||||||
+ ", which we can't find in pmaports, so it's probably in"
|
|
||||||
" Alpine"
|
|
||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -135,7 +126,7 @@ def guess_main(subpkgname: str) -> Path | None:
|
||||||
# Look in pmaports
|
# Look in pmaports
|
||||||
path = _find_apkbuilds().get(pkgname)
|
path = _find_apkbuilds().get(pkgname)
|
||||||
if path:
|
if path:
|
||||||
logging.verbose(subpkgname + ": guessed to be a subpackage of " + pkgname)
|
logging.verbose(f"{subpkgname}: guessed to be a subpackage of {pkgname}")
|
||||||
return path.parent
|
return path.parent
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
@ -230,7 +221,7 @@ def find(
|
||||||
ret: Path | None = None
|
ret: Path | None = None
|
||||||
# Sanity check
|
# Sanity check
|
||||||
if "*" in package:
|
if "*" in package:
|
||||||
raise RuntimeError("Invalid pkgname: " + package)
|
raise RuntimeError(f"Invalid pkgname: {package}")
|
||||||
|
|
||||||
# Try to find an APKBUILD with the exact pkgname we are looking for
|
# Try to find an APKBUILD with the exact pkgname we are looking for
|
||||||
path = _find_apkbuilds(with_extra_repos).get(package)
|
path = _find_apkbuilds(with_extra_repos).get(package)
|
||||||
|
@ -425,8 +416,7 @@ def require_bootstrap_error(repo: str, arch: Arch, trigger_str: str) -> None:
|
||||||
:param trigger_str: message for the user to understand what caused this
|
:param trigger_str: message for the user to understand what caused this
|
||||||
"""
|
"""
|
||||||
logging.info(
|
logging.info(
|
||||||
f"ERROR: Trying to {trigger_str} with {repo} enabled, but the"
|
f"ERROR: Trying to {trigger_str} with {repo} enabled, but the {repo} repo needs to be bootstrapped first."
|
||||||
f" {repo} repo needs to be bootstrapped first."
|
|
||||||
)
|
)
|
||||||
raise RuntimeError(f"Run 'pmbootstrap repo_bootstrap {repo} --arch={arch}' and then try again.")
|
raise RuntimeError(f"Run 'pmbootstrap repo_bootstrap {repo} --arch={arch}' and then try again.")
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue