From 41631e7650e0101825ccdd68e6438ec3c12500ae Mon Sep 17 00:00:00 2001 From: Chris Hofstaedtler Date: Wed, 18 Dec 2024 17:59:39 +0100 Subject: [PATCH] Revert "build-driver: copy sources.tar in release mode" --- build-driver/build.py | 60 ++++++++++--------------------------------- 1 file changed, 14 insertions(+), 46 deletions(-) diff --git a/build-driver/build.py b/build-driver/build.py index 6003787f..3baa2983 100755 --- a/build-driver/build.py +++ b/build-driver/build.py @@ -30,8 +30,7 @@ class JobProperties: version: str release_name: str grml_name: str - iso_name: str # name of the resulting .ISO files - sources_name: str # name of the resulting sources tarball + isoname: str def usage(program_name): @@ -96,7 +95,7 @@ def run_grml_live( version: str, release_name: str, grml_name: str, - iso_name: str, + isoname: str, old_iso_path: Path | None, ): env = dict(os.environ) @@ -135,7 +134,7 @@ def run_grml_live( "-g", grml_name, "-i", - iso_name, + isoname, "-o", output_dir, ] @@ -224,7 +223,7 @@ def download_file(url: str, local_path: Path): run_x(["curl", "-#fSL", "--output", local_path, url]) -def skip_sources_requested(build_config: dict, env: dict) -> bool: +def should_skip_sources(build_config: dict, env: dict) -> bool: if env.get("SKIP_SOURCES", "") == "1": return True if build_config.get("skip_sources", False) is True: @@ -266,7 +265,7 @@ def build( job_properties.version, job_properties.release_name, job_properties.grml_name, - job_properties.iso_name, + job_properties.isoname, old_iso_path, ) @@ -350,7 +349,10 @@ def download_old_dpkg_list_last_release(tmp_dir: Path, last_release_version: str return None -def download_old_iso(tmp_dir: Path, old_iso_url: str) -> Path | None: +def download_old_iso(tmp_dir: Path, old_iso_url: str | None) -> Path | None: + if old_iso_url is None: + return None + path = tmp_dir / "old.iso" with ci_section(f"Downloading old ISO {old_iso_url} to {path!s}"): @@ -359,22 +361,6 @@ def download_old_iso(tmp_dir: Path, old_iso_url: str) -> Path | None: return path -def download_old_sources(tmp_dir: Path, old_iso_url: str) -> Path | None: - path = tmp_dir / "old-sources.tar" - - # https://.../2024-12-18_10_03_44/grml_isos/grml...iso - # => https://.../2024-12-18_10_03_44/ , _, grml...iso - old_base_url, _, old_iso_name = old_iso_url.rsplit("/", 2) - # grml-something.iso => grml-something-sources.tar - old_sources_name = old_iso_name.rsplit(".", 1)[0] + "-sources.tar" - old_sources_url = f"{old_base_url}/{old_sources_name}" - - with ci_section(f"Downloading old Sources {old_sources_url} to {path!s}"): - download_file(old_sources_url, path) - - return path - - def main(program_name: str, argv: list[str]) -> int: print(f"I: {program_name} started with {argv=}") try: @@ -412,12 +398,8 @@ def main(program_name: str, argv: list[str]) -> int: build_config = load_config(build_config_file) - skip_sources = skip_sources_requested(build_config, dict(os.environ)) - # skip SOURCES in release mode as grml-live would re-download all sources, - # possibly mismatching the versions. Also we do not prepare a working DNS, - # so it would just fail. In the future, grml-live should support reusing - # the sources tarball and fetching just the necessary differences. - classes = get_grml_live_classes(arch, flavor, classes_for_mode, skip_sources or build_mode == "release") + skip_sources = should_skip_sources(build_config, dict(os.environ)) + classes = get_grml_live_classes(arch, flavor, classes_for_mode, skip_sources) build_grml_name = f"grml-{flavor}-{arch}" last_release_version = build_config["last_release"] @@ -432,7 +414,6 @@ def main(program_name: str, argv: list[str]) -> int: if build_mode == "release": old_iso_url = build_config["base_iso"][flavor][arch] build_version = build_config["release_version"] - artifact_basename = f"grml-{flavor}-{build_version}-{arch}" job_properties = JobProperties( job_timestamp=datetime.datetime.now(), @@ -446,8 +427,7 @@ def main(program_name: str, argv: list[str]) -> int: # f.e. "Glumpad Grumbirn" release_name=build_config["release_name"], grml_name=build_grml_name, - iso_name=f"{artifact_basename}.iso", - sources_name=f"{artifact_basename}-sources.tar", + isoname=f"grml-{flavor}-{build_version}-{arch}.iso", ) elif build_mode == "daily": @@ -456,7 +436,6 @@ def main(program_name: str, argv: list[str]) -> int: CI_PIPELINE_IID = os.getenv("CI_PIPELINE_IID", "0") build_version = f"d{date_stamp}b{CI_PIPELINE_IID}" build_release_name = f"daily{date_stamp}build{CI_PIPELINE_IID}{debian_suite}" - artifact_basename = f"grml-{flavor}-{build_release_name}-{arch}" job_properties = JobProperties( job_timestamp=datetime.datetime.now(), @@ -467,8 +446,7 @@ def main(program_name: str, argv: list[str]) -> int: version=build_version, release_name=build_release_name, grml_name=build_grml_name, - iso_name=f"{artifact_basename}.iso", - sources_name=f"{artifact_basename}-sources.tar", + isoname=f"grml-{flavor}-{build_release_name}-{arch}.iso", ) else: @@ -496,14 +474,7 @@ def main(program_name: str, argv: list[str]) -> int: old_dpkg_list_previous_build = cache_dir / "dpkg.list" old_dpkg_list_last_release = download_old_dpkg_list_last_release(tmp_dir, last_release_version, flavor) - if old_iso_url is None: - old_iso_path = None - else: - old_iso_path = download_old_iso(tmp_dir, old_iso_url) - if skip_sources or old_iso_url is None: - old_sources_path = None - else: - old_sources_path = download_old_sources(tmp_dir, old_iso_url) + old_iso_path = download_old_iso(tmp_dir, old_iso_url) with results_mover(build_dir, output_dir): build( @@ -521,9 +492,6 @@ def main(program_name: str, argv: list[str]) -> int: 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) - print("I: Success.") return 0