pmb.*: various comment reformatting to assist with generating docs (MR 2266)

This commit is contained in:
Robert Eckelmann 2024-05-08 14:39:48 -07:00 committed by Newbyte
parent 415e7364f4
commit 044d3b5a6a
No known key found for this signature in database
GPG key ID: 8A700086A9FE41FD
43 changed files with 592 additions and 599 deletions

View file

@ -8,11 +8,12 @@ import pmb.helpers.pmaports
def filter_missing_packages(args, arch, pkgnames):
""" Create a subset of pkgnames with missing or outdated binary packages.
"""Create a subset of pkgnames with missing or outdated binary packages.
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"]) """
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"])
"""
ret = []
for pkgname in pkgnames:
binary = pmb.parse.apkindex.package(args, pkgname, arch, False)
@ -24,11 +25,12 @@ def filter_missing_packages(args, arch, pkgnames):
def filter_aport_packages(args, arch, pkgnames):
""" Create a subset of pkgnames where each one has an aport.
"""Create a subset of pkgnames where each one has an aport.
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"]) """
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"])
"""
ret = []
for pkgname in pkgnames:
if pmb.helpers.pmaports.find(args, pkgname, False):
@ -37,12 +39,12 @@ def filter_aport_packages(args, arch, pkgnames):
def filter_arch_packages(args, arch, pkgnames):
""" Create a subset of pkgnames with packages removed that can not be
built for a certain arch.
"""Create a subset of pkgnames with packages removed that can not be built for a certain arch.
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"]) """
:param arch: architecture (e.g. "armhf")
:param pkgnames: list of package names (e.g. ["hello-world", "test12"])
:returns: subset of pkgnames (e.g. ["hello-world"])
"""
ret = []
for pkgname in pkgnames:
if pmb.helpers.package.check_arch(args, pkgname, arch, False):
@ -51,13 +53,14 @@ def filter_arch_packages(args, arch, pkgnames):
def get_relevant_packages(args, arch, pkgname=None, built=False):
""" Get all packages that can be built for the architecture in question.
"""Get all packages that can be built for the architecture in question.
:param arch: architecture (e.g. "armhf")
:param pkgname: only look at a specific package (and its dependencies)
:param built: include packages that have already been built
:returns: an alphabetically sorted list of pkgnames, e.g.:
["devicepkg-dev", "hello-world", "unl0kr"] """
:param arch: architecture (e.g. "armhf")
:param pkgname: only look at a specific package (and its dependencies)
:param built: include packages that have already been built
:returns: an alphabetically sorted list of pkgnames, e.g.:
["devicepkg-dev", "hello-world", "osk-sdl"]
"""
if pkgname:
if not pmb.helpers.package.check_arch(args, pkgname, arch, False):
raise RuntimeError(pkgname + " can't be built for " + arch + ".")
@ -84,19 +87,21 @@ def get_relevant_packages(args, arch, pkgname=None, built=False):
def generate_output_format(args, arch, pkgnames):
""" Generate the detailed output format.
:param arch: architecture
:param pkgnames: list of package names that should be in the output,
e.g.: ["hello-world", "pkg-depending-on-hello-world"]
"""Generate the detailed output format.
:param arch: architecture
:param pkgnames: list of package names that should be in the output,
e.g.: ["hello-world", "pkg-depending-on-hello-world"]
:returns: a list like the following:
[{"pkgname": "hello-world",
"repo": "main",
"version": "1-r4",
"depends": []},
{"pkgname": "pkg-depending-on-hello-world",
"version": "0.5-r0",
"repo": "main",
"depends": ["hello-world"]}] """
[{"pkgname": "hello-world",
"repo": "main",
"version": "1-r4",
"depends": []},
{"pkgname": "pkg-depending-on-hello-world",
"version": "0.5-r0",
"repo": "main",
"depends": ["hello-world"]}]
"""
ret = []
for pkgname in pkgnames:
entry = pmb.helpers.package.get(args, pkgname, arch, True)
@ -108,18 +113,14 @@ def generate_output_format(args, arch, pkgnames):
def generate(args, arch, overview, pkgname=None, built=False):
""" Get packages that need to be built, with all their dependencies.
"""Get packages that need to be built, with all their dependencies.
:param arch: architecture (e.g. "armhf")
:param pkgname: only look at a specific package
:param built: include packages that have already been built
:returns: a list like the following:
[{"pkgname": "hello-world",
"repo": "main",
"version": "1-r4"},
{"pkgname": "package-depending-on-hello-world",
"version": "0.5-r0",
"repo": "main"}]
:param arch: architecture (e.g. "armhf")
:param pkgname: only look at a specific package
:param built: include packages that have already been built
:returns: a list like the following:
[{"pkgname": "hello-world", "repo": "main", "version": "1-r4"},
{"pkgname": "package-depending-on-hello-world", "version": "0.5-r0", "repo": "main"}]
"""
# Log message
packages_str = pkgname if pkgname else "all packages"