Skip to content

Commit

Permalink
feat: adapt autobuild4 changes ...
Browse files Browse the repository at this point in the history
... write .srcinfo.json to file
  • Loading branch information
eatradish committed Aug 10, 2024
1 parent c0f12fe commit f6adac3
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions acbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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'
Expand Down Expand Up @@ -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.')
Expand Down

0 comments on commit f6adac3

Please sign in to comment.