Conversation
There was a problem hiding this comment.
Pull request overview
Adds Debian-side support for “supplemental packages” (subpackage/binary package stanzas) so a single Dalec build can emit multiple Debian packages, aligning with the broader supplemental-packages stack (related to #607, depends on #1147).
Changes:
- Extend Debian
controlgeneration to emit additional binary package stanzas for target subpackages. - Generate per-subpackage Debian install scripts and maintainer scripts (postinst) and handle systemd units per owning package.
- Add unit-level and LLB-definition-level tests covering subpackage control stanzas, install file generation, postinst generation, perms/systemd behavior, and ordering.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packaging/linux/deb/templates/debian_control.tmpl | Emits appended subpackage stanzas into the generated debian/control. |
| packaging/linux/deb/template_control.go | Implements subpackage stanza rendering (Depends/Recommends/Provides/Conflicts/Replaces/Description). |
| packaging/linux/deb/template_control_test.go | Unit tests for control output with subpackages (naming, sorting, deps, auto-requires behavior). |
| packaging/linux/deb/template_rules.go | Routes systemd override behavior to the correct package (primary vs subpackage) and checks subpackage perms. |
| packaging/linux/deb/template_rules_test.go | Adds coverage ensuring custom systemd enable snippets land in subpackage postinst when needed. |
| packaging/linux/deb/template_custom_dh_installsystemd_postinst.go | Generates custom systemd enable/start snippets per owning package (primary + subpackages). |
| packaging/linux/deb/debroot.go | Generates debroot artifacts for subpackages: .install files, .links, .docs, postinst, and per-package perms/systemd partials. |
| packaging/linux/deb/debroot_subpackage_test.go | LLB-level tests validating that subpackage artifacts produce the expected debroot files and rules behavior. |
Comments suppressed due to low confidence (1)
packaging/linux/deb/debroot.go:280
dirvalues passed intocheckAndWritePermsare absolute paths (e.g./usr/bin,/usr/share/doc/...). Usingfilepath.Join(basePath, dir, ...)dropsbasePathwhendiris absolute, sofix_perms.shwill chmod host paths instead of files underdebian/<pkgName>/....
p := filepath.Join(basePath, dir, resolvedName)
// TODO: do i need this?
if cfg.SubPath != "" {
p = filepath.Join(basePath, dir, cfg.SubPath, resolvedName)
}
f3739e9 to
f2f0266
Compare
b6d626c to
f1819dc
Compare
invidian
left a comment
There was a problem hiding this comment.
Some review comments, although this is not thorough given the amount of code in this PR. I also don't know what testing level we cover here, but perhaps a lot is missing. Given that this could is large and complex, it would be nice to have a robust test suite for it so we can at least attempt to refactor it in the future.
Add subpackage support to the Debian packaging pipeline: - Control file: emit additional Package: stanzas for each subpackage with Architecture, Section, Depends, Recommends, Replaces, Conflicts, Provides, and Description fields. - Install scripts: refactor createInstallScripts into per-package helper (packageInstallScripts) that generates .install, .manpages, .dirs, .docs, and .links files for both the primary package and subpackages. - Postinst: refactor ownership/capabilities helpers to accept artifacts directly; add generateSubPackagePostinst for per-subpackage postinst. - Fix perms: refactor fixupArtifactPerms to iterate primary + subpackages via writePackagePerms; update OverridePerms to check subpackage artifacts. - Systemd: extend OverrideSystemd to emit dh_installsystemd -p<pkgName> for subpackage units; refactor customDHInstallSystemdPostinst to handle both primary and subpackage units via writeCustomEnableForUnits helper. - Add comprehensive LLB-level and unit tests covering all generated files. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Normalize primary and supplemental packages so Debian files, control metadata, and rules share the same generation paths. Add coverage for package-local output and aggregated debhelper overrides. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Adds Debian control stanzas and package-specific install, maintainer, systemd, and permissions behavior, with unit and LLB-level coverage.
This is layer 3 of the native supplemental-packages stack and depends on #1147.
Related to #607.