Skip to content

Fixed broken package install scripts - #2614

Merged
craigcomstock merged 5 commits into
cfengine:masterfrom
larsewi:fix-lmdb-version-parsing
Nov 9, 2026
Merged

craigcomstock merged 5 commits into
cfengine:masterfrom
larsewi:fix-lmdb-version-parsing

Conversation

@larsewi

@larsewi larsewi commented Nov 8, 2026 •

Copy link
Copy Markdown
Contributor

Fixed two bugs that broke the generated package install scripts:

  • Since the GitHub mirror was added to deps-packaging/lmdb/source (Added a GitHub mirror for the LMDB source tarball #2594), the file has two lines, and produce-script set LMDB_VERSION to the version twice. The second copy ended up on a line of its own, so preinst failed with 1.0.3: not found. sed now quits after the first line.
  • ent-9880: package cfengine client for macos #2500 changed build-scripts/package to generate a patched <type>-script-common.sh only when the build prefix was not /var/cfengine, but produce-script expects it to always be there. Default builds shipped scriptlets without os_type and the other helpers, so %post failed. It is now always generated.
  • The templates are renamed to <type>-script-common.sh.in and use an @BUILD_PREFIX@ placeholder, to make it obvious what is substituted.

Generated with Claude Code

@larsewi

larsewi commented Nov 8, 2026

Copy link
Copy Markdown
Contributor Author

@cf-bottom Jenkins please :)

@cf-bottom

Copy link
Copy Markdown

@larsewi
larsewi force-pushed the fix-lmdb-version-parsing branch from b998342 to 28474c7 Compare November 9, 2026 09:04
@larsewi

larsewi commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

@cf-bottom Jenkins please :)

@larsewi larsewi changed the title produce-script now reads the LMDB version from the first mirror line only Fixed broken package install scripts Nov 9, 2026
@cf-bottom

Copy link
Copy Markdown

@larsewi
larsewi marked this pull request as ready for review November 9, 2026 13:18
@aleksandrychev

aleksandrychev commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

claude says there are blockers

Packages on AIX, Solaris and HP-UX ship broken install scripts (build-scripts/package:126).
The template is chosen by $PACKAGING (lpp, solaris, hpux), but produce-script looks for the file named after the package type (rpm/bff, pkg, depot). So the file it reads is never generated. The scriptlets end up without PREFIX, os_type and the other helpers, and fail on install. This breaks platforms that worked before #2500, so the PR doesn't fully fix the bug it targets.

A missing template doesn't fail the build (build-scripts/package:131). It only logs an error. produce-script also skips missing files without saying anything, so blocker 1 produces a build that succeeds with a broken package. That's how the #2500 regression went unnoticed in the first place.```

@larsewi

larsewi commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

New build here Build Status

@aleksandrychev aleksandrychev 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.

lgtm

Comment thread packaging/common/produce-script Resolved

@craigcomstock craigcomstock 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 will monitor the current build and if green will make the changes I proposed (which are for maintainability sake, not functional sake) and confirm all OK.

larsewi and others added 5 commits November 9, 2026 15:08
…e only

Since the GitHub mirror was added, `deps-packaging/lmdb/source` has two
lines, so `LMDB_VERSION` got the version twice. The second copy became a
line of its own in the generated install scripts, which failed with
`1.0.3: not found` and broke package installation.

Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
Commit 403df91 changed build-scripts/package to generate a patched
<type>-script-common.sh, but only when the build prefix was not
/var/cfengine. produce-script expects it to always be there.

It is now always generated. Replacing the prefix with the same prefix
does not matter. The templates are renamed to <type>-script-common.sh.in
to make it obvious that they are templates.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
This makes it obvious what build-scripts/package substitutes, instead of
rewriting /var/cfengine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
The previous commit generated only the template named after $PACKAGING
(lpp, solaris, hpux), but produce-script reads the one named after the
package type (rpm, pkg, depot). Now all templates are generated.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
produce-script silently skipped any missing snippet, so a build could
succeed with broken install scripts. The four snippets every package
needs now fail the build when missing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Lars Erik Wik <lars.erik.wik@northern.tech>
@craigcomstock
craigcomstock force-pushed the fix-lmdb-version-parsing branch from 5d837dc to 6295cac Compare November 9, 2026 21:08
@craigcomstock

Copy link
Copy Markdown
Contributor

@cf-bottom jenkins no tests

@cf-bottom

Copy link
Copy Markdown

@craigcomstock

Copy link
Copy Markdown
Contributor

green enough. merging.

@craigcomstock
craigcomstock merged commit 43c2a3b into cfengine:master Nov 9, 2026
23 of 24 checks passed
@larsewi

larsewi commented Nov 10, 2026

Copy link
Copy Markdown
Contributor Author

@craigcomstock are you planning to backport the macOS code? Otherwise I will only backport the last commit.

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