From f6adac38bc499a382432ccd056b6e6f42a7bdeff Mon Sep 17 00:00:00 2001 From: eatradish Date: Sat, 10 Aug 2024 21:38:28 +0800 Subject: [PATCH] feat: adapt autobuild4 changes ... ... write .srcinfo.json to file --- acbs/utils.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/acbs/utils.py b/acbs/utils.py index 7dad0f3..a264ed6 100644 --- a/acbs/utils.py +++ b/acbs/utils.py @@ -167,7 +167,8 @@ def start_build_capture(env: Dict[str, str], build_dir: str): if signal_status or exit_status: raise RuntimeError('autobuild4 did not exit successfully.') -def start_general_autobuild_metadata(env: Dict[str, str], script_location: str, package_name: str): +def start_general_autobuild_metadata(env: Dict[str, str], script_location: str, package_name: str, build_dir: str): + env["AB_WRITE_METADATA"] = "1" process = pexpect.spawn('autobuild', args=["-p"], env=env, encoding='utf-8') process.expect(pexpect.EOF) @@ -177,9 +178,8 @@ def start_general_autobuild_metadata(env: Dict[str, str], script_location: str, else: path = os.path.join(script_location, '..', f'.srcinfo-{package_name}.json') - with open(path, 'w') as f: - f.write(process.before) - logging.info(f".srcinfo.json is save to: {path}") + shutil.copyfile(os.path.join(build_dir, '.srcinfo.json'), path) + logging.info(f".srcinfo.json is save to: {path}") def generate_metadata(task: ACBSPackageInfo) -> str: tree_commit = 'unknown\n' @@ -270,7 +270,7 @@ def invoke_autobuild(task: ACBSPackageInfo, build_dir: str, stage2: bool, genera if not generate_pkg_metadata: start_build_capture(env_dict, build_dir) else: - start_general_autobuild_metadata(env_dict, task.script_location, task.name) + start_general_autobuild_metadata(env_dict, task.script_location, task.name, build_dir) return logging.warning( 'Build logging not available due to pexpect not installed.')