forked from Mirror/pmbootstrap
treewide: adopt pathlib.Path and type hinting (MR 2252)
With the new chroot type, we can now write fancy paths in the pythonic way. Convert most of the codebase over, as well as adding various other type hints. Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This commit is contained in:
parent
00383bf354
commit
31cc898dd5
64 changed files with 513 additions and 385 deletions
|
@ -18,7 +18,7 @@ def package(args: PmbArgs, pkgname, reason="", dry=False):
|
|||
:param dry: don't modify the APKBUILD, just print the message
|
||||
"""
|
||||
# Current and new pkgrel
|
||||
path = pmb.helpers.pmaports.find(args, pkgname) + "/APKBUILD"
|
||||
path = pmb.helpers.pmaports.find(args, pkgname) / "APKBUILD"
|
||||
apkbuild = pmb.parse.apkbuild(path)
|
||||
pkgrel = int(apkbuild["pkgrel"])
|
||||
pkgrel_new = pkgrel + 1
|
||||
|
@ -91,7 +91,7 @@ def auto_apkindex_package(args: PmbArgs, arch, aport, apk, dry=False):
|
|||
# (which means dynamic libraries that the package was linked
|
||||
# against) and packages for which no aport exists.
|
||||
if (depend.startswith("so:") or
|
||||
not pmb.helpers.pmaports.find(args, depend, False)):
|
||||
not pmb.helpers.pmaports.find_optional(args, depend)):
|
||||
missing.append(depend)
|
||||
|
||||
# Increase pkgrel
|
||||
|
@ -107,7 +107,7 @@ def auto(args: PmbArgs, dry=False):
|
|||
for arch in pmb.config.build_device_architectures:
|
||||
paths = pmb.helpers.repo.apkindex_files(args, arch, alpine=False)
|
||||
for path in paths:
|
||||
logging.info("scan " + path)
|
||||
logging.info(f"scan {path}")
|
||||
index = pmb.parse.apkindex.parse(path, False)
|
||||
for pkgname, apk in index.items():
|
||||
origin = apk["origin"]
|
||||
|
@ -116,12 +116,12 @@ def auto(args: PmbArgs, dry=False):
|
|||
logging.verbose(
|
||||
f"{pkgname}: origin '{origin}' found again")
|
||||
continue
|
||||
aport_path = pmb.helpers.pmaports.find(args, origin, False)
|
||||
aport_path = pmb.helpers.pmaports.find_optional(args, origin)
|
||||
if not aport_path:
|
||||
logging.warning("{}: origin '{}' aport not found".format(
|
||||
pkgname, origin))
|
||||
continue
|
||||
aport = pmb.parse.apkbuild(f"{aport_path}/APKBUILD")
|
||||
aport = pmb.parse.apkbuild(aport_path)
|
||||
if auto_apkindex_package(args, arch, aport, apk, dry):
|
||||
ret.append(pkgname)
|
||||
return ret
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue