Supplemental packages#988
Open
cpuguy83 wants to merge 7 commits into
Open
Conversation
d8c9938 to
ef53ce1
Compare
ef53ce1 to
0408abc
Compare
0408abc to
4f193d7
Compare
4f193d7 to
e5e4200
Compare
e5e4200 to
4ff35c2
Compare
b18783d to
5413d66
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements supplemental packages (subpackages) for Dalec, addressing issue #607. It enables a single build to produce multiple installable packages — a primary package plus one or more supplemental packages that share the build output but have their own artifact selection, runtime dependencies, and metadata. This follows the native subpackage model of RPM and Debian packaging systems.
Changes:
- Adds a new
SubPackagetype andpackagesmap field onTarget, with validation (description required, unique names, no collision with primary), build arg expansion, and public APIs (GetSubPackages,GetAllPackageNames). - Implements subpackage support in RPM (subpackage sections with
%package,%files, scriptlets), DEB (multi-stanzadebian/control, per-package install scripts, postinst, systemd handling, permissions fixing), and Windows (per-package zips, per-package directories in container images). - Adds comprehensive unit and integration tests across all three targets, plus documentation and JSON schema updates.
Reviewed changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
subpackage.go |
New SubPackage/SubPackageDependencies types, validation, name resolution, GetSubPackages/GetAllPackageNames APIs |
subpackage_test.go |
Comprehensive unit tests for core subpackage model |
target.go |
Adds Packages field to Target, wires validate/processBuildArgs/fillDefaults |
load.go |
Integrates validateSubPackageNames into Spec.Validate() |
packaging/linux/rpm/template.go |
RPM subpackage sections, refactored scriptlet body generators, shared writeFilesBody/installArtifacts |
packaging/linux/rpm/template_test.go |
Extensive RPM subpackage template tests |
packaging/linux/rpm/buildroot_test.go |
LLB-level RPM buildroot tests for subpackages |
packaging/linux/deb/template_control.go |
Debian control subpackage stanzas with deps/conflicts/provides |
packaging/linux/deb/template_control_test.go |
Control file subpackage tests |
packaging/linux/deb/template_rules.go |
Per-package systemd overrides, subpackage-aware perm fixing |
packaging/linux/deb/template_rules_test.go |
Replaced primary mixed-enable test with subpackage test |
packaging/linux/deb/template_custom_dh_installsystemd_postinst.go |
Per-package custom systemd postinst partials |
packaging/linux/deb/debroot.go |
Multi-package install scripts, postinst, links, permissions |
packaging/linux/deb/debroot_subpackage_test.go |
Comprehensive debroot subpackage tests |
packaging/linux/deb/templates/debian_control.tmpl |
Adds {{ .SubPackages }} to control template |
targets/windows/handle_zip.go |
Per-package zips, per-package artifact staging |
targets/windows/handle_container.go |
Installs all package binaries into container image |
targets/windows/validation.go |
Validates no empty packages for zip target |
targets/windows/handle_zip_test.go |
Unit tests for windows subpackage functions |
test/subpackage_test.go |
Shared cross-distro integration test for subpackages |
test/linux_target_test.go |
Wires subpackage integration test into linux test suite |
test/windows_test.go |
Wires subpackage integration test into windows test suite |
test/target_rockylinux_test.go |
Adds missing Key field to rockylinux8 config |
test/target_almalinux_test.go |
Adds missing Key field to almalinux8 config |
website/docs/targets.md |
Documents subpackage feature with examples |
docs/spec.schema.json |
Adds SubPackage/SubPackageDependencies to JSON schema |
5413d66 to
08704e7
Compare
08704e7 to
00b43ce
Compare
Introduce SubPackage and SubPackageDependencies types for supplemental package support (subpackages from shared builds). Add Packages field to Target, validation in Spec.Validate(), and full unit test coverage. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Add SubPackages() method and supporting types to produce %package, %description, %files, and scriptlet sections for each supplemental package. Refactor Install() to include subpackage artifacts in the shared %install section. Includes comprehensive template-level tests. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Test RPMSpec() at the LLB layer by marshaling the returned state, extracting protobuf ops, and asserting on Mkdir/Mkfile actions. Covers default and custom directory paths, subpackage sections with default and custom names, dependencies, sorted ordering, install artifacts, wrong-target exclusion, and invalid spec error handling. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
00b43ce to
02c6335
Compare
✅ Deploy Preview for dalec ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
1 task
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>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
The windowscross/zip target previously emitted only the primary package and silently dropped any supplemental packages defined under a target's `packages` block. Now a single build produces one zip per package (primary + each supplemental), named `<name>_<version>-<revision>_<arch>.zip`. Build artifacts are staged into per-package directories so the zip and container targets can address each package individually. Artifact `name:` overrides are now honored for windows binaries, and chmod targets the staged file rather than the source path (fixing a latent bug for keys containing a slash). Because a zip with no contents is meaningless, the zip target now errors if any package (primary or supplemental) resolves to no artifacts. This mirrors the "empty artifacts on Windows" requirement and differs from rpm and deb, where an artifact-less metapackage is valid. The windowscross container target installs the binaries from every package, matching the linux container target which installs all packages produced for the target. Signed-off-by: Brian Goff <cpuguy83@gmail.com>
02c6335 to
4231aa6
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds subpackages (supplemental packages): a single build can produce multiple installable packages, defined per target under a
packagesfield. Each subpackage shares the primary's build (steps, sources, version, license, …) and selects its own artifacts.%package/%filessections.Package:stanzas with per-package install/maintainer scripts anddh_installsystemdoverrides.Artifacts are self-contained — anything placed in a subpackage isn't also shipped by the primary. Install-time scriptlet requirements (systemd, users/groups) are derived per subpackage.
Closes #607