Skip to content

Template hardcoded version literals (perl @INC, cups.pc, pkgconf docdir were stale) - #1403

Merged
bryan-minimal merged 3 commits into
mainfrom
version-templates
Nov 11, 2026
Merged

bryan-minimal merged 3 commits into
mainfrom
version-templates

Conversation

@bryan-minimal

@bryan-minimal bryan-minimal commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

An audit turned up version-keyed strings in nine recipes that were written out by hand. This PR derives each one from version in build.ncl or from MINIMAL_ARG_VERSION in build.sh, so a future bump can't leave them behind. Most render to exactly the value they have today. Three had already gone stale and now render the correct current value.

In build.ncl the major.minor series is let api = std.string.join "." (std.array.slice 0 2 (std.string.split "." version)) in. These std functions are already used in-tree (llvm/versioned.ncl). In build.sh it is ${MINIMAL_ARG_VERSION%.*}, which is POSIX and works under #!/bin/sh.

Rendered values, before and after

Package Where Before (main) After (rendered)
ruby 4.0.9 build.ncl source url …/pub/ruby/4.0/ruby-4.0.9.tar.gz …/pub/ruby/4.0/ruby-4.0.9.tar.gz (same)
gnutls 3.8.13 build.ncl source url …/gnutls/v3.8/gnutls-3.8.13.tar.xz …/gnutls/v3.8/gnutls-3.8.13.tar.xz (same)
tree 2.3.2 smoketest grep -q 2.3.2 grep -q 2.3.2 (same)
guile 3.0.11 eval test = 3.0.11 = 3.0.11 (same)
guile build.sh self-check usr/share/guile/3.0, usr/lib/guile/3.0/ccache same
bzip2 1.0.8 build.sh tar -xof bzip2-1.0.8.tar.gz, cd bzip2-1.0.8, ln -sv libbz2.so.1.0.8 same
tcl 8.6.18 build.ncl output glob usr/bin/tclsh8.6 usr/bin/tclsh8.6 (same)
tcl smoketest /usr/bin/tclsh8.6 /usr/bin/tclsh8.6 (same)
tcl build.sh tdbcConfig sed /usr/lib/tcl8.6 /usr/lib/tcl8.6 (same)
perl 5.44.0 build.sh tarball and dir perl-5.44.0.tar.xz, cd perl-5.44.0 same
perl 5.44.0 build.sh Configure -D privlib, archlib, sitelib, sitearch, vendorlib, vendorarch /usr/lib/perl5/5.42/{core,site,vendor}_perl (stale) /usr/lib/perl5/5.44/{core,site,vendor}_perl
cups 2.4.20 build.sh fallback cups.pc Version: 2.4.13 (stale) Version: 2.4.20
pkgconf 3.0.10 build.sh --docdir /usr/share/doc/pkgconf-2.5.1 (stale) /usr/share/doc/pkgconf-3.0.10

How these were checked:

  • Every build.ncl string was evaluated with nickel eval / nickel export (Nickel 1.18.0), using the file's own let version / let api lines and the field text copied unchanged. A full export is blocked by the minimal.ncl import.
  • Every build.sh line was rendered with the pinned version and diffed against main. bzip2 and tcl come out identical. guile differs only on lines that already used the variable. perl, cups and pkgconf differ only on the three stale values above.
  • nickel format was run on every edited .ncl file, and sh -n passes on perl/build.sh.

Other changes:

  • bzip2, perl, cups and pkgconf gain build_args = { include version }. ruby, tree, guile and tcl already had it.
  • tcl's output key "tclsh8.6" is renamed to tclsh_versioned. Output keys are identifiers, so the key stays literal and only the glob is templated. Nothing in the tree references that key: the only importer, expect, imports all of tcl, and no subsetOf tcl exists. tcl stays pinned to the 8.6 series; this just makes a future move to 9.x mechanical.

perl: the @inc move from 5.42 to 5.44

This is the one change in behavior. perl 5.44.0 has been installing its core, site and vendor libraries under /usr/lib/perl5/5.42/, and after this PR it installs them under /usr/lib/perl5/5.44/. Consumers checked:

  • perl's own outputs: perl_data = usr/lib/perl*/**/*.{pl,pm,pod} and perl_libexec = usr/lib/perl*/**/*.so are not tied to a version, so both match the new directory.
  • git grep '5\.42' across the repo: the only hits are the six perl -D lines (and unrelated glibc-bedrock-2.42 names). No other package hardcodes the perl5 path.
  • git grep for vendor_perl|site_perl|core_perl|usr/lib/perl|Makefile.PL|INSTALLDIRS|PERL5LIB|Build.PL: no hits outside perl itself.
  • Packages with perl in runtime_deps: autoconf, automake, groff, stow.
    • autoconf, automake and groff run perl scripts that use core modules and their own /usr/share/<pkg> libraries. They never install into perl's @inc.
    • stow installs Stow.pm. Its configure asks perl's Config at build time where to put it, and its output is a usr/** catch-all. stow has perl as a build dep, so it rebuilds against the new perl and lands under 5.44/site_perl, which is in the new @inc. No edit was needed.
  • The other 41 build-only importers (openssl's Configure, gcc, glibc, coreutils, and so on) only run perl during the build, so the version directory doesn't matter to them.

Packages touched for the perl move: only perl. No consumer needed an edit.

Not changed

  • automake ("aclocal-1.19", build.ncl:38) is left alone because pkgs#1399, the still-open 1.20 bump, hand-fixes it. Editing it here would conflict. gominimal/pkgmgr-rs#1268 (merged) teaches the updater to move a versioned output like this one along with the version, so future bumps handle this shape.
  • Intended pins are left alone: raylib .so.600 (series-pinned for odin), opencv4, the bun and mrustc guards, lpeg's lua 5.1, zig's libLLVM.so.22, rust stage0, the bedrock URLs, glibc-bedrock, openjdk-N, and the libusb-1.0 / glib-2.0 API names.
  • Prose comments that name a version (for example cups's "drop this patch past 2.4.20", or tree's provenance note) are left as they are.

Rebuild impact: large

These packages' spec hashes change because both build.sh and build.ncl change:

  • bzip2 is imported by base and base-bootstrap (and directly by 27 recipes). This is effectively a world rebuild.
  • pkgconf is a build dep of 156 recipes.
  • perl is imported by 45 recipes, including gcc, glibc, openssl and coreutils.
  • cups: 21 importers (the chromium family). gnutls: 2. ruby: 2. tcl: 1 (expect). guile, tree: leaves.

Nothing was built locally. The build-bot builds it.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Updated build configuration for bzip2, CUPS, GnuTLS, Guile, Perl, pkgconf, Ruby, Tcl, and tree to use package version information consistently.
    • Build scripts now validate required version settings and use version-matched source archives, paths, metadata, and checks where applicable.
    • These changes support building the listed packages with their configured versions rather than relying on fixed version values.

Derive version-keyed strings from `version` (build.ncl) or
MINIMAL_ARG_VERSION (build.sh) instead of spelling them out. Most render
to exactly today's value; three were already stale and now render the
correct current value:

- perl: @inc dirs were /usr/lib/perl5/5.42/* on perl 5.44.0; now 5.44.
- cups: fallback cups.pc said Version: 2.4.13 on 2.4.20.
- pkgconf: --docdir was pkgconf-2.5.1 on 3.0.10.

Unchanged renders: ruby /pub/ruby/4.0/, gnutls /v3.8/, tree and guile
version tests, guile's 3.0 module dirs, bzip2's tarball/dir and
libbz2.so.1.0.8 symlink, perl's tarball/dir, tcl's tclsh8.6 glob and
test and /usr/lib/tcl8.6. tcl's output key "tclsh8.6" becomes
tclsh_versioned (no consumer references it). bzip2, perl, cups and
pkgconf gain build_args = { include version }.

automake is left to pkgs#1399.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner November 8, 2026 20:23
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Warning

Review limit reached

  • Run on-demand review

This review includes 15 billable files and costs up to $3.75.

  • Ask an admin to make reviews automatic

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Or wait 53 minutes for your next included review.

Check out review usage here.

View limit details

Limit details: You’ve used all 3 included reviews currently available. Your 49 included PR review attempts over the past 7 days set your current allowance at 3 reviews per hour.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 0586afd and dd84bff.

Files selected for processing: 15

  • packages/bzip2/build.ncl
  • packages/bzip2/build.sh
  • packages/cups/build.ncl
  • packages/cups/build.sh
  • packages/gnutls/build.ncl
  • packages/guile/build.ncl
  • packages/guile/build.sh
  • packages/perl/build.ncl
  • packages/perl/build.sh
  • packages/pkgconf/build.ncl
  • packages/pkgconf/build.sh
  • packages/ruby/build.ncl
  • packages/tcl/build.ncl
  • packages/tcl/build.sh
  • packages/tree/build.ncl

No actionable comments were generated in the recent review.

Walkthrough

Nine package build definitions and scripts now derive source locations, build paths, metadata, executable paths, and version checks from configured package versions. Several build scripts also require the version to be passed through build_args.

Changes: Version-parameterized package builds

Layer / File(s) Summary
Pass versions and select source locations
packages/bzip2/build.ncl, packages/bzip2/build.sh, packages/cups/build.ncl, packages/perl/build.ncl, packages/perl/build.sh, packages/pkgconf/build.ncl, packages/gnutls/build.ncl, packages/ruby/build.ncl
Build specifications pass versions to scripts. Bzip2 and Perl select source archives from the configured version. GnuTLS and Ruby derive source URL components from their package versions.
Derive build paths and metadata
packages/bzip2/build.sh, packages/cups/build.sh, packages/guile/build.sh, packages/perl/build.sh, packages/pkgconf/build.sh, packages/tcl/build.sh
Build scripts require a version argument and use configured or derived versions in symlink targets, metadata, library and module paths, and documentation paths.
Update version checks and Tcl commands
packages/guile/build.ncl, packages/tcl/build.ncl, packages/tree/build.ncl
Guile and tree version checks use the package version. Tcl executable output and smoketest paths use the derived API version.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: msample, twitchyliquid64

Merge Risk: Minimal · previous review 0586a

The version-derived paths have no identified compatibility break. Normal package-build validation remains appropriate before release.

Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names a real part of the change: replacing stale hardcoded version literals in package templates (perl @INC, cups.pc, pkgconf docdir). It does not cover the full changeset, which also touche…
Docstring Coverage Passed No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
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.
Full details: Title check

Explanation

The title names a real part of the change: replacing stale hardcoded version literals in package templates (perl @INC, cups.pc, pkgconf docdir). It does not cover the full changeset, which also touches bzip2, gnutls, guile, ruby, tcl, and tree, and it does not mention the derivation from version or the MINIMAL_ARG_VERSION guards. It is specific and accurate enough for a reader scanning history to understand the primary change.

Full details: Docstring Coverage

Explanation

No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 6 files. (9 skipped: 9 unsupported.)

Finishing Touches

Generate docstrings

  • Commit to this branch
  • Create a new PR
Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between adc60ff and 0586afd.

Files selected for processing: 15

  • packages/bzip2/build.ncl
  • packages/bzip2/build.sh
  • packages/cups/build.ncl
  • packages/cups/build.sh
  • packages/gnutls/build.ncl
  • packages/guile/build.ncl
  • packages/guile/build.sh
  • packages/perl/build.ncl
  • packages/perl/build.sh
  • packages/pkgconf/build.ncl
  • packages/pkgconf/build.sh
  • packages/ruby/build.ncl
  • packages/tcl/build.ncl
  • packages/tcl/build.sh
  • packages/tree/build.ncl

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

cups and pkgconf would otherwise render an empty version silently (a
cups.pc "Version: " / a docdir "pkgconf-"); guard every build.sh this PR
templated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@agent-137 agent-137 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.

Review on Karl's behalf. This is a comment, not an approval. Nothing was built for it. The findings come from reading the declarations and fetching upstream sources, and each one says how it was checked. The CI rollup on this head is now SUCCESS.

CI: all green, including minimal build. Standalone tests passed on amd64 and arm64 for bzip2, cups, gnutls, guile, perl, pkgconf, ruby, tcl, tree, and for the perl and tcl consumers stow and expect. stow's smoke test runs stow -S, which loads Stow.pm, so the new 5.44/site_perl @inc works.

Should-fix: none.

Nit:

  • packages/pkgconf/build.sh:16: no pkgconf output captures the --docdir (outputs at build.ncl:31-39 have no usr/share/doc glob). Fixing the stale value therefore changes nothing that ships, only a build-time path. The PR body lists it next to the perl and cups fixes as "stale", but unlike those two it has no effect.

Checked:

  • Every template uses the right variable:
    • api = major.minor through std.array.slice 0 2 (end exclusive) in gnutls, ruby and tcl.
    • ${MINIMAL_ARG_VERSION%.*} gives 5.44, 3.0 and 8.6 in perl, guile and tcl.
    • The bzip2 tarball name matches its Source URL bzip2-%{version}.tar.gz.
  • Every newly templated build.sh gets build_args = { include version }.
  • Rendered paths match what each build installs:
    • Guile uses its effective-version dirs.
    • Tcl installs tclsh8.6 and /usr/lib/tcl8.6 from its own TCL_VERSION.
    • The upstream Makefile names libbz2.so.1.0.8 after the version.
    • The cups fallback .pc always fires, because 2.4.x generates cups.pc at the top level, not in cups/. That last point is from upstream layout knowledge and was not checked in a build.
  • Stale-literal grep across all 9 package dirs on the PR head: the only version strings left are SPDX ids, prose comments and ruby's test gem 0.0.1.
  • Tree-wide git grep for 5\.42|perl5/|core_perl|site_perl|vendor_perl|INSTALLDIRS|-MConfig finds hits only in perl's own -D lines. No package installs perl modules.
  • tclsh8.6 has no remaining references besides a comment, so renaming the output key breaks nothing.

@agent-137 agent-137 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.

Approving at 0586afd. No should-fix findings; the nits in the earlier comment review are optional.

@bryan-minimal
bryan-minimal added this pull request to the merge queue Nov 11, 2026
Merged via the queue into main with commit c8f2093 Nov 11, 2026
15 checks passed
@bryan-minimal
bryan-minimal deleted the version-templates branch November 11, 2026 20:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants