T8599: fail build on patch fail#1175
Conversation
When patch fails to apply exit with error instead of ignoring it.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
Comment |
|
👍 |
| 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) | ||
|
|
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
| sys.exit(1) | |
| sys.exit(e.returncode if e.returncode is not None else 1) |
| 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") |
There was a problem hiding this comment.
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.
| print("E: Source packages build failed, possibly patches problem") | |
| print(f'E: Source package build failed for "{repo_name}" while running: {build_cmd}') |
Change summary
When patch fails to apply exit with error instead of ignoring it.
Types of changes
Related Task(s)
Related PR(s)
How to test / Smoketest result
Add failing patch, try to build. Result before this PR:
Inside of build log - package builds successfully, it is extremely easy not to see this.
With PR:
With failure.
Checklist: