pmb.parse.apkindex.parse: remove unused args argument (MR 2136)
This commit is contained in:
parent
99bed38272
commit
379991aa62
|
@ -261,4 +261,4 @@ def installed(args, suffix="native"):
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
path = f"{args.work}/chroot_{suffix}/lib/apk/db/installed"
|
path = f"{args.work}/chroot_{suffix}/lib/apk/db/installed"
|
||||||
return pmb.parse.apkindex.parse(args, path, False)
|
return pmb.parse.apkindex.parse(path, False)
|
||||||
|
|
|
@ -458,7 +458,7 @@ def apkbuild_parse(args):
|
||||||
|
|
||||||
|
|
||||||
def apkindex_parse(args):
|
def apkindex_parse(args):
|
||||||
result = pmb.parse.apkindex.parse(args, args.apkindex_path)
|
result = pmb.parse.apkindex.parse(args.apkindex_path)
|
||||||
if args.package:
|
if args.package:
|
||||||
if args.package not in result:
|
if args.package not in result:
|
||||||
raise RuntimeError("Package not found in the APKINDEX: " +
|
raise RuntimeError("Package not found in the APKINDEX: " +
|
||||||
|
|
|
@ -107,7 +107,7 @@ def auto(args, dry=False):
|
||||||
paths = pmb.helpers.repo.apkindex_files(args, arch, alpine=False)
|
paths = pmb.helpers.repo.apkindex_files(args, arch, alpine=False)
|
||||||
for path in paths:
|
for path in paths:
|
||||||
logging.info("scan " + path)
|
logging.info("scan " + path)
|
||||||
index = pmb.parse.apkindex.parse(args, path, False)
|
index = pmb.parse.apkindex.parse(path, False)
|
||||||
for pkgname, apk in index.items():
|
for pkgname, apk in index.items():
|
||||||
origin = apk["origin"]
|
origin = apk["origin"]
|
||||||
# Only increase once!
|
# Only increase once!
|
||||||
|
|
|
@ -142,7 +142,7 @@ def parse_add_block(ret, block, alias=None, multiple_providers=True):
|
||||||
ret[alias] = block
|
ret[alias] = block
|
||||||
|
|
||||||
|
|
||||||
def parse(args, path, multiple_providers=True):
|
def parse(path, multiple_providers=True):
|
||||||
"""
|
"""
|
||||||
Parse an APKINDEX.tar.gz file, and return its content as dictionary.
|
Parse an APKINDEX.tar.gz file, and return its content as dictionary.
|
||||||
|
|
||||||
|
@ -293,7 +293,7 @@ def providers(args, package, arch=None, must_exist=True, indexes=None):
|
||||||
ret = collections.OrderedDict()
|
ret = collections.OrderedDict()
|
||||||
for path in indexes:
|
for path in indexes:
|
||||||
# Skip indexes not providing the package
|
# Skip indexes not providing the package
|
||||||
index_packages = parse(args, path)
|
index_packages = parse(path)
|
||||||
if package not in index_packages:
|
if package not in index_packages:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ def test_parse_add_block_multiple_providers(args):
|
||||||
|
|
||||||
|
|
||||||
def test_parse_invalid_path(args):
|
def test_parse_invalid_path(args):
|
||||||
assert pmb.parse.apkindex.parse(args, "/invalid/path/APKINDEX") == {}
|
assert pmb.parse.apkindex.parse("/invalid/path/APKINDEX") == {}
|
||||||
|
|
||||||
|
|
||||||
def test_parse_cached(args, tmpdir):
|
def test_parse_cached(args, tmpdir):
|
||||||
|
@ -195,12 +195,12 @@ def test_parse_cached(args, tmpdir):
|
||||||
|
|
||||||
# Verify cache usage
|
# Verify cache usage
|
||||||
func = pmb.parse.apkindex.parse
|
func = pmb.parse.apkindex.parse
|
||||||
assert func(args, path, True) == "cached_result_multiple"
|
assert func(path, True) == "cached_result_multiple"
|
||||||
assert func(args, path, False) == "cached_result_single"
|
assert func(path, False) == "cached_result_single"
|
||||||
|
|
||||||
# Make cache invalid
|
# Make cache invalid
|
||||||
pmb.helpers.other.cache["apkindex"][path]["lastmod"] -= 10
|
pmb.helpers.other.cache["apkindex"][path]["lastmod"] -= 10
|
||||||
assert func(args, path, True) == {}
|
assert func(path, True) == {}
|
||||||
|
|
||||||
# Delete the cache (run twice for both code paths)
|
# 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(args, path) is True
|
||||||
|
@ -233,7 +233,7 @@ def test_parse(args):
|
||||||
'curl': block_curl,
|
'curl': block_curl,
|
||||||
'musl': block_musl,
|
'musl': block_musl,
|
||||||
'so:libc.musl-x86_64.so.1': block_musl}
|
'so:libc.musl-x86_64.so.1': block_musl}
|
||||||
assert pmb.parse.apkindex.parse(args, path, False) == ret_single
|
assert pmb.parse.apkindex.parse(path, False) == ret_single
|
||||||
assert pmb.helpers.other.cache["apkindex"][path]["single"] == ret_single
|
assert pmb.helpers.other.cache["apkindex"][path]["single"] == ret_single
|
||||||
|
|
||||||
# Test with multiple_providers
|
# Test with multiple_providers
|
||||||
|
@ -241,7 +241,7 @@ def test_parse(args):
|
||||||
'curl': {"curl": block_curl},
|
'curl': {"curl": block_curl},
|
||||||
'musl': {"musl": block_musl},
|
'musl': {"musl": block_musl},
|
||||||
'so:libc.musl-x86_64.so.1': {"musl": block_musl}}
|
'so:libc.musl-x86_64.so.1': {"musl": block_musl}}
|
||||||
assert pmb.parse.apkindex.parse(args, path, True) == ret_multiple
|
assert pmb.parse.apkindex.parse(path, True) == ret_multiple
|
||||||
assert (
|
assert (
|
||||||
pmb.helpers.other.cache["apkindex"][path]["multiple"] == ret_multiple
|
pmb.helpers.other.cache["apkindex"][path]["multiple"] == ret_multiple
|
||||||
)
|
)
|
||||||
|
@ -261,7 +261,7 @@ def test_parse_virtual(args):
|
||||||
'timestamp': '1500000000',
|
'timestamp': '1500000000',
|
||||||
'version': '2-r0'}
|
'version': '2-r0'}
|
||||||
ret = {"hello-world": block, "cmd:hello-world": block}
|
ret = {"hello-world": block, "cmd:hello-world": block}
|
||||||
assert pmb.parse.apkindex.parse(args, path, False) == ret
|
assert pmb.parse.apkindex.parse(path, False) == ret
|
||||||
assert pmb.helpers.other.cache["apkindex"][path]["single"] == ret
|
assert pmb.helpers.other.cache["apkindex"][path]["single"] == ret
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue