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

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


The following commit(s) were added to refs/heads/main by this push:
     new a17c439  fix(script): goldflag with empty space
a17c439 is described below

commit a17c439191de11b8bd0cc900c8139d63a2672e7e
Author: Pasquale Congiusti <[email protected]>
AuthorDate: Tue Oct 19 16:12:51 2021 +0200

    fix(script): goldflag with empty space
    
    Enhanced the script to allow including a Goldflag with empty space (ie, 'my 
test')
---
 script/Makefile         | 4 +++-
 script/cross_compile.sh | 9 +++++----
 2 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/script/Makefile b/script/Makefile
index 47ac339..3a584cb 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -323,7 +323,9 @@ git-tag:
        ./script/git_tag.sh $(CUSTOM_VERSION) $(RELEASE_GIT_REMOTE)
 
 cross-compile:
-       ./script/cross_compile.sh $(CUSTOM_VERSION) '$(GOFLAGS)'
+       # we must wrap the goldflags parameters with quotes as they will need 
to 
+       # be processed as a single argument by the cross compile script
+       ./script/cross_compile.sh $(CUSTOM_VERSION) $(subst ","\",$(GOFLAGS))
 
 package-examples:
        ./script/package_examples.sh $(CUSTOM_VERSION)
diff --git a/script/cross_compile.sh b/script/cross_compile.sh
index ad73ae2..034647f 100755
--- a/script/cross_compile.sh
+++ b/script/cross_compile.sh
@@ -22,13 +22,14 @@ rm -rf ${builddir}
 
 basename=camel-k-client
 
-if [ "$#" -ne 2 ]; then
-    echo "usage: $0 version build_flags"
+if [ "$#" -lt 2 ]; then
+    echo "usage: $0 <version> <build_flags...>"
     exit 1
 fi
 
 version=$1
-build_flags=$2
+shift
+build_flags="$*"
 
 cross_compile () {
        local label=$1
@@ -42,7 +43,7 @@ cross_compile () {
        fi
 
        targetdir=${builddir}/${label}
-       eval go build "$build_flags" -o ${targetdir}/kamel${extension} 
./cmd/kamel/...
+       eval go build $build_flags -o ${targetdir}/kamel${extension} 
./cmd/kamel/...
 
        if [ -n "$GPG_PASS" ]; then
            gpg --output ${targetdir}/kamel${extension}.asc --armor 
--detach-sig --passphrase ${GPG_PASS} ${targetdir}/kamel${extension}

Reply via email to