Skip to content

Commit

Permalink
Merge pull request #886 from sever-sever/T7026-fix-patches
Browse files Browse the repository at this point in the history
T7026: Use vpp patches during build as they not applied
  • Loading branch information
sever-sever authored Jan 14, 2025
2 parents 0bd5cb4 + 0f44fc7 commit 4b9c86b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/package-build/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,9 +120,17 @@ def build_package(package: list, patch_dir: Path) -> None:
print(f"I: pre_build_hook failed for the {repo_name}")
raise

# Apply patches if any
if (repo_dir / 'patches'):
apply_patches(repo_dir, patch_dir / repo_name)
# Apply patches if the 'apply_patches' key is set to True (default) in the package configuration
# This allows skipping patch application for specific packages when desired
#
# Usage:
# apply_patches = false
#
# Default to True if the key is missing
if package.get('apply_patches', True):
# Check if the 'patches' directory exists in the repository
if (repo_dir / 'patches'):
apply_patches(repo_dir, patch_dir / repo_name)

# Sanitize the commit ID and build a tarball for the package
commit_id_sanitized = package['commit_id'].replace('/', '_')
Expand Down
9 changes: 9 additions & 0 deletions scripts/package-build/vpp/package.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,27 @@ name = "vyos-vpp-patches"
commit_id = "current"
scm_url = "https://github.com/vyos/vyos-vpp-patches"
build_cmd = "/bin/true"
apply_patches = false

[[packages]]
name = "vpp"
commit_id = "stable/2406"
scm_url = "https://github.com/FDio/vpp"
# Skip apply patches by build.py as we use them in build_cmd
apply_patches = false

pre_build_hook = """
mkdir -p ../patches/vpp/
rsync -av ../vyos-vpp-patches/patches/vpp/ ../patches/vpp/
"""

build_cmd = """
# Patches for vpp should applied here
for patch in ../patches/vpp/*.patch; do
echo "I: build_cmd applying patch $patch..."
git -c [email protected] -c user.name=vyos am "$patch" || { echo "Failed to apply patch $patch"; exit 1; }
done
make UNATTENDED=yes install-dep
make pkg-deb
cp build-root/*.deb ../
Expand Down

0 comments on commit 4b9c86b

Please sign in to comment.