pmb, test: remove redundant commas (MR 2115)
This commit is contained in:
parent
4675def8e6
commit
2d23849aa3
|
@ -56,16 +56,16 @@ def rewrite(args, pkgname, path_original="", fields={}, replace_pkgname=None,
|
|||
|
||||
:param path_original: The original path of the automatically generated
|
||||
aport.
|
||||
:param fields: key-value pairs of fields, that shall be changed in the
|
||||
:param fields: key-value pairs of fields that shall be changed in the
|
||||
APKBUILD. For example: {"pkgdesc": "my new package", "subpkgs": ""}
|
||||
:param replace_pkgname: When set, $pkgname gets replaced with that string
|
||||
in every line.
|
||||
:param replace_functions: Function names and new bodies, for example:
|
||||
{"build": "return 0"}
|
||||
The body can also be None (deletes the function)
|
||||
:param replace_simple: Lines, that fnmatch the pattern, get
|
||||
:param replace_simple: Lines that fnmatch the pattern, get
|
||||
replaced/deleted. Example: {"*test*": "# test", "*mv test.bin*": None}
|
||||
:param below_header: String, that gets directly placed below the header.
|
||||
:param below_header: String that gets directly placed below the header.
|
||||
:param remove_indent: Number of spaces to remove from function body
|
||||
provided to replace_functions.
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ def match_kbuild_out(args, word):
|
|||
"<prefix>/<kbuild_out>/include/config/kernel.release"
|
||||
|
||||
:param word: space separated string cut out from a line from an APKBUILD
|
||||
function body, that might be the kbuild output path
|
||||
function body that might be the kbuild output path
|
||||
:returns: kernel build output directory.
|
||||
empty string when a separate build output directory isn't used.
|
||||
None, when no output directory is found.
|
||||
|
|
|
@ -40,12 +40,12 @@ def init(args, suffix="native"):
|
|||
key = key[len(chroot):]
|
||||
pmb.chroot.root(args, ["cp", key, "/etc/apk/keys/"], suffix)
|
||||
|
||||
# Add gzip wrapper, that converts '-9' to '-1'
|
||||
# Add gzip wrapper that converts '-9' to '-1'
|
||||
if not os.path.exists(chroot + "/usr/local/bin/gzip"):
|
||||
with open(chroot + "/tmp/gzip_wrapper.sh", "w") as handle:
|
||||
content = """
|
||||
#!/bin/sh
|
||||
# Simple wrapper, that converts -9 flag for gzip to -1 for
|
||||
# Simple wrapper that converts -9 flag for gzip to -1 for
|
||||
# speed improvement with abuild. FIXME: upstream to abuild
|
||||
# with a flag!
|
||||
args=""
|
||||
|
|
|
@ -110,7 +110,7 @@ def install_is_necessary(args, build, arch, package, packages_installed):
|
|||
if package not in packages_installed:
|
||||
return True
|
||||
|
||||
# Make sure, that we really have a binary package
|
||||
# Make sure that we really have a binary package
|
||||
data_repo = pmb.parse.apkindex.package(args, package, arch, False)
|
||||
if not data_repo:
|
||||
if build_disabled:
|
||||
|
@ -157,7 +157,7 @@ def replace_aports_packages_with_path(args, packages, suffix, arch):
|
|||
"""
|
||||
apk will only re-install packages with the same pkgname,
|
||||
pkgver and pkgrel, when you give it the absolute path to the package.
|
||||
This function replaces all packages, that were built locally,
|
||||
This function replaces all packages that were built locally,
|
||||
with the absolute path to the package.
|
||||
"""
|
||||
ret = []
|
||||
|
@ -185,7 +185,7 @@ def install(args, packages, suffix="native", build=True):
|
|||
"""
|
||||
:param build: automatically build the package, when it does not exist yet
|
||||
or needs to be updated, and it is inside the pm-aports
|
||||
folder. Checking this is expensive - if you know, that all
|
||||
folder. Checking this is expensive - if you know that all
|
||||
packages are provides by upstream repos, set this to False!
|
||||
"""
|
||||
# Initialize chroot
|
||||
|
|
|
@ -18,7 +18,7 @@ import pmb.parse.version
|
|||
|
||||
def read_signature_info(tar):
|
||||
"""
|
||||
Find various information about the signature, that was used to sign
|
||||
Find various information about the signature that was used to sign
|
||||
/sbin/apk.static inside the archive (not to be confused with the normal apk
|
||||
archive signature!)
|
||||
|
||||
|
@ -33,7 +33,7 @@ def read_signature_info(tar):
|
|||
break
|
||||
if not sigfilename:
|
||||
raise RuntimeError("Could not find signature filename in apk."
|
||||
" This means, that your apk file is damaged."
|
||||
" This means that your apk file is damaged."
|
||||
" Delete it and try again."
|
||||
" If the problem persists, fill out a bug report.")
|
||||
sigkey = sigfilename[len(prefix):]
|
||||
|
@ -114,7 +114,7 @@ def extract(args, version, apk_path):
|
|||
os.unlink(files["sig"]["temp_path"])
|
||||
temp_path = files["apk"]["temp_path"]
|
||||
|
||||
# Verify the version, that the extracted binary reports
|
||||
# Verify the version that the extracted binary reports
|
||||
logging.debug("Verify the version reported by the apk.static binary"
|
||||
f" (must match the package version {version})")
|
||||
os.chmod(temp_path, os.stat(temp_path).st_mode | stat.S_IEXEC)
|
||||
|
|
|
@ -55,6 +55,6 @@ def delete(args, hook, suffix):
|
|||
|
||||
def update(args, suffix):
|
||||
"""
|
||||
Rebuild and update all hooks, that are out of date
|
||||
Rebuild and update all hooks that are out of date
|
||||
"""
|
||||
pmb.chroot.apk.install(args, list_chroot(args, suffix, False), suffix)
|
||||
|
|
|
@ -33,7 +33,7 @@ def kernel_flavor_installed(args, suffix, autoinstall=True):
|
|||
|
||||
def tempfolder(args, path, suffix="native"):
|
||||
"""
|
||||
Create a temporary folder inside the chroot, that belongs to "user".
|
||||
Create a temporary folder inside the chroot that belongs to "user".
|
||||
The folder gets deleted, if it already exists.
|
||||
|
||||
:param path: of the temporary folder inside the chroot
|
||||
|
|
|
@ -19,7 +19,7 @@ def executables_absolute_path():
|
|||
path = shutil.which(binary, path=pmb.config.chroot_host_path)
|
||||
if not path:
|
||||
raise RuntimeError(f"Could not find the '{binary}'"
|
||||
" executable. Make sure, that it is in"
|
||||
" executable. Make sure that it is in"
|
||||
" your current user's PATH.")
|
||||
ret[binary] = path
|
||||
return ret
|
||||
|
|
|
@ -23,7 +23,7 @@ def zap(args, confirm=True, dry=False, pkgs_local=False, http=False,
|
|||
:param dry: Only show what would be deleted, do not delete for real
|
||||
:param pkgs_local: Remove *all* self-compiled packages (!)
|
||||
:param http: Clear the http cache (used e.g. for the initial apk download)
|
||||
:param pkgs_local_mismatch: Remove the packages, that have
|
||||
:param pkgs_local_mismatch: Remove the packages that have
|
||||
a different version compared to what is in the aports folder.
|
||||
:param pkgs_online_mismatch: Clean out outdated binary packages
|
||||
downloaded from mirrors (e.g. from Alpine)
|
||||
|
|
|
@ -191,7 +191,7 @@ chroot_path = ":".join([
|
|||
# for the chroot executable may not be in the PATH (Debian).
|
||||
chroot_host_path = os.environ["PATH"] + ":/usr/sbin/"
|
||||
|
||||
# Folders, that get mounted inside the chroot
|
||||
# Folders that get mounted inside the chroot
|
||||
# $WORK gets replaced with args.work
|
||||
# $ARCH gets replaced with the chroot architecture (eg. x86_64, armhf)
|
||||
# $CHANNEL gets replaced with the release channel (e.g. edge, v21.03)
|
||||
|
@ -251,7 +251,7 @@ chroot_outdated = 3600 * 24 * 2
|
|||
# packages (use "pmbootstrap aportgen musl-armhf" etc.).
|
||||
build_device_architectures = ["armhf", "armv7", "aarch64", "x86_64", "x86"]
|
||||
|
||||
# Packages, that will be installed in a chroot before it builds packages
|
||||
# Packages that will be installed in a chroot before it builds packages
|
||||
# for the first time
|
||||
build_packages = ["abuild", "build-base", "ccache", "git"]
|
||||
|
||||
|
@ -504,7 +504,7 @@ apkbuild_package_attributes = {
|
|||
"_pmb_groups": {"array": True},
|
||||
}
|
||||
|
||||
# Variables in APKBUILD files, that get parsed
|
||||
# Variables in APKBUILD files that get parsed
|
||||
apkbuild_attributes = {
|
||||
**apkbuild_package_attributes,
|
||||
|
||||
|
@ -645,7 +645,7 @@ default_ip = "172.16.42.1"
|
|||
# INSTALL
|
||||
#
|
||||
|
||||
# Packages, that will be installed inside the native chroot to perform
|
||||
# Packages that will be installed inside the native chroot to perform
|
||||
# the installation to the device.
|
||||
# util-linux: losetup, fallocate
|
||||
install_native_packages = ["cryptsetup", "util-linux", "parted"]
|
||||
|
|
|
@ -20,7 +20,7 @@ import pmb.helpers.git
|
|||
...
|
||||
|
||||
2. Argparse merged with others
|
||||
Variables from the user's config file (~/.config/pmbootstrap.cfg), that
|
||||
Variables from the user's config file (~/.config/pmbootstrap.cfg) that
|
||||
can be overridden from the command line (pmb/parse/arguments.py) and
|
||||
fall back to the defaults defined in pmb/config/__init__.py (see
|
||||
"defaults = {..."). The user's config file gets generated interactively
|
||||
|
|
|
@ -234,7 +234,7 @@ def is_outdated(args, path):
|
|||
# Usually it does not (before first git fetch/pull), but there is no good
|
||||
# fallback. For exampe, getting the _creation_ date of .git/HEAD is non-
|
||||
# trivial with python on linux (https://stackoverflow.com/a/39501288).
|
||||
# Note that we have to assume here, that the user had fetched the "origin"
|
||||
# Note that we have to assume here that the user had fetched the "origin"
|
||||
# repository. If the user fetched another repository, FETCH_HEAD would also
|
||||
# get updated, even though "origin" may be outdated. For pmbootstrap status
|
||||
# it is good enough, because it should help the users that are not doing
|
||||
|
|
|
@ -6,7 +6,7 @@ import pmb.helpers.run
|
|||
|
||||
def ismount(folder):
|
||||
"""
|
||||
Ismount() implementation, that works for mount --bind.
|
||||
Ismount() implementation that works for mount --bind.
|
||||
Workaround for: https://bugs.python.org/issue29707
|
||||
"""
|
||||
folder = os.path.realpath(os.path.realpath(folder))
|
||||
|
@ -45,7 +45,7 @@ def bind(args, source, destination, create_folders=True, umount=False):
|
|||
# Actually mount the folder
|
||||
pmb.helpers.run.root(args, ["mount", "--bind", source, destination])
|
||||
|
||||
# Verify, that it has worked
|
||||
# Verify that it has worked
|
||||
if not ismount(destination):
|
||||
raise RuntimeError("Mount failed: " + source + " -> " + destination)
|
||||
|
||||
|
@ -77,7 +77,7 @@ def umount_all_list(prefix, source="/proc/mounts"):
|
|||
"""
|
||||
Parses `/proc/mounts` for all folders beginning with a prefix.
|
||||
:source: can be changed for testcases
|
||||
:returns: a list of folders, that need to be umounted
|
||||
:returns: a list of folders that need to be umounted
|
||||
"""
|
||||
ret = []
|
||||
prefix = os.path.realpath(prefix)
|
||||
|
@ -100,7 +100,7 @@ def umount_all_list(prefix, source="/proc/mounts"):
|
|||
|
||||
def umount_all(args, folder):
|
||||
"""
|
||||
Umount all folders, that are mounted inside a given folder.
|
||||
Umount all folders that are mounted inside a given folder.
|
||||
"""
|
||||
for mountpoint in umount_all_list(folder):
|
||||
pmb.helpers.run.root(args, ["umount", mountpoint])
|
||||
|
|
|
@ -13,7 +13,7 @@ import pmb.parse
|
|||
|
||||
|
||||
def _find_apkbuilds(args):
|
||||
# Try to get a cached result first (we assume, that the aports don't change
|
||||
# Try to get a cached result first (we assume that the aports don't change
|
||||
# in one pmbootstrap call)
|
||||
apkbuilds = args.cache.get("pmb.helpers.pmaports.apkbuilds")
|
||||
if apkbuilds is not None:
|
||||
|
@ -102,13 +102,13 @@ def guess_main(args, subpkgname):
|
|||
|
||||
def find(args, package, must_exist=True):
|
||||
"""
|
||||
Find the aport path, that provides a certain subpackage.
|
||||
Find the aport path that provides a certain subpackage.
|
||||
If you want the parsed APKBUILD instead, use pmb.helpers.pmaports.get().
|
||||
|
||||
:param must_exist: Raise an exception, when not found
|
||||
:returns: the full path to the aport folder
|
||||
"""
|
||||
# Try to get a cached result first (we assume, that the aports don't change
|
||||
# Try to get a cached result first (we assume that the aports don't change
|
||||
# in one pmbootstrap call)
|
||||
ret = None
|
||||
if package in args.cache["find_aport"]:
|
||||
|
|
|
@ -15,7 +15,7 @@ import pmb.helpers.run
|
|||
|
||||
def hash(url, length=8):
|
||||
"""
|
||||
Generate the hash, that APK adds to the APKINDEX and apk packages
|
||||
Generate the hash that APK adds to the APKINDEX and apk packages
|
||||
in its apk cache folder. It is the "12345678" part in this example:
|
||||
"APKINDEX.12345678.tar.gz".
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ def mount(args, img_path):
|
|||
|
||||
def device_by_back_file(args, back_file, auto_init=True):
|
||||
"""
|
||||
Get the /dev/loopX device, that points to a specific image file.
|
||||
Get the /dev/loopX device that points to a specific image file.
|
||||
"""
|
||||
|
||||
# Get list from losetup
|
||||
|
|
|
@ -291,7 +291,7 @@ def apkbuild(args, path, check_pkgver=True, check_pkgname=True):
|
|||
:returns: relevant variables from the APKBUILD. Arrays get returned as
|
||||
arrays.
|
||||
"""
|
||||
# Try to get a cached result first (we assume, that the aports don't change
|
||||
# Try to get a cached result first (we assume that the aports don't change
|
||||
# in one pmbootstrap call)
|
||||
if path in args.cache["apkbuild"]:
|
||||
return args.cache["apkbuild"][path]
|
||||
|
@ -310,7 +310,7 @@ def apkbuild(args, path, check_pkgver=True, check_pkgname=True):
|
|||
logging.info(f"Folder: '{os.path.dirname(path)}'")
|
||||
logging.info(f"Pkgname: '{ret['pkgname']}'")
|
||||
raise RuntimeError("The pkgname must be equal to the name of"
|
||||
" the folder, that contains the APKBUILD!")
|
||||
" the folder that contains the APKBUILD!")
|
||||
|
||||
# Sanity check: pkgver
|
||||
if check_pkgver:
|
||||
|
|
|
@ -104,7 +104,7 @@ def parse_add_block(ret, block, alias=None, multiple_providers=True):
|
|||
"""
|
||||
Add one block to the return dictionary of parse().
|
||||
|
||||
:param ret: dictionary of all packages in the APKINDEX, that is
|
||||
:param ret: dictionary of all packages in the APKINDEX that is
|
||||
getting built right now. This function will extend it.
|
||||
:param block: return value from parse_next_block().
|
||||
:param alias: defaults to the pkgname, could be an alias from the
|
||||
|
|
|
@ -41,7 +41,7 @@ def next_token(previous, rest):
|
|||
currently looking at.
|
||||
|
||||
We do *not* get the value of the token, or advance the rest string
|
||||
beyond the whole token, that is what the get_token() function does
|
||||
beyond the whole token that is what the get_token() function does
|
||||
(see below).
|
||||
|
||||
:param previous: the token before
|
||||
|
@ -95,7 +95,7 @@ def parse_suffix(rest):
|
|||
suffix), and return a value integer (so it can be compared later,
|
||||
"beta" > "alpha" etc).
|
||||
|
||||
:param rest: what is left of the version string, that we are
|
||||
:param rest: what is left of the version string that we are
|
||||
currently parsing, starts with a "suffix" value
|
||||
(see below for valid suffixes).
|
||||
:returns: (rest, value, invalid_suffix)
|
||||
|
|
|
@ -12,9 +12,9 @@ def prepare_tmpdir(args, monkeypatch, tmpdir):
|
|||
|
||||
Git repositories:
|
||||
* local: like local clone of pmaports.git
|
||||
* remote: emulate a remote repository, that we can add to "local", so
|
||||
* remote: emulate a remote repository that we can add to "local", so
|
||||
we can pass the tracking-remote tests in pmb.helpers.git.pull
|
||||
* remote2: unexpected remote, that pmbootstrap can complain about
|
||||
* remote2: unexpected remote that pmbootstrap can complain about
|
||||
|
||||
Function overrides:
|
||||
* pmb.helpers.git.get_path: always return path to "local" repo
|
||||
|
|
|
@ -68,7 +68,7 @@ def test_build_is_necessary(args):
|
|||
|
||||
def test_build_is_necessary_no_binary_available(args):
|
||||
"""
|
||||
APKINDEX cache is set up to fake an empty APKINDEX, which means, that the
|
||||
APKINDEX cache is set up to fake an empty APKINDEX, which means that the
|
||||
hello-world package has not been built yet.
|
||||
"""
|
||||
indexes = list(args.cache["apkindex"].keys())
|
||||
|
|
|
@ -377,7 +377,7 @@ def test_build_local_source_high_level(args, tmpdir):
|
|||
Test building a package with overriding the source code:
|
||||
pmbootstrap build --src=/some/path hello-world
|
||||
|
||||
We use a copy of the hello-world APKBUILD here, that doesn't have the
|
||||
We use a copy of the hello-world APKBUILD here that doesn't have the
|
||||
source files it needs to build included. And we use the original aport
|
||||
folder as local source folder, so pmbootstrap should take the source files
|
||||
from there and the build should succeed.
|
||||
|
|
|
@ -62,13 +62,13 @@ def test_package_provider(args, monkeypatch):
|
|||
providers = {"test-two": package_two, "test": package}
|
||||
assert func(args, pkgname, pkgnames_install) == package
|
||||
|
||||
# 3. Pick a package, that will be installed anyway
|
||||
# 3. Pick a package that will be installed anyway
|
||||
providers = {"test_": package, "test-two": package_two}
|
||||
installed = {"test_": package}
|
||||
pkgnames_install = ["test-two"]
|
||||
assert func(args, pkgname, pkgnames_install) == package_two
|
||||
|
||||
# 4. Pick a package, that is already installed
|
||||
# 4. Pick a package that is already installed
|
||||
pkgnames_install = []
|
||||
assert func(args, pkgname, pkgnames_install) == package
|
||||
|
||||
|
|
Loading…
Reference in New Issue