Repository navigation
build: honour DESTDIR in make install and ship LICENSE in every package - #710
Merged
Merged
Conversation
`make install DESTDIR=<stage>` now writes every file under the stage and skips systemd-sysusers, systemd-tmpfiles and systemctl, so a packager can build a staged tree and leave activation to the package's install scripts. `make uninstall DESTDIR=...` removes the staged files and leaves the running service alone. Without DESTDIR both targets behave as before. crates.io and npm build each tarball from the package's own directory, and LICENSE sat only at the repository root, so sysknife-cli-0.28.0.crate and [email protected] shipped a `license = "MIT"` field with no licence file. Each publishable crate and packages/setup now hold a copy. tests/release/destdir-install.test.sh runs the real Makefile with every install directory redirected into scratch and the activation commands stubbed. tests/release/package-license.test.sh compares every publishable crate and the npm package against the root LICENSE. Both run in CI. Signed-off-by: Vladimir Rotariu <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Summary
Two packaging gaps from the OpenSSF Best Practices review.
make install DESTDIR=<stage>. Packagers stage an install into a scratch tree and ship that tree. The Makefile ignoredDESTDIR, so every file went straight to the host. Each destination ininstallanduninstallnow carries the$(DESTDIR)prefix, the preflight probes the staged paths, and the steps that act on the running system (systemd-sysusers,systemd-tmpfiles,systemctl daemon-reload, andsystemctl disable --nowon uninstall) run only whenDESTDIRis empty. Each skipped step printsDESTDIR set; skipped: ...so the packager sees what their install scripts must run. A plainsudo make installdoes what it did before.docs/quickstart.mdgets one paragraph for packagers.LICENSE in every published package. crates.io and npm build each tarball from the package directory, and
LICENSElived only at the repository root, sosysknife-cli-0.28.0.crateand[email protected]carrylicense = "MIT"and no licence text. MIT asks for the notice in every copy. The six publishable crates andpackages/setupnow hold a copy;cargo package --list -p sysknife-cliandnpm pack --dry-runboth list it.Related Issue
Closes #711, closes #712. Part of #731 (OpenSSF Best Practices: Silver
installation_standard_variables, Baseline OSPS-LE-03.02).Validation
Two new tests, both wired into
docs-and-hygiene:tests/release/destdir-install.test.shruns the real Makefile with everyINSTALL_DIRSvariable pointed into a scratch root, and stubscargo,systemctl,systemd-sysusers,systemd-tmpfilesandvisudo. A staged install must write all 22 destinations underDESTDIR, nothing outside it, and call no activation command; a staged uninstall must remove everything; a live install must still activate. It failed onmainand passes here. I ran six mutants and each one failed the test:$(DESTDIR)dropped from the helpers, the sudoers line, the preflight probe or the uninstallrm, andon_hostforced to always run or never run.tests/release/package-license.test.shreadscargo metadatafor the publishable crates, pluspackages/setup, and requires aLICENSEbyte-identical to the root one with noincludeorexcluderule dropping it. Deletingcrates/sysknife-core/LICENSEfails it, and so does one extra byte inpackages/setup/LICENSE.install-paths.test.shnow ignores$(DESTDIR)when it lists the variables the recipe writes into, andhelper_install_coverage.rsexpects the prefixed paths.Locally the pre-commit gate (fmt, clippy
--all-targets, doc, nextest 2091/2091 against the baseline) andscripts/ci-local.sh --fastboth pass.Notes for Reviewers
The staged sudoers fragment keeps mode 0440, and the test checks it. Nothing changes for a live install except the echoed paths.
🤖 Generated with Claude Code