diff --git a/packages/bzip2/pkgbuild.py b/packages/bzip2/pkgbuild.py index 5fd7bd5..606973c 100644 --- a/packages/bzip2/pkgbuild.py +++ b/packages/bzip2/pkgbuild.py @@ -20,7 +20,7 @@ def build(): shutil.rmtree("../cpp_install") except Exception: pass - cpp.make_install(["PREFIX=../cpp_install" + makevars], chdir=False) + cpp.make_install(["PREFIX=../cpp_install"] + makevars, chdir=False) shutil.copy2( f"libbz2.so.{upstream_version}", f"../cpp_install/lib/libbz2.so.{upstream_version}", diff --git a/x.py b/x.py index ff3a37a..3484849 100644 --- a/x.py +++ b/x.py @@ -29,6 +29,7 @@ parser_build.add_argument("BUILD_PKGNAME") parser_clean = subparsers.add_parser("clean") parser_clean.add_argument("CLEAN_PKGNAME", nargs="*") parser_clean.add_argument("--all", action="store_true") +parser_clean.add_argument("--no-artifacts", action="store_true") parser_list = subparsers.add_parser("list") parser_list.add_argument("ITEM", choices=("all", "built", "new")) parser_repo_push = subparsers.add_parser("repo-push") @@ -132,10 +133,21 @@ def cmd_build_package(package: str): def cmd_clean_package(package: list[str]): for i in package: - try: - shutil.rmtree(f"packages/{i}/target") - except Exception: - pass + targetdir = f"packages/{i}/target" + if not os.path.exists(targetdir): + continue + if args.no_artifacts: + for file in os.listdir(targetdir): + path = f"{targetdir}/{file}" + if file.endswith(".pkg") or file == "build-ok.tag": + continue + if os.path.isfile(path) or os.path.islink(path): + os.remove(path) + else: + shutil.rmtree(path) + + else: + shutil.rmtree(targetdir) def do_list(item: str): @@ -204,6 +216,10 @@ def cmd_build_atom(pkgname: str): except Exception: pass + # Build success + with open(f"{target_dir}/build-ok.tag", "wt+") as file: + file.write("OK") + def cmd_repo_push(repo_dir: str, pkgname: list[str]): for pkg in pkgname: