Skip to content

Commit

Permalink
Merge pull request #232 from grml/zeha/build-skip-sources-upload
Browse files Browse the repository at this point in the history
build-driver: handle sources before upload_daily
  • Loading branch information
zeha authored Dec 19, 2024
2 parents 406925e + 47f34ea commit 6f57fe1
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions build-driver/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ def build(
old_dpkg_list_last_release: Path | None,
job_properties: JobProperties,
grml_live_path: Path,
upload_to_daily: bool,
old_iso_path: Path | None,
):
run_grml_live(
Expand Down Expand Up @@ -288,9 +287,6 @@ def build(
job_properties.version,
)

if upload_to_daily:
upload_daily(job_properties.job_name, build_dir, job_properties.job_timestamp)


def load_config(build_config_file: str) -> dict:
with Path(build_config_file).open() as stream:
Expand Down Expand Up @@ -514,24 +510,26 @@ def main(program_name: str, argv: list[str]) -> int:
old_dpkg_list_last_release,
job_properties,
grml_live_path,
upload_to_daily,
old_iso_path,
)

# Copy dpkg.list into cache for next iteration.
new_dpkg_list = get_dpkg_list_path_for_build(build_dir)
old_dpkg_list_previous_build.parent.mkdir(exist_ok=True)
shutil.copyfile(new_dpkg_list, old_dpkg_list_previous_build)

if old_sources_path:
old_sources_path.rename(build_dir / job_properties.sources_name)

# Remove the sources *directory*, to not have the sources twice in the CI artifacts.
grml_sources_directory = build_dir / "grml_sources"
if grml_sources_directory.exists():
print(f"I: Removing {grml_sources_directory}")
shutil.rmtree(grml_sources_directory, ignore_errors=True)

if old_sources_path:
old_sources_path.rename(build_dir / job_properties.sources_name)

if upload_to_daily:
upload_daily(job_properties.job_name, build_dir, job_properties.job_timestamp)

# Copy dpkg.list into cache for next iteration.
new_dpkg_list = get_dpkg_list_path_for_build(build_dir)
old_dpkg_list_previous_build.parent.mkdir(exist_ok=True)
shutil.copyfile(new_dpkg_list, old_dpkg_list_previous_build)

print("I: Success.")

return 0
Expand Down

0 comments on commit 6f57fe1

Please sign in to comment.