remove unused args argument (MR 2136)

This commit is contained in:
BO41 2021-11-09 12:54:07 +01:00 committed by Oliver Smith
parent 379991aa62
commit 3f2bd03d33
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
10 changed files with 38 additions and 38 deletions

View file

@ -15,7 +15,7 @@ import pmb.parse
import pmb.parse.arch
def skip_already_built(args, pkgname, arch):
def skip_already_built(pkgname, arch):
"""
Check if the package was already built in this session, and add it
to the cache in case it was not built yet.
@ -456,8 +456,8 @@ def finish(args, apkbuild, arch, output, strict=False, suffix="native"):
# Clear APKINDEX cache (we only parse APKINDEX files once per session and
# cache the result for faster dependency resolving, but after we built a
# package we need to parse it again)
pmb.parse.apkindex.clear_cache(args, f"{args.work}/packages/{channel}"
f"/{arch}/APKINDEX.tar.gz")
pmb.parse.apkindex.clear_cache(f"{args.work}/packages/{channel}"
f"/{arch}/APKINDEX.tar.gz")
# Uninstall build dependencies (strict mode)
if strict or "pmb:strict" in apkbuild["options"]:
@ -494,7 +494,7 @@ def package(args, pkgname, arch=None, force=False, strict=False,
"""
# Once per session is enough
arch = arch or pmb.config.arch_native
if skip_already_built(args, pkgname, arch):
if skip_already_built(pkgname, arch):
return
# Only build when APKBUILD exists

View file

@ -117,7 +117,7 @@ def index_repo(args, arch=None):
pmb.chroot.user(args, command, working_dir=path_repo_chroot)
else:
logging.debug("NOTE: Can't build index for: " + path)
pmb.parse.apkindex.clear_cache(args, path + "/APKINDEX.tar.gz")
pmb.parse.apkindex.clear_cache(f"{path}/APKINDEX.tar.gz")
def configure_abuild(args, suffix, verify=False):

View file

@ -100,7 +100,7 @@ def guess_main(args, subpkgname):
return os.path.dirname(path)
def _find_package_in_apkbuild(args, package, path):
def _find_package_in_apkbuild(package, path):
"""
Look through subpackages and all provides to see if the APKBUILD at the
specified path contains (or provides) the specified package.
@ -162,13 +162,13 @@ def find(args, package, must_exist=True):
guess = guess_main(args, package)
if guess:
# ... but see if we were right
if _find_package_in_apkbuild(args, package, f'{guess}/APKBUILD'):
if _find_package_in_apkbuild(package, f'{guess}/APKBUILD'):
ret = guess
# Search in subpackages and provides
if not ret:
for path_current in _find_apkbuilds(args).values():
if _find_package_in_apkbuild(args, package, path_current):
if _find_package_in_apkbuild(package, path_current):
ret = os.path.dirname(path_current)
break

View file

@ -231,7 +231,7 @@ def sudo_timer_iterate():
timer.start()
def sudo_timer_start(args):
def sudo_timer_start():
"""
Start a timer to call sudo -v periodically, so that the password is only
needed once.
@ -305,7 +305,7 @@ def core(args, log_message, cmd, working_dir=None, output="log",
sanity_checks(output, output_return, check)
if args.sudo_timer and sudo:
sudo_timer_start(args)
sudo_timer_start()
# Log simplified and full command (pmbootstrap -v)
logging.debug(log_message)

View file

@ -185,7 +185,7 @@ def parse(path, multiple_providers=True):
if cache_key in cache:
return cache[cache_key]
else:
clear_cache(args, path)
clear_cache(path)
# Read all lines
if tarfile.is_tarfile(path):
@ -250,7 +250,7 @@ def parse_blocks(path):
ret.append(block)
def clear_cache(args, path):
def clear_cache(path):
"""
Clear the APKINDEX parsing cache.

View file

@ -28,7 +28,7 @@ def args(request, tmpdir):
return args
def cache_apkindex(args, version):
def cache_apkindex(version):
"""
Modify the cache of the parsed binary package repository's APKINDEX
for the "hello-world" package.
@ -54,15 +54,15 @@ def test_build_is_necessary(args):
pmb.helpers.other.cache["apkindex"][apkindex_path]["multiple"] = cache
# Binary repo has a newer version
cache_apkindex(args, "999-r1")
cache_apkindex("999-r1")
assert pmb.build.is_necessary(args, None, apkbuild, indexes) is False
# Aports folder has a newer version
cache_apkindex(args, "0-r0")
cache_apkindex("0-r0")
assert pmb.build.is_necessary(args, None, apkbuild, indexes) is True
# Same version
cache_apkindex(args, "1-r2")
cache_apkindex("1-r2")
assert pmb.build.is_necessary(args, None, apkbuild, indexes) is False

View file

@ -56,12 +56,12 @@ def args_patched(monkeypatch, argv):
return pmb.parse.arguments()
def test_skip_already_built(args):
def test_skip_already_built():
func = pmb.build._package.skip_already_built
assert pmb.helpers.other.cache["built"] == {}
assert func(args, "test-package", "armhf") is False
assert func("test-package", "armhf") is False
assert pmb.helpers.other.cache["built"] == {"armhf": ["test-package"]}
assert func(args, "test-package", "armhf") is True
assert func("test-package", "armhf") is True
def test_get_apkbuild(args):

View file

@ -19,7 +19,7 @@ def args(tmpdir, request):
return args
def test_subpackages(args):
def test_subpackages():
testdata = pmb_test.const.testdata
path = testdata + "/apkbuild/APKBUILD.subpackages"
apkbuild = pmb.parse.apkbuild(path, check_pkgname=False)
@ -73,7 +73,7 @@ def test_kernels(args):
assert func(args, device) == ret
def test_depends_in_depends(args):
def test_depends_in_depends():
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.depends-in-depends"
apkbuild = pmb.parse.apkbuild(path, check_pkgname=False)
assert apkbuild["depends"] == ["first", "second", "third"]
@ -124,7 +124,7 @@ def test_parse_attributes():
assert str(e.value).startswith("Can't find closing")
def test_variable_replacements(args):
def test_variable_replacements():
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.variable-replacements"
apkbuild = pmb.parse.apkbuild(path, check_pkgname=False)
assert apkbuild["pkgdesc"] == "this should not affect variable replacement"
@ -137,7 +137,7 @@ def test_variable_replacements(args):
"replacement")
def test_parse_maintainers(args):
def test_parse_maintainers():
path = pmb_test.const.testdata + "/apkbuild/APKBUILD.lint"
maintainers = [
"Oliver Smith <ollieparanoid@postmarketos.org>",
@ -147,7 +147,7 @@ def test_parse_maintainers(args):
assert pmb.parse._apkbuild.maintainers(path) == maintainers
def test_parse_unmaintained(args):
def test_parse_unmaintained():
path = (f"{pmb_test.const.testdata}/apkbuild"
"/APKBUILD.missing-pkgdesc-in-subpackage")
assert pmb.parse._apkbuild.unmaintained(path) == "This is broken!"

View file

@ -176,7 +176,7 @@ def test_parse_add_block_multiple_providers(args):
"test_alias": {"test": block_new, "test2": block_test2}}
def test_parse_invalid_path(args):
def test_parse_invalid_path():
assert pmb.parse.apkindex.parse("/invalid/path/APKINDEX") == {}
@ -203,12 +203,12 @@ def test_parse_cached(args, tmpdir):
assert func(path, True) == {}
# Delete the cache (run twice for both code paths)
assert pmb.parse.apkindex.clear_cache(args, path) is True
assert pmb.parse.apkindex.clear_cache(path) is True
assert pmb.helpers.other.cache["apkindex"] == {}
assert pmb.parse.apkindex.clear_cache(args, path) is False
assert pmb.parse.apkindex.clear_cache(path) is False
def test_parse(args):
def test_parse():
path = pmb.config.pmb_src + "/test/testdata/apkindex/no_error"
block_musl = {'arch': 'x86_64',
'depends': [],
@ -247,7 +247,7 @@ def test_parse(args):
)
def test_parse_virtual(args):
def test_parse_virtual():
"""
This APKINDEX contains a virtual package .pbmootstrap. It must not be part
of the output.
@ -290,7 +290,7 @@ def test_providers_highest_version(args, monkeypatch):
which order the APKINDEX files are processed.
"""
# Fake parse function
def return_fake_parse(args, path):
def return_fake_parse(path):
version_mapping = {"i0": "2", "i1": "3", "i2": "1"}
package_block = {"pkgname": "test", "version": version_mapping[path]}
return {"test": {"test": package_block}}

View file

@ -104,7 +104,7 @@ def setup_work(args, tmpdir):
"/_pmbootstrap.cfg"])
def verify_pkgrels(args, tmpdir, pkgrel_testlib, pkgrel_testapp,
def verify_pkgrels(tmpdir, pkgrel_testlib, pkgrel_testapp,
pkgrel_testsubpkg):
"""
Verify the pkgrels of the three test APKBUILDs ("testlib", "testapp",
@ -131,14 +131,14 @@ def test_pkgrel_bump_high_level(args, tmpdir):
# Let pkgrel_bump exit normally
pmbootstrap(args, tmpdir, ["build", "testlib", "testapp", "testsubpkg"])
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--dry", "--auto"])
verify_pkgrels(args, tmpdir, 0, 0, 0)
verify_pkgrels(tmpdir, 0, 0, 0)
# Increase soname (testlib soname changes with the pkgrel)
pmbootstrap(args, tmpdir, ["pkgrel_bump", "testlib"])
verify_pkgrels(args, tmpdir, 1, 0, 0)
verify_pkgrels(tmpdir, 1, 0, 0)
pmbootstrap(args, tmpdir, ["build", "testlib"])
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--dry", "--auto"])
verify_pkgrels(args, tmpdir, 1, 0, 0)
verify_pkgrels(tmpdir, 1, 0, 0)
# Delete package with previous soname (--auto-dry exits with >0 now)
channel = pmb.config.pmaports.read_config(args)["channel"]
@ -147,21 +147,21 @@ def test_pkgrel_bump_high_level(args, tmpdir):
pmb.helpers.run.root(args, ["rm", apk_path])
pmbootstrap(args, tmpdir, ["index"])
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--dry", "--auto"], False)
verify_pkgrels(args, tmpdir, 1, 0, 0)
verify_pkgrels(tmpdir, 1, 0, 0)
# Bump pkgrel and build testapp/testsubpkg
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--auto"])
verify_pkgrels(args, tmpdir, 1, 1, 1)
verify_pkgrels(tmpdir, 1, 1, 1)
pmbootstrap(args, tmpdir, ["build", "testapp", "testsubpkg"])
# After rebuilding, pkgrel_bump --auto-dry exits with 0
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--dry", "--auto"])
verify_pkgrels(args, tmpdir, 1, 1, 1)
verify_pkgrels(tmpdir, 1, 1, 1)
# Test running with specific package names
pmbootstrap(args, tmpdir, ["pkgrel_bump", "invalid_package_name"], False)
pmbootstrap(args, tmpdir, ["pkgrel_bump", "--dry", "testlib"], False)
verify_pkgrels(args, tmpdir, 1, 1, 1)
verify_pkgrels(tmpdir, 1, 1, 1)
# Clean up
pmbootstrap(args, tmpdir, ["shutdown"])