This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new 292718b9fc5f CAMEL-23703: camel-launcher - fix brew audit --strict 
redundant version
292718b9fc5f is described below

commit 292718b9fc5fac86ea310d63c89a1794544768ce
Author: Adriano Machado <[email protected]>
AuthorDate: Mon Aug 24 04:04:02 2026 -0400

    CAMEL-23703: camel-launcher - fix brew audit --strict redundant version
    
    formula.rb.tpl set both a `url` and an explicit `version` field, which
    Homebrew's `brew audit --strict` flags as redundant since the version
    can already be inferred by scanning the url. This would fail any real
    submission of the generated formula to homebrew-core.
    
    Removes the redundant version line, and updates camel-validate.sh's
    Homebrew version check to read the expected version from the formula's
    url instead (captured before test-mode rewrites it to a local file://
    path for offline install).
    
    Closes #25509
    
    Co-Authored-By: Claude Sonnet 5 <[email protected]>
---
 .../src/jreleaser/bin/camel-validate.sh            | 29 +++++++++++-----------
 .../distributions/camel-cli/brew/formula.rb.tpl    |  1 -
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/dsl/camel-jbang/camel-launcher/src/jreleaser/bin/camel-validate.sh 
b/dsl/camel-jbang/camel-launcher/src/jreleaser/bin/camel-validate.sh
index 1566fdba0c2c..508868cae534 100755
--- a/dsl/camel-jbang/camel-launcher/src/jreleaser/bin/camel-validate.sh
+++ b/dsl/camel-jbang/camel-launcher/src/jreleaser/bin/camel-validate.sh
@@ -233,6 +233,18 @@ validate_homebrew() {
     # failure of the audit gate below caused by the tap copy itself, not by 
the formula.
     chmod 644 "$tap_dir/Formula/${fmla}.rb"
 
+    # The formula carries no dedicated `version` field (brew audit --strict 
rejects one that
+    # merely duplicates what it already scans from the url), so the expected 
post-install
+    # version is read from the url instead - captured now, before Step 2 below 
may rewrite that
+    # same url to a local file:// path for the offline install, which would 
otherwise wipe out
+    # the "<version>/<artifact>" path segment this parses.
+    local expected_version
+    expected_version=$(sed -n 's#.*/camel-launcher/\([^/]*\)/[^/]*"$#\1#p' 
"$tap_dir/Formula/${fmla}.rb" | head -n1)
+    if [ -z "$expected_version" ]; then
+        echo "WARN: could not read the version from tapped formula 
${fmla}.rb's url, falling back to \$RESOLVED_VERSION ($RESOLVED_VERSION)"
+        expected_version="$RESOLVED_VERSION"
+    fi
+
     # Step 1: Homebrew style + audit, referenced by tap-qualified name (not a 
path).
     # `brew style --fix` only normalizes formatting; its output is 
informational.
     local style_output=""
@@ -323,21 +335,8 @@ validate_homebrew() {
 
     # Step 3: Verify camel version after installation. A successful `brew 
install` exit code
     # is not proof the executable actually works, so a 
missing/empty/mismatched result here
-    # is a real failure, not something to warn past.
-    #
-    # Expected version comes from the formula's own `version` line, not 
$RESOLVED_VERSION.
-    # JReleaser renders the formula version from the real POM version, which 
in test mode is
-    # the -SNAPSHOT that the offline file:// install above actually installs; 
that differs from
-    # $RESOLVED_VERSION (which strips -SNAPSHOT for local-archive lookups). 
Reading the expected
-    # value back out of the tapped formula keeps this assertion correct in 
both the test-mode
-    # case and a real release (where the formula version is $RESOLVED_VERSION 
anyway).
-    local expected_version
-    expected_version=$(sed -n 's/^[[:space:]]*version "\(.*\)"/\1/p' 
"$tap_dir/Formula/${fmla}.rb" | head -n1)
-    if [ -z "$expected_version" ]; then
-        echo "WARN: could not read 'version' from tapped formula ${fmla}.rb, 
falling back to \$RESOLVED_VERSION ($RESOLVED_VERSION)"
-        expected_version="$RESOLVED_VERSION"
-    fi
-
+    # is a real failure, not something to warn past. $expected_version was 
captured above,
+    # before Step 2 rewrote the formula's url to a local file:// path.
     local camv_output=""
     if ! command -v camel >/dev/null 2>&1; then
         echo "FAIL: camel executable not found on PATH after a successful 
homebrew install"
diff --git 
a/dsl/camel-jbang/camel-launcher/src/jreleaser/distributions/camel-cli/brew/formula.rb.tpl
 
b/dsl/camel-jbang/camel-launcher/src/jreleaser/distributions/camel-cli/brew/formula.rb.tpl
index b69c286d58d0..a995a583674c 100644
--- 
a/dsl/camel-jbang/camel-launcher/src/jreleaser/distributions/camel-cli/brew/formula.rb.tpl
+++ 
b/dsl/camel-jbang/camel-launcher/src/jreleaser/distributions/camel-cli/brew/formula.rb.tpl
@@ -24,7 +24,6 @@ class {{brewFormulaName}} < Formula
   desc "{{projectDescription}}"
   homepage "{{{projectLinkHomepage}}}"
   url "{{{distributionUrl}}}"{{#brewDownloadStrategy}}, :using => 
{{.}}{{/brewDownloadStrategy}}
-  version "{{projectVersion}}"
   sha256 "{{distributionChecksumSha256}}"
   license "{{projectLicense}}"
 {{#brewVersionedFormula}}

Reply via email to