Skip to content

T8599: fail build on patch fail#1175

Open
hedrok wants to merge 1 commit intovyos:currentfrom
hedrok:T8599-fail-build-on-patch-fail
Open

T8599: fail build on patch fail#1175
hedrok wants to merge 1 commit intovyos:currentfrom
hedrok:T8599-fail-build-on-patch-fail

Conversation

@hedrok
Copy link
Copy Markdown
Contributor

@hedrok hedrok commented Apr 29, 2026

Change summary

When patch fails to apply exit with error instead of ignoring it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes)
  • Migration from an old Vyatta component to vyos-1x, please link to related PR inside obsoleted component
  • Other (please describe): enhance build system: fail on patch fail.

Related Task(s)

Related PR(s)

How to test / Smoketest result

Add failing patch, try to build. Result before this PR:

dpkg-source: info: applying 0004-does-not-apply.patch
patching file ospf6d/ospf6_auth_trailer.c
Hunk #1 succeeded at 534 (offset -19 lines).
Hunk #2 FAILED at 572.
1 out of 2 hunks FAILED
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch '0004-does-not-apply.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-source: info: if the file is present in the unpacked source, make sure it is also present in the orig tarball
dpkg-source: info: restoring quilt backup files for 0004-does-not-apply.patch
dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/0004-does-not-apply.patch/ --reject-file=- < frr/debian/patches/0004-does-not-apply.patch subprocess returned exit status 1
dpkg-buildpackage: error: dpkg-source --before-build . subprocess returned exit status 2

Inside of build log - package builds successfully, it is extremely easy not to see this.

With PR:

dpkg-source: error: LC_ALL=C patch -t -F 0 -N -p1 -u -V never -E -b -B .pc/0004-does-not-apply.patch/ --reject-file=- < frr/debian/patches/0004-does-not-apply.patch subprocess returned exit status 1
dpkg-buildpackage: error: dpkg-source --before-build . subprocess returned exit status 2
Command 'sudo dpkg -i ../*.deb; dpkg-buildpackage -us -uc -tc -b -Ppkg.frr.rtrlib,pkg.frr.lua' returned non-zero exit status 2.
E: Source packages build failed, possibly patches problem

With failure.

Checklist:

  • I have read the CONTRIBUTING document
  • I have linked this PR to one or more Phabricator Task(s)
  • My commit headlines contain a valid Task id
  • My change requires a change to the documentation
  • I have updated the documentation accordingly

When patch fails to apply exit with error instead of ignoring it.
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 29, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 2b4cf92b-32ef-4cd6-b1e4-52094254e91e

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
✨ Simplify code
  • Create PR with simplified code

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

👍
No issues in PR Title / Commit Title

@github-actions github-actions Bot added the current VyOS rolling release label Apr 29, 2026
Comment on lines -163 to 165
print("I: Source packages build failed, ignoring - building binaries only")
build_cmd = package.get('build_cmd', 'dpkg-buildpackage -uc -us -tc -b')
run(build_cmd, cwd=repo_dir, check=True, shell=True)
print("E: Source packages build failed, possibly patches problem")
sys.exit(1)

Copy link
Copy Markdown
Member

@sever-sever sever-sever Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The netfilter binaries cannot be built with this change, or it detected some issues with our netfilter patches/etc

dpkg-source: info: using options from pkg-libnftnl/debian/source/options: --extend-diff-ignore=(^|/)(compile|config\.sub|config\.guess|Makefile|configure|Makefile\.in|aclocal.m4|config.h.in|depcomp|INSTALL|install-sh|ltmain.sh|missing||libtool.m4|lt~obsolete.m4|ltoptions.m4|ltsugar.m4|ltversion.m4|.Po)
dpkg-source: error: can't build with source format '3.0 (quilt)': no upstream tarball found at ../libnftnl_1.2.6.orig.tar.{bz2,gz,lzma,xz}
dpkg-buildpackage: error: dpkg-source --tar-ignore=.git --tar-ignore=.github -b . subprocess returned exit status 2
Command 'dpkg-buildpackage -uc -us -tc -F --source-option=--tar-ignore=.git --source-option=--tar-ignore=.github' returned non-zero exit status 2.
E: Source packages build failed, possibly patches problem
vyos_bld@0878fc04fa6d:/vyos/work/tmp/build-bin-patch/vyos-build/scripts/package-build/netfilter$ 
vyos_bld@0878fc04fa6d:/vyos/work/tmp/build-bin-patch/vyos-build/scripts/package-build/netfilter$ 

Packages that cannot build after this change:

  • ddclient
  • dropbear
  • ethtool
  • isc-dhcp
  • keepalived
  • ndppd
  • netfilter
  • strongswan

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the package build helper to fail fast when dpkg-buildpackage (including dpkg-source patch application) errors, instead of continuing with a binaries-only build that can hide patch failures in logs.

Changes:

  • Stop ignoring source package build failures and exit the script with an error.
  • Update console output to surface the failure as an error.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

build_cmd = package.get('build_cmd', 'dpkg-buildpackage -uc -us -tc -b')
run(build_cmd, cwd=repo_dir, check=True, shell=True)
print("E: Source packages build failed, possibly patches problem")
sys.exit(1)
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handler exits with status 1 for any dpkg-buildpackage failure, which can hide the underlying return code (e.returncode is often 2 for dpkg-source/patch failures). Consider exiting with the original return code (or re-raising and letting the top-level handle it) so CI/logs reflect the real failure reason.

Suggested change
sys.exit(1)
sys.exit(e.returncode if e.returncode is not None else 1)

Copilot uses AI. Check for mistakes.
print("I: Source packages build failed, ignoring - building binaries only")
build_cmd = package.get('build_cmd', 'dpkg-buildpackage -uc -us -tc -b')
run(build_cmd, cwd=repo_dir, check=True, shell=True)
print("E: Source packages build failed, possibly patches problem")
Copy link

Copilot AI Apr 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message "Source packages build failed, possibly patches problem" will be printed for any failure of build_cmd (e.g., compile/test failures too), so it may be misleading. Recommend making the message generic (include repo_name/build_cmd), and/or only mention patches when the failure is specifically detected as a dpkg-source/patch application error.

Suggested change
print("E: Source packages build failed, possibly patches problem")
print(f'E: Source package build failed for "{repo_name}" while running: {build_cmd}')

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

current VyOS rolling release

Development

Successfully merging this pull request may close these issues.

3 participants