Merge pull request #886 from sever-sever/T7026-fix-patches

T7026: Use vpp patches during build as they not applied
This commit is contained in:
Viacheslav Hletenko 2025-01-14 11:15:10 +02:00 committed by GitHub
commit 4b9c86bd9a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 20 additions and 3 deletions

View File

@ -120,9 +120,17 @@ def build_package(package: list, patch_dir: Path) -> None:
print(f"I: pre_build_hook failed for the {repo_name}") print(f"I: pre_build_hook failed for the {repo_name}")
raise raise
# Apply patches if any # Apply patches if the 'apply_patches' key is set to True (default) in the package configuration
if (repo_dir / 'patches'): # This allows skipping patch application for specific packages when desired
apply_patches(repo_dir, patch_dir / repo_name) #
# 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 # Sanitize the commit ID and build a tarball for the package
commit_id_sanitized = package['commit_id'].replace('/', '_') commit_id_sanitized = package['commit_id'].replace('/', '_')

View File

@ -3,11 +3,14 @@ name = "vyos-vpp-patches"
commit_id = "current" commit_id = "current"
scm_url = "https://github.com/vyos/vyos-vpp-patches" scm_url = "https://github.com/vyos/vyos-vpp-patches"
build_cmd = "/bin/true" build_cmd = "/bin/true"
apply_patches = false
[[packages]] [[packages]]
name = "vpp" name = "vpp"
commit_id = "stable/2406" commit_id = "stable/2406"
scm_url = "https://github.com/FDio/vpp" 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 = """ pre_build_hook = """
mkdir -p ../patches/vpp/ mkdir -p ../patches/vpp/
@ -15,6 +18,12 @@ rsync -av ../vyos-vpp-patches/patches/vpp/ ../patches/vpp/
""" """
build_cmd = """ build_cmd = """
# Patches for vpp should applied here
for patch in ../patches/vpp/*.patch; do
echo "I: build_cmd applying patch $patch..."
git -c user.email=maintainers@vyos.net -c user.name=vyos am "$patch" || { echo "Failed to apply patch $patch"; exit 1; }
done
make UNATTENDED=yes install-dep make UNATTENDED=yes install-dep
make pkg-deb make pkg-deb
cp build-root/*.deb ../ cp build-root/*.deb ../