mirror of
https://github.com/vyos/vyos-build.git
synced 2025-10-01 20:28:40 +02:00
T7530: Build package binaries script should exit if repo is absent
The build package binaries script should exit if the repo is absent or cannot be cloned If a build package `repo-a` depends on the `repo-b` and the `repo-b` cannot be cloned, then we shoud exit from the script to avoid partly build dependencies For example: ``` [[packages]] name = "fake-repo" commit_id = "v0.0.1" scm_url = "https://github.com/vyos/fake-repo" [[packages]] name = "ethtool" commit_id = "debian/1%6.10-1" scm_url = "https://salsa.debian.org/kernel-team/ethtool" ``` If ethtool depends on some fake-package and this package cannot be downloaded from the repo, then we shouldn't build the ethtool package at all.
This commit is contained in:
parent
8350580ac5
commit
2ecdb4f464
@ -17,6 +17,7 @@
|
|||||||
|
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import toml
|
import toml
|
||||||
import os
|
import os
|
||||||
|
|
||||||
@ -91,7 +92,11 @@ def build_package(package: list, patch_dir: Path) -> None:
|
|||||||
|
|
||||||
# Check out the specific commit
|
# Check out the specific commit
|
||||||
run(['git', 'checkout', package['commit_id']], cwd=repo_dir, check=True)
|
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`.
|
# 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.
|
# 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,
|
# This hook allows you to perform preparatory tasks, such as creating directories,
|
||||||
|
|||||||
@ -18,6 +18,7 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
|
import sys
|
||||||
import toml
|
import toml
|
||||||
import os
|
import os
|
||||||
import subprocess
|
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', 'checkout', commit_id], cwd=repo_dir, check=True)
|
||||||
#run(['git', 'pull'], cwd=repo_dir, check=True)
|
#run(['git', 'pull'], cwd=repo_dir, check=True)
|
||||||
else:
|
else:
|
||||||
run(['git', 'clone', scm_url, str(repo_dir)], check=True)
|
try:
|
||||||
run(['git', 'checkout', commit_id], cwd=repo_dir, check=True)
|
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):
|
def create_tarball(package_name, source_dir=None):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user