Skip to content

Commit

Permalink
feat: add arg --bootstrap-ab-only
Browse files Browse the repository at this point in the history
  • Loading branch information
eatradish committed Aug 9, 2024
1 parent 6f6b174 commit dc19e79
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions acbs-build
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def main() -> None:
parser.add_argument('-z', '--temp-dir', nargs=1, dest='acbs_temp_dir',
help='Override temp directory')
parser.add_argument('--force-use-apt', help="Only use apt to install dependency", action="store_true", dest="force_use_apt")
parser.add_argument('--bootstrap-ab-only', help="Only bootstrap autobuild files", action="store_true", dest="bootstrap_ab_only")


args = parser.parse_args()
if args.acbs_temp_dir:
Expand Down
6 changes: 4 additions & 2 deletions acbs/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ def __init__(self, args) -> None:
self.reorder = args.reorder
self.save_list = args.save_list
self.force_use_apt = args.force_use_apt
self.bootstrap_ab_only = args.bootstrap_ab_only

# static vars
self.autobuild_conf_dir = AUTOBUILD_CONF_DIR
self.conf_dir = CONF_DIR
Expand Down Expand Up @@ -302,7 +304,7 @@ def build_sequential(self, build_timings, packages: List[ACBSPackageInfo]):
source_name = task.name
if task.base_slug:
source_name = os.path.basename(task.base_slug)
if not has_stamp(task.build_location):
if not has_stamp(task.build_location) or not self.bootstrap_ab_only:
fetch_source(task.source_uri, self.dump_dir, source_name)
if self.dl_only:
if self.generate:
Expand Down Expand Up @@ -339,7 +341,7 @@ def build_sequential(self, build_timings, packages: List[ACBSPackageInfo]):
task_name = f'{task.name} ({task.bin_arch} @ {task.epoch + ":" if task.epoch else ""}{task.version}-{task.rel})'
try:
scoped_stage2 = ACBSPackageInfo.is_in_stage2(task.modifiers) | self.stage2
invoke_autobuild(task, build_dir, scoped_stage2)
invoke_autobuild(task, build_dir, scoped_stage2, self.bootstrap_ab_only)
check_artifact(task.name, build_dir)
except Exception:
# early printing of build summary before exploding
Expand Down
14 changes: 11 additions & 3 deletions acbs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,11 @@ def start_build_capture(env: Dict[str, str], build_dir: str):
f.write(footer.encode())
if signal_status or exit_status:
raise RuntimeError('autobuild4 did not exit successfully.')


def start_general_autobuild_metadata(env: Dict[str, str]):
process = pexpect.spawn('autobuild', args=["-p"], env=env, encoding='utf-8')
process.expect(pexpect.EOF)
print(process.before)

def generate_metadata(task: ACBSPackageInfo) -> str:
tree_commit = 'unknown\n'
Expand Down Expand Up @@ -228,7 +232,7 @@ def check_artifact(name: str, build_dir: str):
'STOP! Autobuild3 malfunction detected! Returned zero status with no artifact.')


def invoke_autobuild(task: ACBSPackageInfo, build_dir: str, stage2: bool):
def invoke_autobuild(task: ACBSPackageInfo, build_dir: str, stage2: bool, bootstrap_ab_only: bool):
dst_dir = os.path.join(build_dir, 'autobuild')
if os.path.exists(dst_dir) and task.group_seq > 1:
shutil.rmtree(dst_dir)
Expand All @@ -254,7 +258,11 @@ def invoke_autobuild(task: ACBSPackageInfo, build_dir: str, stage2: bool):
f.write(generate_metadata(task))
os.chdir(build_dir)
if build_logging:
start_build_capture(env_dict, build_dir)
if not bootstrap_ab_only:
start_build_capture(env_dict, build_dir)
else:
start_general_autobuild_metadata(env_dict)
exit(0)
return
logging.warning(
'Build logging not available due to pexpect not installed.')
Expand Down

0 comments on commit dc19e79

Please sign in to comment.