forked from Mirror/pmbootstrap
newapkbuild: globbing and Path fixes (MR 2416)
This commit is contained in:
parent
fb6073e835
commit
c3016e02c5
1 changed files with 5 additions and 5 deletions
|
@ -23,7 +23,7 @@ def newapkbuild(folder, args_passed, force=False):
|
||||||
|
|
||||||
# Run newapkbuild
|
# Run newapkbuild
|
||||||
pmb.chroot.user(["newapkbuild"] + args_passed, working_dir=build)
|
pmb.chroot.user(["newapkbuild"] + args_passed, working_dir=build)
|
||||||
glob_result = list(build_outside.glob("/*/APKBUILD"))
|
glob_result = list(build_outside.glob("*/APKBUILD"))
|
||||||
if not len(glob_result):
|
if not len(glob_result):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -33,22 +33,22 @@ def newapkbuild(folder, args_passed, force=False):
|
||||||
target = pkgrepo_default_path() / folder / pkgname
|
target = pkgrepo_default_path() / folder / pkgname
|
||||||
|
|
||||||
# Move /home/pmos/build/$pkgname/* to /home/pmos/build/*
|
# Move /home/pmos/build/$pkgname/* to /home/pmos/build/*
|
||||||
for path in build_outside.glob("/*/*"):
|
for path in build_outside.glob("*/*"):
|
||||||
path_inside = build / pkgname / os.path.basename(path)
|
path_inside = build / pkgname / os.path.basename(path)
|
||||||
pmb.chroot.user(["mv", path_inside, build])
|
pmb.chroot.user(["mv", path_inside, build])
|
||||||
pmb.chroot.user(["rmdir", build / pkgname])
|
pmb.chroot.user(["rmdir", build / pkgname])
|
||||||
|
|
||||||
# Overwrite confirmation
|
# Overwrite confirmation
|
||||||
if os.path.exists(target):
|
if os.path.exists(target):
|
||||||
logging.warning("WARNING: Folder already exists: " + target)
|
logging.warning(f"WARNING: Folder already exists: {target}")
|
||||||
question = "Continue and delete its contents?"
|
question = "Continue and delete its contents?"
|
||||||
if not force and not pmb.helpers.cli.confirm(question):
|
if not force and not pmb.helpers.cli.confirm(question):
|
||||||
raise RuntimeError("Aborted.")
|
raise RuntimeError("Aborted.")
|
||||||
pmb.helpers.run.user(["rm", "-r", target])
|
pmb.helpers.run.user(["rm", "-r", target])
|
||||||
|
|
||||||
# Copy the aport (without the extracted src folder)
|
# Copy the aport (without the extracted src folder)
|
||||||
logging.info("Create " + target)
|
logging.info(f"Create {target}")
|
||||||
pmb.helpers.run.user(["mkdir", "-p", target])
|
pmb.helpers.run.user(["mkdir", "-p", target])
|
||||||
for path in build_outside.glob("/*"):
|
for path in build_outside.glob("*"):
|
||||||
if not path.is_dir():
|
if not path.is_dir():
|
||||||
pmb.helpers.run.user(["cp", path, target])
|
pmb.helpers.run.user(["cp", path, target])
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue