forked from Mirror/pmbootstrap
remove unused args argument (MR 2130)
This commit is contained in:
parent
896879e89a
commit
a8d425554c
17 changed files with 49 additions and 56 deletions
|
@ -24,7 +24,7 @@ def main():
|
||||||
os.umask(0o22)
|
os.umask(0o22)
|
||||||
|
|
||||||
# Sanity checks
|
# Sanity checks
|
||||||
other.check_grsec(args)
|
other.check_grsec()
|
||||||
if not args.as_root and os.geteuid() == 0:
|
if not args.as_root and os.geteuid() == 0:
|
||||||
raise RuntimeError("Do not run pmbootstrap as root!")
|
raise RuntimeError("Do not run pmbootstrap as root!")
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ import pmb.helpers.pmaports
|
||||||
import pmb.parse
|
import pmb.parse
|
||||||
|
|
||||||
|
|
||||||
def match_kbuild_out(args, word):
|
def match_kbuild_out(word):
|
||||||
"""
|
"""
|
||||||
Look for paths in the following formats:
|
Look for paths in the following formats:
|
||||||
"<prefix>/<kbuild_out>/arch/<arch>/boot"
|
"<prefix>/<kbuild_out>/arch/<arch>/boot"
|
||||||
|
@ -47,7 +47,7 @@ def match_kbuild_out(args, word):
|
||||||
return "" if out_dir is None else out_dir.strip("/")
|
return "" if out_dir is None else out_dir.strip("/")
|
||||||
|
|
||||||
|
|
||||||
def find_kbuild_output_dir(args, function_body):
|
def find_kbuild_output_dir(function_body):
|
||||||
"""
|
"""
|
||||||
Guess what the kernel build output directory is. Parses each line of the
|
Guess what the kernel build output directory is. Parses each line of the
|
||||||
function word by word, looking for paths which contain the kbuild output
|
function word by word, looking for paths which contain the kbuild output
|
||||||
|
@ -61,7 +61,7 @@ def find_kbuild_output_dir(args, function_body):
|
||||||
guesses = []
|
guesses = []
|
||||||
for line in function_body:
|
for line in function_body:
|
||||||
for item in line.split():
|
for item in line.split():
|
||||||
kbuild_out = match_kbuild_out(args, item)
|
kbuild_out = match_kbuild_out(item)
|
||||||
if kbuild_out is not None:
|
if kbuild_out is not None:
|
||||||
guesses.append(kbuild_out)
|
guesses.append(kbuild_out)
|
||||||
break
|
break
|
||||||
|
@ -176,7 +176,7 @@ def package_kernel(args):
|
||||||
kbuild_out = apkbuild["_outdir"]
|
kbuild_out = apkbuild["_outdir"]
|
||||||
else:
|
else:
|
||||||
function_body = pmb.parse.function_body(aport + "/APKBUILD", "package")
|
function_body = pmb.parse.function_body(aport + "/APKBUILD", "package")
|
||||||
kbuild_out = find_kbuild_output_dir(args, function_body)
|
kbuild_out = find_kbuild_output_dir(function_body)
|
||||||
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch)
|
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch)
|
||||||
|
|
||||||
# Install package dependencies
|
# Install package dependencies
|
||||||
|
|
|
@ -14,7 +14,7 @@ import pmb.helpers.run
|
||||||
import pmb.parse
|
import pmb.parse
|
||||||
|
|
||||||
|
|
||||||
def get_arch(args, apkbuild):
|
def get_arch(apkbuild):
|
||||||
"""
|
"""
|
||||||
Take the architecture from the APKBUILD or complain if it's ambiguous. This
|
Take the architecture from the APKBUILD or complain if it's ambiguous. This
|
||||||
function only gets called if --arch is not set.
|
function only gets called if --arch is not set.
|
||||||
|
@ -90,7 +90,7 @@ def menuconfig(args, pkgname, use_oldconfig):
|
||||||
# Read apkbuild
|
# Read apkbuild
|
||||||
aport = pmb.helpers.pmaports.find(args, pkgname)
|
aport = pmb.helpers.pmaports.find(args, pkgname)
|
||||||
apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
|
apkbuild = pmb.parse.apkbuild(args, aport + "/APKBUILD")
|
||||||
arch = args.arch or get_arch(args, apkbuild)
|
arch = args.arch or get_arch(apkbuild)
|
||||||
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch)
|
suffix = pmb.build.autodetect.suffix(args, apkbuild, arch)
|
||||||
cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix)
|
cross = pmb.build.autodetect.crosscompile(args, apkbuild, arch, suffix)
|
||||||
hostspec = pmb.parse.arch.alpine_to_hostspec(arch)
|
hostspec = pmb.parse.arch.alpine_to_hostspec(arch)
|
||||||
|
|
|
@ -33,7 +33,7 @@ def register(args, arch):
|
||||||
if is_registered(arch_qemu):
|
if is_registered(arch_qemu):
|
||||||
return
|
return
|
||||||
|
|
||||||
info = pmb.parse.binfmt_info(args, arch_qemu)
|
info = pmb.parse.binfmt_info(arch_qemu)
|
||||||
|
|
||||||
# Build registration string
|
# Build registration string
|
||||||
# https://en.wikipedia.org/wiki/Binfmt_misc
|
# https://en.wikipedia.org/wiki/Binfmt_misc
|
||||||
|
|
|
@ -106,7 +106,7 @@ def zap_pkgs_local_mismatch(args, confirm=True, dry=False):
|
||||||
pattern = f"{args.work}/packages/{channel}/*/APKINDEX.tar.gz"
|
pattern = f"{args.work}/packages/{channel}/*/APKINDEX.tar.gz"
|
||||||
for apkindex_path in glob.glob(pattern):
|
for apkindex_path in glob.glob(pattern):
|
||||||
# Delete packages without same version in aports
|
# Delete packages without same version in aports
|
||||||
blocks = pmb.parse.apkindex.parse_blocks(args, apkindex_path)
|
blocks = pmb.parse.apkindex.parse_blocks(apkindex_path)
|
||||||
for block in blocks:
|
for block in blocks:
|
||||||
pkgname = block["pkgname"]
|
pkgname = block["pkgname"]
|
||||||
origin = block["origin"]
|
origin = block["origin"]
|
||||||
|
|
|
@ -368,7 +368,7 @@ def kconfig(args):
|
||||||
if args.action_kconfig == "check":
|
if args.action_kconfig == "check":
|
||||||
# Handle passing a file directly
|
# Handle passing a file directly
|
||||||
if args.file:
|
if args.file:
|
||||||
if pmb.parse.kconfig.check_file(args, args.package,
|
if pmb.parse.kconfig.check_file(args.package,
|
||||||
anbox=args.anbox,
|
anbox=args.anbox,
|
||||||
nftables=args.nftables,
|
nftables=args.nftables,
|
||||||
containers=args.containers,
|
containers=args.containers,
|
||||||
|
|
|
@ -229,7 +229,7 @@ def pull(args, name_repo):
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def is_outdated(args, path):
|
def is_outdated(path):
|
||||||
# FETCH_HEAD always exists in repositories cloned by pmbootstrap.
|
# FETCH_HEAD always exists in repositories cloned by pmbootstrap.
|
||||||
# Usually it does not (before first git fetch/pull), but there is no good
|
# 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-
|
# fallback. For exampe, getting the _creation_ date of .git/HEAD is non-
|
||||||
|
|
|
@ -29,7 +29,7 @@ def folder_size(args, path):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def check_grsec(args):
|
def check_grsec():
|
||||||
"""
|
"""
|
||||||
Check if the current kernel is based on the grsec patchset, and if
|
Check if the current kernel is based on the grsec patchset, and if
|
||||||
the chroot_deny_chmod option is enabled. Raise an exception in that
|
the chroot_deny_chmod option is enabled. Raise an exception in that
|
||||||
|
|
|
@ -92,7 +92,7 @@ def print_checks_git_repo(args, repo, details=True):
|
||||||
log_ok("up to date with remote branch")
|
log_ok("up to date with remote branch")
|
||||||
|
|
||||||
# Outdated remote information
|
# Outdated remote information
|
||||||
if pmb.helpers.git.is_outdated(args, path):
|
if pmb.helpers.git.is_outdated(path):
|
||||||
return log_nok_ret(-5, "outdated remote information",
|
return log_nok_ret(-5, "outdated remote information",
|
||||||
"update with 'pmbootstrap pull'")
|
"update with 'pmbootstrap pull'")
|
||||||
log_ok("remote information updated recently (via git fetch/pull)")
|
log_ok("remote information updated recently (via git fetch/pull)")
|
||||||
|
|
|
@ -9,7 +9,7 @@ import pmb.helpers.repo
|
||||||
import pmb.parse.version
|
import pmb.parse.version
|
||||||
|
|
||||||
|
|
||||||
def parse_next_block(args, path, lines, start):
|
def parse_next_block(path, lines, start):
|
||||||
"""
|
"""
|
||||||
Parse the next block in an APKINDEX.
|
Parse the next block in an APKINDEX.
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ def parse(args, path, multiple_providers=True):
|
||||||
ret = collections.OrderedDict()
|
ret = collections.OrderedDict()
|
||||||
start = [0]
|
start = [0]
|
||||||
while True:
|
while True:
|
||||||
block = parse_next_block(args, path, lines, start)
|
block = parse_next_block(path, lines, start)
|
||||||
if not block:
|
if not block:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ def parse(args, path, multiple_providers=True):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
def parse_blocks(args, path):
|
def parse_blocks(path):
|
||||||
"""
|
"""
|
||||||
Read all blocks from an APKINDEX.tar.gz into a list.
|
Read all blocks from an APKINDEX.tar.gz into a list.
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ def parse_blocks(args, path):
|
||||||
ret = []
|
ret = []
|
||||||
start = [0]
|
start = [0]
|
||||||
while True:
|
while True:
|
||||||
block = pmb.parse.apkindex.parse_next_block(args, path, lines, start)
|
block = pmb.parse.apkindex.parse_next_block(path, lines, start)
|
||||||
if not block:
|
if not block:
|
||||||
return ret
|
return ret
|
||||||
ret.append(block)
|
ret.append(block)
|
||||||
|
|
|
@ -7,7 +7,7 @@ import pmb.config
|
||||||
# Return: {magic: ..., mask: ...}
|
# Return: {magic: ..., mask: ...}
|
||||||
|
|
||||||
|
|
||||||
def binfmt_info(args, arch_qemu):
|
def binfmt_info(arch_qemu):
|
||||||
# Parse the info file
|
# Parse the info file
|
||||||
full = {}
|
full = {}
|
||||||
info = pmb.config.pmb_src + "/pmb/data/qemu-user-binfmt.txt"
|
info = pmb.config.pmb_src + "/pmb/data/qemu-user-binfmt.txt"
|
||||||
|
|
|
@ -198,7 +198,7 @@ def extract_version(config_file):
|
||||||
return "unknown"
|
return "unknown"
|
||||||
|
|
||||||
|
|
||||||
def check_file(args, config_file, anbox=False, nftables=False,
|
def check_file(config_file, anbox=False, nftables=False,
|
||||||
containers=False, zram=False, details=False):
|
containers=False, zram=False, details=False):
|
||||||
"""
|
"""
|
||||||
Check for necessary kernel config options in a kconfig file.
|
Check for necessary kernel config options in a kconfig file.
|
||||||
|
|
|
@ -32,13 +32,12 @@ def test_package_kernel_args(args):
|
||||||
str(e.value)
|
str(e.value)
|
||||||
|
|
||||||
|
|
||||||
def test_find_kbuild_output_dir(args):
|
def test_find_kbuild_output_dir():
|
||||||
# Test parsing an APKBUILD
|
# Test parsing an APKBUILD
|
||||||
pkgname = "linux-envkernel-test"
|
pkgname = "linux-envkernel-test"
|
||||||
path = pmb_test.const.testdata + "/apkbuild/APKBUILD." + pkgname
|
path = pmb_test.const.testdata + "/apkbuild/APKBUILD." + pkgname
|
||||||
function_body = pmb.parse.function_body(path, "package")
|
function_body = pmb.parse.function_body(path, "package")
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert kbuild_out == "build"
|
assert kbuild_out == "build"
|
||||||
|
|
||||||
# Test full function body
|
# Test full function body
|
||||||
|
@ -59,8 +58,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" KBUILD_BUILD_VERSION=\"$((pkgrel + 1))-Alpine\" ",
|
" KBUILD_BUILD_VERSION=\"$((pkgrel + 1))-Alpine\" ",
|
||||||
" INSTALL_MOD_PATH=\"$pkgdir\" modules_install",
|
" INSTALL_MOD_PATH=\"$pkgdir\" modules_install",
|
||||||
]
|
]
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert kbuild_out == "build"
|
assert kbuild_out == "build"
|
||||||
|
|
||||||
# Test no kbuild out dir
|
# Test no kbuild out dir
|
||||||
|
@ -70,8 +68,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" install -D \"$srcdir\"/include/config/kernel.release ",
|
" install -D \"$srcdir\"/include/config/kernel.release ",
|
||||||
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
||||||
]
|
]
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert kbuild_out == ""
|
assert kbuild_out == ""
|
||||||
|
|
||||||
# Test curly brackets around srcdir
|
# Test curly brackets around srcdir
|
||||||
|
@ -81,8 +78,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" install -D \"${srcdir}\"/build/include/config/kernel.release ",
|
" install -D \"${srcdir}\"/build/include/config/kernel.release ",
|
||||||
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
||||||
]
|
]
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert kbuild_out == "build"
|
assert kbuild_out == "build"
|
||||||
|
|
||||||
# Test multiple sub directories
|
# Test multiple sub directories
|
||||||
|
@ -92,8 +88,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" install -D \"${srcdir}\"/sub/dir/include/config/kernel.release ",
|
" install -D \"${srcdir}\"/sub/dir/include/config/kernel.release ",
|
||||||
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
||||||
]
|
]
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert kbuild_out == "sub/dir"
|
assert kbuild_out == "sub/dir"
|
||||||
|
|
||||||
# Test no kbuild out dir found
|
# Test no kbuild out dir found
|
||||||
|
@ -104,8 +99,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
||||||
]
|
]
|
||||||
with pytest.raises(RuntimeError) as e:
|
with pytest.raises(RuntimeError) as e:
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert ("Couldn't find a kbuild out directory. Is your APKBUILD messed up?"
|
assert ("Couldn't find a kbuild out directory. Is your APKBUILD messed up?"
|
||||||
" If not, then consider adjusting the patterns in "
|
" If not, then consider adjusting the patterns in "
|
||||||
"pmb/build/envkernel.py to work with your APKBUILD, or submit an "
|
"pmb/build/envkernel.py to work with your APKBUILD, or submit an "
|
||||||
|
@ -119,8 +113,7 @@ def test_find_kbuild_output_dir(args):
|
||||||
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
" \"$pkgdir\"/usr/share/kernel/$_flavor/kernel.release",
|
||||||
]
|
]
|
||||||
with pytest.raises(RuntimeError) as e:
|
with pytest.raises(RuntimeError) as e:
|
||||||
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(args,
|
kbuild_out = pmb.build.envkernel.find_kbuild_output_dir(function_body)
|
||||||
function_body)
|
|
||||||
assert ("Multiple kbuild out directories found. Can you modify your "
|
assert ("Multiple kbuild out directories found. Can you modify your "
|
||||||
"APKBUILD so it only has one output path? If you can't resolve it,"
|
"APKBUILD so it only has one output path? If you can't resolve it,"
|
||||||
" please open an issue.") in str(e.value)
|
" please open an issue.") in str(e.value)
|
||||||
|
|
|
@ -168,7 +168,7 @@ def test_pull(args, monkeypatch, tmpdir):
|
||||||
assert func(args, name_repo) == 0
|
assert func(args, name_repo) == 0
|
||||||
|
|
||||||
|
|
||||||
def test_is_outdated(args, tmpdir, monkeypatch):
|
def test_is_outdated(tmpdir, monkeypatch):
|
||||||
func = pmb.helpers.git.is_outdated
|
func = pmb.helpers.git.is_outdated
|
||||||
|
|
||||||
# Override time.time(): now is "100"
|
# Override time.time(): now is "100"
|
||||||
|
@ -187,8 +187,8 @@ def test_is_outdated(args, tmpdir, monkeypatch):
|
||||||
|
|
||||||
# Outdated (date_outdated: 90)
|
# Outdated (date_outdated: 90)
|
||||||
monkeypatch.setattr(pmb.config, "git_repo_outdated", 10)
|
monkeypatch.setattr(pmb.config, "git_repo_outdated", 10)
|
||||||
assert func(args, path) is True
|
assert func(path) is True
|
||||||
|
|
||||||
# Not outdated (date_outdated: 89)
|
# Not outdated (date_outdated: 89)
|
||||||
monkeypatch.setattr(pmb.config, "git_repo_outdated", 11)
|
monkeypatch.setattr(pmb.config, "git_repo_outdated", 11)
|
||||||
assert func(args, path) is False
|
assert func(path) is False
|
||||||
|
|
|
@ -85,7 +85,7 @@ def test_print_checks_git_repo(args, monkeypatch, tmpdir):
|
||||||
assert status == 0
|
assert status == 0
|
||||||
|
|
||||||
# Outdated remote information
|
# Outdated remote information
|
||||||
def is_outdated(args, path):
|
def is_outdated(path):
|
||||||
return True
|
return True
|
||||||
monkeypatch.setattr(pmb.helpers.git, "is_outdated", is_outdated)
|
monkeypatch.setattr(pmb.helpers.git, "is_outdated", is_outdated)
|
||||||
status, _ = func(args, name_repo)
|
status, _ = func(args, name_repo)
|
||||||
|
|
|
@ -23,20 +23,20 @@ def args(tmpdir, request):
|
||||||
def test_kconfig_check(args):
|
def test_kconfig_check(args):
|
||||||
# basic checks, from easiers to hard-ish
|
# basic checks, from easiers to hard-ish
|
||||||
dir = f"{pmb_test.const.testdata}/kconfig_check/"
|
dir = f"{pmb_test.const.testdata}/kconfig_check/"
|
||||||
assert not pmb.parse.kconfig.check_file(args, dir +
|
assert not pmb.parse.kconfig.check_file(dir +
|
||||||
"bad-missing-required-option")
|
"bad-missing-required-option")
|
||||||
assert pmb.parse.kconfig.check_file(args, dir + "good")
|
assert pmb.parse.kconfig.check_file(dir + "good")
|
||||||
assert not pmb.parse.kconfig.check_file(args, dir + "bad-wrong-option-set")
|
assert not pmb.parse.kconfig.check_file(dir + "bad-wrong-option-set")
|
||||||
assert pmb.parse.kconfig.check_file(args, dir + "good-anbox",
|
assert pmb.parse.kconfig.check_file(dir + "good-anbox",
|
||||||
anbox=True)
|
anbox=True)
|
||||||
assert not pmb.parse.kconfig.check_file(args, dir +
|
assert not pmb.parse.kconfig.check_file(dir +
|
||||||
"bad-array-missing-some-options",
|
"bad-array-missing-some-options",
|
||||||
anbox=True)
|
anbox=True)
|
||||||
assert pmb.parse.kconfig.check_file(args, dir + "good-nftables",
|
assert pmb.parse.kconfig.check_file(dir + "good-nftables",
|
||||||
nftables=True)
|
nftables=True)
|
||||||
assert not pmb.parse.kconfig.check_file(args, dir + "bad-nftables",
|
assert not pmb.parse.kconfig.check_file(dir + "bad-nftables",
|
||||||
nftables=True)
|
nftables=True)
|
||||||
assert pmb.parse.kconfig.check_file(args, dir + "good-zram",
|
assert pmb.parse.kconfig.check_file(dir + "good-zram",
|
||||||
zram=True)
|
zram=True)
|
||||||
|
|
||||||
# tests on real devices
|
# tests on real devices
|
||||||
|
|
|
@ -23,7 +23,7 @@ def args(tmpdir, request):
|
||||||
return args
|
return args
|
||||||
|
|
||||||
|
|
||||||
def test_parse_next_block_exceptions(args):
|
def test_parse_next_block_exceptions():
|
||||||
# Mapping of input files (inside the /test/testdata/apkindex) to
|
# Mapping of input files (inside the /test/testdata/apkindex) to
|
||||||
# error message substrings
|
# error message substrings
|
||||||
mapping = {"key_twice": "specified twice",
|
mapping = {"key_twice": "specified twice",
|
||||||
|
@ -37,11 +37,11 @@ def test_parse_next_block_exceptions(args):
|
||||||
lines = handle.readlines()
|
lines = handle.readlines()
|
||||||
|
|
||||||
with pytest.raises(RuntimeError) as e:
|
with pytest.raises(RuntimeError) as e:
|
||||||
pmb.parse.apkindex.parse_next_block(args, path, lines, [0])
|
pmb.parse.apkindex.parse_next_block(path, lines, [0])
|
||||||
assert error_substr in str(e.value)
|
assert error_substr in str(e.value)
|
||||||
|
|
||||||
|
|
||||||
def test_parse_next_block_no_error(args):
|
def test_parse_next_block_no_error():
|
||||||
# Read the file
|
# Read the file
|
||||||
func = pmb.parse.apkindex.parse_next_block
|
func = pmb.parse.apkindex.parse_next_block
|
||||||
path = pmb.config.pmb_src + "/test/testdata/apkindex/no_error"
|
path = pmb.config.pmb_src + "/test/testdata/apkindex/no_error"
|
||||||
|
@ -57,7 +57,7 @@ def test_parse_next_block_no_error(args):
|
||||||
'provides': ['so:libc.musl-x86_64.so.1'],
|
'provides': ['so:libc.musl-x86_64.so.1'],
|
||||||
'timestamp': '1515217616',
|
'timestamp': '1515217616',
|
||||||
'version': '1.1.18-r5'}
|
'version': '1.1.18-r5'}
|
||||||
assert func(args, path, lines, start) == block
|
assert func(path, lines, start) == block
|
||||||
assert start == [24]
|
assert start == [24]
|
||||||
|
|
||||||
# Second block
|
# Second block
|
||||||
|
@ -71,15 +71,15 @@ def test_parse_next_block_no_error(args):
|
||||||
'provides': ['cmd:curl'],
|
'provides': ['cmd:curl'],
|
||||||
'timestamp': '1512030418',
|
'timestamp': '1512030418',
|
||||||
'version': '7.57.0-r0'}
|
'version': '7.57.0-r0'}
|
||||||
assert func(args, path, lines, start) == block
|
assert func(path, lines, start) == block
|
||||||
assert start == [45]
|
assert start == [45]
|
||||||
|
|
||||||
# No more blocks
|
# No more blocks
|
||||||
assert func(args, path, lines, start) is None
|
assert func(path, lines, start) is None
|
||||||
assert start == [45]
|
assert start == [45]
|
||||||
|
|
||||||
|
|
||||||
def test_parse_next_block_virtual(args):
|
def test_parse_next_block_virtual():
|
||||||
"""
|
"""
|
||||||
Test parsing a virtual package from an APKINDEX.
|
Test parsing a virtual package from an APKINDEX.
|
||||||
"""
|
"""
|
||||||
|
@ -98,7 +98,7 @@ def test_parse_next_block_virtual(args):
|
||||||
'provides': ['cmd:hello-world'],
|
'provides': ['cmd:hello-world'],
|
||||||
'timestamp': '1500000000',
|
'timestamp': '1500000000',
|
||||||
'version': '2-r0'}
|
'version': '2-r0'}
|
||||||
assert func(args, path, lines, start) == block
|
assert func(path, lines, start) == block
|
||||||
assert start == [20]
|
assert start == [20]
|
||||||
|
|
||||||
# Second block: virtual package
|
# Second block: virtual package
|
||||||
|
@ -107,11 +107,11 @@ def test_parse_next_block_virtual(args):
|
||||||
'pkgname': '.pmbootstrap',
|
'pkgname': '.pmbootstrap',
|
||||||
'provides': [],
|
'provides': [],
|
||||||
'version': '0'}
|
'version': '0'}
|
||||||
assert func(args, path, lines, start) == block
|
assert func(path, lines, start) == block
|
||||||
assert start == [31]
|
assert start == [31]
|
||||||
|
|
||||||
# No more blocks
|
# No more blocks
|
||||||
assert func(args, path, lines, start) is None
|
assert func(path, lines, start) is None
|
||||||
assert start == [31]
|
assert start == [31]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue