diff options
author | Daniil Baturin <daniil@vyos.io> | 2025-06-10 15:36:23 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-06-10 15:36:23 +0100 |
commit | 7d40712037dffd2652a83ebea0fb6352ad430543 (patch) | |
tree | 719897bb304e81615714a32f0edabb3dc0d426d4 | |
parent | 8f4b588a1d0ca99ab0350deaa1eb13fced98b12e (diff) | |
parent | faa725ae123ec4f153ed99e7e8d6d222c663a898 (diff) | |
download | vyos-build-7d40712037dffd2652a83ebea0fb6352ad430543.tar.gz vyos-build-7d40712037dffd2652a83ebea0fb6352ad430543.zip |
Merge pull request #975 from sever-sever/T7530
T7530: Build package binaries script should exit if repo is absent
-rwxr-xr-x | scripts/package-build/build.py | 5 | ||||
-rwxr-xr-x | scripts/package-build/linux-kernel/build.py | 9 |
2 files changed, 12 insertions, 2 deletions
diff --git a/scripts/package-build/build.py b/scripts/package-build/build.py index 9c1df7b3..2eceea93 100755 --- a/scripts/package-build/build.py +++ b/scripts/package-build/build.py @@ -17,6 +17,7 @@ import glob import shutil +import sys import toml import os @@ -91,7 +92,11 @@ def build_package(package: list, patch_dir: Path) -> None: # Check out the specific commit run(['git', 'checkout', package['commit_id']], cwd=repo_dir, check=True) + except CalledProcessError as e: + print(f"Failed to clone or checkout for package '{repo_name}': {e}") + sys.exit(1) + try: # The `pre_build_hook` is an optional configuration defined in `package.toml`. # It executes after the repository is checked out and before the build process begins. # This hook allows you to perform preparatory tasks, such as creating directories, diff --git a/scripts/package-build/linux-kernel/build.py b/scripts/package-build/linux-kernel/build.py index 6fa6af35..27840a4e 100755 --- a/scripts/package-build/linux-kernel/build.py +++ b/scripts/package-build/linux-kernel/build.py @@ -18,6 +18,7 @@ import datetime import glob import shutil +import sys import toml import os import subprocess @@ -60,8 +61,12 @@ def clone_or_update_repo(repo_dir: Path, scm_url: str, commit_id: str) -> None: run(['git', 'checkout', commit_id], cwd=repo_dir, check=True) #run(['git', 'pull'], cwd=repo_dir, check=True) else: - run(['git', 'clone', scm_url, str(repo_dir)], check=True) - run(['git', 'checkout', commit_id], cwd=repo_dir, check=True) + try: + run(['git', 'clone', scm_url, str(repo_dir)], check=True) + run(['git', 'checkout', commit_id], cwd=repo_dir, check=True) + except CalledProcessError as e: + print(f"Failed to clone or checkout: {e}") + sys.exit(1) def create_tarball(package_name, source_dir=None): |