Skip to content

T8599: Make source packages required and fix them - #1175

Merged
sever-sever merged 4 commits into
vyos:rollingfrom
hedrok:T8599-fail-build-on-patch-fail
Jun 23, 2026
Merged

T8599: Make source packages required and fix them#1175
sever-sever merged 4 commits into
vyos:rollingfrom
hedrok:T8599-fail-build-on-patch-fail

Conversation

@hedrok

@hedrok hedrok commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Change summary

T8599: Make source packages required and fix them

A lot of packages failed to build source package.
Stop ignoring source package build errors and fix it.
Also removes rerun when build_cmd was used - because of this patch application problems were hidden.

To fix source packages:

  • Use <source_package>_<upstream_version>.orig.tar.gz naming for source archive.
  • Get source_package and upstream_version from changelog using dpkg-parsechangelog utility
  • Clean build-deps after usage or dpkg-source sees these files as changes relative to upstream.
  • Add '.github' to --diff-ignore source option

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): fix source packages build

Related Task(s)

Related PR(s)

How to test / Smoketest result

Source packages problem:
Try to build ddclient, there is message that source package build failed.
After PR: source package build succeeds.

Problem with applying patches in FRR:

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

@coderabbitai

coderabbitai Bot commented Apr 29, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: b07b3379-c775-4798-8194-0b1497ea3416

📥 Commits

Reviewing files that changed from the base of the PR and between 845f9c5 and c596d7e.

📒 Files selected for processing (1)
  • scripts/package-build/build.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ansible/ansible (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • scripts/package-build/build.py
📜 Recent review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: codeql-analysis-call / Analyze (python)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
🔍 Remote MCP Context7

Summary of Additional Technical Context for PR Review

Based on the documentation retrieved, here are relevant technical details that validate and clarify aspects of the PR:

Python subprocess.CalledProcessError Handling

The PR's approach to error handling aligns with standard Python subprocess patterns:

  • CalledProcessError is a subclass of SubprocessError raised when a process run by check_call, check_output, or run (with check=True) returns a non-zero exit status.
  • The exception includes attributes for returncode, cmd, output, stdout, and stderr, allowing detailed error reporting.
  • The PR's strategy of catching and re-raising CalledProcessError with a formatted failure message aligns with the principle that subprocess module functions don't fail silently—they raise exceptions for non-zero returns, enabling explicit error propagation.

TOML Configuration Format

The PR's addition of build_cmd to scripts/package-build/dropbear/package.toml uses standard TOML configuration patterns:

  • TOML supports key-value pairs within sections for storing configuration metadata, as seen in the PR's use of a build_cmd field.
  • TOML's straightforward syntax is well-suited for package metadata files, consistent with how Python projects and other build systems use TOML for configuration (e.g., pyproject.toml patterns).

Key Validation Points

The technical documentation confirms that:

  1. Error propagation approach — The PR's pattern of raising CalledProcessError and handling it with explicit error messages is the standard, explicit approach rather than silent failure.
  2. TOML configuration structure — The simple build_cmd addition to the package.toml follows TOML best practices for configuration fields.

The previous research context combined with this technical validation provides a strong foundation for reviewing the PR's implementation.


📝 Walkthrough

Summary by CodeRabbit

  • Chores
    • Improved build system error reporting with clearer, formatted failure messages for easier debugging
    • Enhanced package artifact naming and versioning by leveraging official metadata sources
    • Streamlined cleanup process to remove all temporary build artifacts and dependencies efficiently
    • Updated build command configuration to ensure more reliable and consistent package generation

Walkthrough

scripts/package-build/build.py updates pre-build error formatting, derives tarball name from debian/changelog via dpkg-parsechangelog with format-aware suffix selection, and integrates expanded build-deps cleanup into a single-invocation dpkg-buildpackage flow. scripts/package-build/dropbear/package.toml adds a build_cmd to demonstrate the updated build system.

Changes

Debian package build improvements

Layer / File(s) Summary
Pre-build hook error formatting
scripts/package-build/build.py (line 123)
Replace raw exception print with a formatted error message in the pre_build_hook exception handler while keeping the exception re-raised.
Tarball naming from Debian changelog
scripts/package-build/build.py (lines 138–166)
Parse Source and Version from debian/changelog via dpkg-parsechangelog with commit-ID and repo-name fallbacks; conditionally append .orig suffix based on debian/source/format and form tarball_name as <source>_<version><suffix>.tar.gz.
Build-deps cleanup and build flow integration
scripts/package-build/build.py (lines 179–195, 206–208)
After installing *build-deps*.deb, call cleanup_build_deps(repo_dir); expand cleanup to remove *build-deps*.(deb|buildinfo|changes); replace source-then-binary fallback with a single dpkg-buildpackage invocation with tar-ignore options; propagate CalledProcessError to abort with sys.exit(1).
Dropbear package build configuration
scripts/package-build/dropbear/package.toml (line 5)
Add build_cmd setting to run dpkg-buildpackage -us -uc -tc -b for binary-only builds.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title clearly and concisely summarizes the main objective: making source packages required and fixing related build issues in the package build system.
Description check ✅ Passed Description comprehensively explains the changes, rationale, testing approach, and links to the related task T8599. It details specific fixes and demonstrates the improvements with concrete examples.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
✨ Simplify code
  • Create PR with simplified code

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions

github-actions Bot commented Apr 29, 2026

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 thread scripts/package-build/build.py

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread scripts/package-build/build.py Outdated
Comment thread scripts/package-build/build.py Outdated
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")

Copilot AI Apr 30, 2026

Copy link

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.
@hedrok
hedrok marked this pull request as draft May 12, 2026 13:17
@hedrok
hedrok force-pushed the T8599-fail-build-on-patch-fail branch 4 times, most recently from 0d1f1dd to 0042227 Compare June 4, 2026 16:56
@mergify mergify Bot added rolling and removed current VyOS rolling release labels Jun 4, 2026
@hedrok hedrok changed the title T8599: fail build on patch fail T8599: Make source packages required and fix them Jun 4, 2026
@hedrok
hedrok marked this pull request as ready for review June 4, 2026 17:03
@hedrok
hedrok requested a review from sever-sever June 4, 2026 17:05

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
scripts/package-build/build.py (1)

159-185: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Inconsistent error handling: tarball failure silently continues.

Per PR objectives, source package build errors should fail the build. However, if tarball creation at line 159 fails (check=True raises CalledProcessError), it's caught by line 184, which prints the error but does not exit. The script continues to the next package.

This contradicts the explicit sys.exit(1) at line 182 for dpkg-buildpackage failures.

Proposed fix: unify exit behavior
     except CalledProcessError as e:
-        print(f"Failed to build package {repo_name}: {e}")
+        print(f"E: Failed to build package {repo_name}: {e}")
+        sys.exit(1)
     finally:

Alternatively, move the outer try/except to only wrap non-critical sections if partial failures are intentional.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/package-build/build.py` around lines 159 - 185, The tarball creation
error is currently caught by the outer CalledProcessError handler and only
logged, allowing the script to continue; change behavior so a failing tar
creation aborts the build like dpkg-buildpackage failures: when run(['tar',
...], check=True) raises CalledProcessError, call sys.exit(1) (or re-raise)
instead of merely printing, or narrow the outer try/except to exclude the tar
creation block so that CalledProcessError from the tar command propagates;
reference the tarball creation call (tarball_name, repo_name, repo_dir), the
CalledProcessError handler and sys.exit usage near the dpkg-buildpackage
handling to implement the unified exit behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/package-build/build.py`:
- Around line 140-155: The dpkg-parsechangelog invocations assign to
package_version and package_name but only check stdout; instead verify the
CompletedProcess.returncode is 0 before trusting stdout (i.e., after run([...])
check both result.returncode == 0 and result.stdout) and fall back to
package['commit_id'].replace('/', '_') for package_version or repo_name for
package_name when returncode != 0 or stdout is empty; update the logic around
the run(...) results (the variables named package_version and package_name and
the commands invoking dpkg-parsechangelog with repo_dir) so you only
decode/process stdout when the command succeeded, otherwise use the existing
fallback branches.

---

Outside diff comments:
In `@scripts/package-build/build.py`:
- Around line 159-185: The tarball creation error is currently caught by the
outer CalledProcessError handler and only logged, allowing the script to
continue; change behavior so a failing tar creation aborts the build like
dpkg-buildpackage failures: when run(['tar', ...], check=True) raises
CalledProcessError, call sys.exit(1) (or re-raise) instead of merely printing,
or narrow the outer try/except to exclude the tar creation block so that
CalledProcessError from the tar command propagates; reference the tarball
creation call (tarball_name, repo_name, repo_dir), the CalledProcessError
handler and sys.exit usage near the dpkg-buildpackage handling to implement the
unified exit behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Central YAML (inherited), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: 4770785f-d394-4a2a-98b2-707b3fa52beb

📥 Commits

Reviewing files that changed from the base of the PR and between c5e5c86 and 0042227.

📒 Files selected for processing (1)
  • scripts/package-build/build.py
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Mergify Merge Protections
  • GitHub Check: Summary
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

Run Pylint to check for unused-imports in Python files

Files:

  • scripts/package-build/build.py
🪛 OpenGrep (1.22.0)
scripts/package-build/build.py

[ERROR] 179-179: Dynamic command passed to subprocess with shell=True. Use a command list without shell=True, or use shlex.quote() to sanitize input.

(coderabbit.command-injection.python-shell-true)

🪛 Ruff (0.15.15)
scripts/package-build/build.py

[error] 140-140: subprocess call: check for execution of untrusted input

(S603)


[error] 140-140: Starting a process with a partial executable path

(S607)


[error] 150-150: subprocess call: check for execution of untrusted input

(S603)


[error] 150-150: Starting a process with a partial executable path

(S607)


[error] 179-179: subprocess call with shell=True identified, security issue

(S602)

🔍 Remote MCP

I'll search for relevant information about the Debian packaging tools and practices mentioned in this PR to help with the review.Based on the search results, I have sufficient information about the Debian source packaging conventions and tools mentioned in the PR. Let me compile the relevant findings.

Summary of Relevant Context for PR Review

Debian Source Package Naming Convention

The packaging tools require that the tarball complies with the naming convention: source package name, underscore, upstream version number, followed by .orig.tar.gz. The PR changes the naming scheme for .orig.tar.gz files from using a sanitized commit ID to using proper Debian source package and upstream version values extracted from debian/changelog. The name is as follows: source package name, underscore, upstream version number, followed by .orig.tar.gz. This is a critical standard that if you have renamed the upstream tarfile into _.orig.tar.gz and named the directory like -, dpkg-source -b should be able to build proper source packages.

dpkg-parsechangelog Tool

dpkg-parsechangelog reads and parses the changelog of an unpacked Debian source tree and outputs the information in it to standard output in a machine-readable form. The Source field extracts the source package name, and the Version field extracts the source version number. Its main purpose is to provide machine-readable output for scripts and build tools, enabling automated processes (like dpkg-buildpackage) to determine the current package version and integrate changelog entries into the build and release workflow.

Source Package Build Process and .orig.tar.gz Requirements

Building a non-native package involves extracting the original tarball in a separate ".orig" directory and regenerating the .diff.gz by comparing the source package directory with the .orig directory. The source packaging tools manage the changes between the original and Debian source using diff and patch. Turning the original source tree as included in the .orig.tar.gz into the Debian package source must not involve any changes which cannot be handled by these tools. This highlights why the PR's approach of using proper naming and cleaning build artifacts is important.

Build-deps Cleanup Implications

The PR's cleanup of *build-deps*.{deb,buildinfo,changes} files is relevant because dpkg-source is frequently used and also called from package-independent automated building scripts such as dpkg-buildpackage. Build artifacts left in the source directory would be detected as modifications to upstream sources when building the source package, which is why cleanup before invoking dpkg-source is necessary.

Error Handling in dpkg-buildpackage

dpkg-buildpackage calls dpkg-source -b to generate the source package (if a source build has been requested with --build or equivalent options, and if no .dsc has been specified). The PR's change to make source package build failures fatal (rather than being ignored or retried) aligns with ensuring build failures surface properly during the source package generation step.

[::web_search::]

🔇 Additional comments (2)
scripts/package-build/build.py (2)

178-179: LGTM!


196-198: LGTM!

Comment on lines +140 to +155
package_version = run(['dpkg-parsechangelog', '--show-field', 'Version', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
if package_version.stdout:
package_version = package_version.stdout.decode().strip()
package_version = package_version.rsplit('-', maxsplit=1)[0]
if ':' in package_version:
package_version = package_version.split(':', maxsplit=1)[1]
else:
# On failure fallback to sanitized commit ID
package_version = package['commit_id'].replace('/', '_')

package_name = run(['dpkg-parsechangelog', '--show-field', 'Source', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
if package_name.stdout:
package_name = package_name.stdout.decode().strip()
else:
# On failure fallback to repo name
package_name = repo_name

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Check returncode alongside stdout for robustness.

Both dpkg-parsechangelog calls use check=False and test if package_version.stdout:. If the command fails but writes partial/unexpected data to stdout, you'd use garbage as the version or source name. Validate success explicitly:

-        package_version = run(['dpkg-parsechangelog', '--show-field', 'Version', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
-        if package_version.stdout:
+        result = run(['dpkg-parsechangelog', '--show-field', 'Version', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
+        if result.returncode == 0 and result.stdout:
+            package_version = result.stdout.decode().strip()

Same pattern applies to the Source field extraction at line 150.

🧰 Tools
🪛 Ruff (0.15.15)

[error] 140-140: subprocess call: check for execution of untrusted input

(S603)


[error] 140-140: Starting a process with a partial executable path

(S607)


[error] 150-150: subprocess call: check for execution of untrusted input

(S603)


[error] 150-150: Starting a process with a partial executable path

(S607)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/package-build/build.py` around lines 140 - 155, The
dpkg-parsechangelog invocations assign to package_version and package_name but
only check stdout; instead verify the CompletedProcess.returncode is 0 before
trusting stdout (i.e., after run([...]) check both result.returncode == 0 and
result.stdout) and fall back to package['commit_id'].replace('/', '_') for
package_version or repo_name for package_name when returncode != 0 or stdout is
empty; update the logic around the run(...) results (the variables named
package_version and package_name and the commands invoking dpkg-parsechangelog
with repo_dir) so you only decode/process stdout when the command succeeded,
otherwise use the existing fallback branches.

Comment thread scripts/package-build/build.py Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 4 comments.

Comment on lines 135 to +139
# 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('/', '_')
tarball_name = f"{repo_name}_{commit_id_sanitized}.tar.gz"
# Create original tarball for dpkg-source to be happy
Comment on lines +139 to +155
# Create original tarball for dpkg-source to be happy
package_version = run(['dpkg-parsechangelog', '--show-field', 'Version', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
if package_version.stdout:
package_version = package_version.stdout.decode().strip()
package_version = package_version.rsplit('-', maxsplit=1)[0]
if ':' in package_version:
package_version = package_version.split(':', maxsplit=1)[1]
else:
# On failure fallback to sanitized commit ID
package_version = package['commit_id'].replace('/', '_')

package_name = run(['dpkg-parsechangelog', '--show-field', 'Source', '--file', repo_dir / 'debian/changelog'], capture_output=True, check=False)
if package_name.stdout:
package_name = package_name.stdout.decode().strip()
else:
# On failure fallback to repo name
package_name = repo_name
Comment on lines 184 to 185
except CalledProcessError as e:
print(f"Failed to build package {repo_name}: {e}")
Comment on lines +196 to +198
for suffix in ('deb', 'buildinfo', 'changes'):
for file in glob.glob(str(repo_dir / f'*build-deps*.{suffix}')):
os.remove(file)
@sever-sever
sever-sever requested a review from asklymenko June 11, 2026 03:17

@sever-sever sever-sever left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fix the source packages' build
Fix ignoring errors during package build
Tested and seems to work as expected.
Thanks @hedrok

@hedrok

hedrok commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

Updated PR with new commit as Copilot noticed that some errors are ignored anyway.
Reread whole script and added some additional checks:

Exit with error for other failures:

* Creating/installing dependency package should be error: e.g. debugging
  why strongswan cannot find systemd could be easier if build.py failed
  when it couldn't install systemd and not when `configure` couldn't
  find it.
* Creating tarball
* pre_hook run

Moving PR to draft till I rerun build.py for all packages to be sure that it won't break anything.

@hedrok
hedrok marked this pull request as draft June 11, 2026 11:47

@alexandr-san4ez alexandr-san4ez left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I tested the build process with several packages:

  • amazon-cloudwatch-agent
  • udp-broadcast-relay
  • waagent
  • wide-dhcpv6
  • xen-guest-agent
  • zerotier-one

No objections.

hedrok added 3 commits June 18, 2026 22:49
A lot of packages failed to build source package.
Stop ignoring source package build errors and fix it.

To fix source packages:

* Use <source_package>_<upstream_version>.orig.tar.gz naming for source
  archive.
* Get `source_package` and `upstream_version` from changelog using
  dpkg-parsechangelog utility
* Clean build-deps after usage or dpkg-source sees these files as
  changes relative to upstream.
* Add '.github' to --diff-ignore source option
Exit with error for other failures:

* Creating/installing dependency package should be error: e.g. debugging
  why strongswan cannot find systemd could be easier if build.py failed
  when it couldn't install systemd and not when `configure` couldn't
  find it.
* Creating tarball
* pre_hook run
Patch modifies debian/control and debian/rules, there is no easy way to
fix source package creation in such case. As quick solution disable
source package build for this package (previously it failed silently)
@hedrok
hedrok force-pushed the T8599-fail-build-on-patch-fail branch from bb73f42 to 845f9c5 Compare June 19, 2026 08:34
@hedrok

hedrok commented Jun 19, 2026

Copy link
Copy Markdown
Contributor Author

I have rechecked all packages (except Linux kernel as I have some problems with connecting to packages.vyos.net, but it should not be affected - there are custom build commands)

Additional fixes/notes:

dropbear

Our patch changes debian/rules and in such cases there is no easy way to make source packages work. Disabled source package - in rolling it fails anyway.

net-snmp

Same in both rolling and this branch:
build.py returns success, but clean fails with error messages at the end

...
make[2]: Leaving directory '/home/vyos/tasks/VD-3875-fail-on-patch-fail/vyos-build/scripts/package-build/net-snmp/net-snmp/perl'
make[1]: Leaving directory '/home/vyos/tasks/VD-3875-fail-on-patch-fail/vyos-build/scripts/package-build/net-snmp/net-snmp'
dh_auto_clean: error: make -j8 distclean returned exit code 2
make: *** [debian/rules:36: clean] Error 2
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
I: Cleaned up build dependency packages
vyos_bld@581413348be1:/home/vyos/tasks/VD-3875-fail-on-patch-fail/vyos-build/scripts/package-build/net-snmp$ echo $?
0

strongswan

Now build failure is obvious because of additional checks, in rolling it also fails, but returns 0. PR #1222 fixes the issue.

vyos-1x

Uses 1.0 source format + has no correct version, it seems this combination cannot work with '.orig' source format that I've added. I've read documentation a little bit (https://www.man7.org/linux/man-pages/man1/dpkg-source.1.html), 3.0 source format requires '.orig', but 1.0 - no '.orig' in tarball filename. Added check of source format for that.

Also in both rolling and my PR I currently get an error:

cp: cannot stat 'libvyosconfig/_build/libvyosconfig.so': No such file or directory
make[1]: *** [debian/rules:159: override_dh_auto_install] Error 1
make[1]: Leaving directory '/home/vyos/tasks/VD-3875-fail-on-patch-fail/vyos-build/scripts/package-build/vyos-1x/vyos-1x'
make: *** [debian/rules:41: binary] Error 2
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2
E: Build command failed for 'vyos-1x': dpkg-buildpackage -uc -us -tc -F --source-option=--tar-ignore=.git --source-option=--tar-ignore=.github --source-option=-i --source-option=--extend-diff-ignore="^\.github(?:/.*)?$"
Failed to build package vyos-1x: Command 'dpkg-buildpackage -uc -us -tc -F --source-option=--tar-ignore=.git --source-option=--tar-ignore=.github --source-option=-i --source-option=--extend-diff-ignore="^\.github(?:/.*)?$"' returned non-zero exit status 2.

@hedrok
hedrok marked this pull request as ready for review June 19, 2026 08:43
@mergify

mergify Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

1.0 source format version needs tarball without '.orig' suffix as described in https://www.man7.org/linux/man-pages/man1/dpkg-source.1.html.

Only if debian/source/format exists and contains 3.0, use '.orig'
@hedrok
hedrok force-pushed the T8599-fail-build-on-patch-fail branch from 845f9c5 to c596d7e Compare June 19, 2026 08:58
@sever-sever
sever-sever merged commit 67f7e54 into vyos:rolling Jun 23, 2026
10 checks passed
@vyos-bot vyos-bot Bot added mirror-initiated This PR initiated for mirror sync workflow mirror-completed and removed mirror-initiated This PR initiated for mirror sync workflow labels Jun 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

4 participants