From 844cac86fd0ba4b21e2a7544c06ce96622b47b80 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Mon, 13 Jan 2025 15:37:11 +0000 Subject: [PATCH 1/2] T7026: Use vpp patches during build as they not applied Patches for VPP are not applied due to specific to the vpp repo structure, so we cannot use standard included to build.py function 'apply_patches' to patch the vpp sources. Use explicit patch in the "build_cmd" as a workaround and the simplest fix. --- scripts/package-build/vpp/package.toml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/package-build/vpp/package.toml b/scripts/package-build/vpp/package.toml index 644b36a994..35a2289611 100644 --- a/scripts/package-build/vpp/package.toml +++ b/scripts/package-build/vpp/package.toml @@ -3,11 +3,14 @@ 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/ @@ -15,6 +18,12 @@ 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 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 pkg-deb cp build-root/*.deb ../ From 0f44fc7abe063a4f64628404547801a089455154 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Tue, 14 Jan 2025 09:10:09 +0000 Subject: [PATCH 2/2] T7026: Add apply_patches option for the build packages script Add 'apply_patches' key is set to True (default) in the package configuration This allows skipping/applying patch application by 'build.py' for specific packages when desired Usage: apply_patches = false --- scripts/package-build/build.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/package-build/build.py b/scripts/package-build/build.py index 08bda30eee..9c1df7b3dc 100755 --- a/scripts/package-build/build.py +++ b/scripts/package-build/build.py @@ -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('/', '_')