Skip to content

Commit

Permalink
T7037: Add prebuild command for the package-build
Browse files Browse the repository at this point in the history
Add pre_build_cmd for the package build after clonning a repo
but before apply patches
  • Loading branch information
sever-sever committed Jan 10, 2025
1 parent aae746a commit ddc8abd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion scripts/package-build/build.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
# Copyright (C) 2024 VyOS maintainers and contributors
# Copyright (C) 2024-2025 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
Expand Down Expand Up @@ -92,6 +92,17 @@ 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)

# Pre build command
pre_build_cmd = package.get('pre_build_cmd', '')
if pre_build_cmd:
try:
print(f'I: execute pre_build_cmd for the package {repo_name}')
run(pre_build_cmd, cwd=repo_dir, check=True, shell=True)
except CalledProcessError as e:
print(e)
print(f"I: Pre build command failed for the {repo_name}")
raise

# Apply patches if any
if (repo_dir / 'patches'):
apply_patches(repo_dir, patch_dir / repo_name)
Expand Down

0 comments on commit ddc8abd

Please sign in to comment.