forked from Mirror/pmbootstrap
pmb.build.other: do not copy leftover abuild dirs
Running abuild on the host directly creates directories in the aport where it gets built. Interrupting abuild results in those working-dirs not getting deleted. We don't want to copy those entries to our builder. It's only really noticeable if pmbootstrap tries to copy a broken symlink in src/ and thus fails. Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org> Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20221207205201.22139-1-jane400@bingo-ev.de%3E
This commit is contained in:
parent
9d93d34b65
commit
42feaf0d49
2 changed files with 61 additions and 1 deletions
|
@ -436,3 +436,54 @@ def test_build_local_source_high_level(args, tmpdir):
|
|||
# Clean up: update index, delete temp folder
|
||||
pmb.build.index_repo(args, pmb.config.arch_native)
|
||||
pmb.helpers.run.root(args, ["rm", "-r", tmpdir])
|
||||
|
||||
|
||||
def test_build_abuild_leftovers(args, tmpdir):
|
||||
"""
|
||||
Test building a package with having abuild leftovers, that will error if
|
||||
copied:
|
||||
pmbootstrap build hello-world
|
||||
"""
|
||||
# aports: Add deviceinfo (required by pmbootstrap to start)
|
||||
tmpdir = str(tmpdir)
|
||||
aports = f"{tmpdir}/aports"
|
||||
aport = f"{aports}/device/testing/device-{args.device}"
|
||||
os.makedirs(aport)
|
||||
path_original = pmb.helpers.pmaports.find(args, f"device-{args.device}")
|
||||
shutil.copy(f"{path_original}/deviceinfo", aport)
|
||||
|
||||
# aports: Add modified hello-world aport (source="", uses $builddir)
|
||||
test_aport = "main/hello-world"
|
||||
aport = f"{aports}/{test_aport}"
|
||||
shutil.copytree(f"{args.aports}/{test_aport}", aport)
|
||||
|
||||
# aports: Add pmaports.cfg, .git
|
||||
shutil.copy(f"{args.aports}/pmaports.cfg", aports)
|
||||
shutil.copytree(f"{args.aports}/.git", f"{aports}/.git")
|
||||
|
||||
# aport: create abuild dir with broken symlink
|
||||
src = f"{aport}/src"
|
||||
os.makedirs(src)
|
||||
os.symlink("/var/cache/distfiles/non-existent.tar.gz",
|
||||
f"{src}/broken-tarball-symlink.tar.gz")
|
||||
|
||||
# Delete all hello-world packages
|
||||
channel = pmb.config.pmaports.read_config(args)["channel"]
|
||||
pattern = f"{args.work}/packages/{channel}/*/hello-world-*_p*.apk"
|
||||
for path in glob.glob(pattern):
|
||||
pmb.helpers.run.root(args, ["rm", path])
|
||||
assert len(glob.glob(pattern)) == 0
|
||||
|
||||
# Build hello-world package
|
||||
pmb.helpers.run.user(args, [f"{pmb.config.pmb_src}/pmbootstrap.py",
|
||||
"--aports", aports, "build", "--src", src,
|
||||
"hello-world", "--arch", pmb.config.arch_native])
|
||||
|
||||
# Verify that the package has been built and delete it
|
||||
paths = glob.glob(pattern)
|
||||
assert len(paths) == 1
|
||||
pmb.helpers.run.root(args, ["rm", paths[0]])
|
||||
|
||||
# Clean up: update index, delete temp folder
|
||||
pmb.build.index_repo(args, pmb.config.arch_native)
|
||||
pmb.helpers.run.root(args, ["rm", "-r", tmpdir])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue