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

tsato pushed a commit to branch release-1.9.x
in repository https://gitbox.apache.org/repos/asf/camel-k.git


The following commit(s) were added to refs/heads/release-1.9.x by this push:
     new 9aadfb3e6 chore(build): Assume gnu-sed usage for MacOS users
9aadfb3e6 is described below

commit 9aadfb3e62e15af10a41d86a4487e1ad41a32a3c
Author: Christoph Deppisch <[email protected]>
AuthorDate: Mon Jun 27 09:20:55 2022 +0200

    chore(build): Assume gnu-sed usage for MacOS users
    
    (cherry picked from commit 66e15e97d2f08c01fcf8ec5c1108b5ba8851853e)
---
 .../ROOT/pages/contributing/developers.adoc        |  1 +
 script/Makefile                                    |  4 ----
 script/add_createdAt.sh                            |  7 +-----
 script/gen_crd.sh                                  | 13 +++--------
 script/set_go_modules_version.sh                   | 22 +++++-------------
 script/set_version.sh                              | 27 ++++------------------
 6 files changed, 16 insertions(+), 58 deletions(-)

diff --git a/docs/modules/ROOT/pages/contributing/developers.adoc 
b/docs/modules/ROOT/pages/contributing/developers.adoc
index e4982ea97..ad3fe29dc 100644
--- a/docs/modules/ROOT/pages/contributing/developers.adoc
+++ b/docs/modules/ROOT/pages/contributing/developers.adoc
@@ -27,6 +27,7 @@ In order to build the project, you need to comply with the 
following requirement
 * **MinGW**: needed to compile the project on Windows. Refer to the 
https://www.mingw-w64.org/[MinGW website] for the installation.
 * **Windows Subsystem for Linux (WSL)**: for running Linux binary executables 
natively on Windows. Refer to 
https://docs.microsoft.com/en-us/windows/wsl/install[WSL Website] for 
installation. Alternatively, you can use https://www.cygwin.com/[Cygwin] or 
https://www.educative.io/edpresso/how-to-install-git-bash-in-windows[Git Bash].
 
+NOTE: MacOS users will need to use *gnu-sed* to successfully run the Make 
build scripts (e.g. for generating the Camel K bundle). Please install gnu-sed 
on your machine (e.g. `brew install gnu-sed`) and set your PATH accordingly to 
use gnu-sed with: `export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"`
 
 The Camel K Java runtime (camel-k-runtime) requires:
 
diff --git a/script/Makefile b/script/Makefile
index 7ac662583..434997c74 100644
--- a/script/Makefile
+++ b/script/Makefile
@@ -530,11 +530,7 @@ bundle: set-version generate-crd $(BUNDLE_CAMEL_APIS) 
kustomize operator-sdk pre
                        -q --overwrite --version $(OPERATOR_VERSION) \
                        --kustomize-dir config/manifests $(BUNDLE_METADATA_OPTS)
        @# Move the dockerfile into the bundle directory
-ifeq ($(shell uname -s 2>/dev/null || echo Unknown),Darwin)
-       @mv bundle.Dockerfile bundle/Dockerfile && sed -i '' 's/bundle\///g' 
bundle/Dockerfile
-else
        @mv bundle.Dockerfile bundle/Dockerfile && sed -i 's/bundle\///g' 
bundle/Dockerfile
-endif
        @# Adds the licence headers to the csv file
        ./script/add_license.sh bundle/manifests ./script/headers/yaml.txt
        $(OPERATOR_SDK) bundle validate ./bundle
diff --git a/script/add_createdAt.sh b/script/add_createdAt.sh
index 1dd1ad86c..8029d508c 100755
--- a/script/add_createdAt.sh
+++ b/script/add_createdAt.sh
@@ -35,11 +35,6 @@ created=$(date -u +%FT%TZ)
 
 set +e
 for file in `find "$dir" -type f`; do
-  if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-    sed -i "s/createdAt: .*/createdAt: ${created}/" "${file}"
-  elif [[ "$OSTYPE" == "darwin"* ]]; then
-    # Mac OSX
-    sed -i '' "s/createdAt: .*/createdAt: ${created}/" "${file}"
-  fi
+  sed -i "s/createdAt: .*/createdAt: ${created}/" "${file}"
 done
 set -e
diff --git a/script/gen_crd.sh b/script/gen_crd.sh
index 2bfb8c7ec..ad03de070 100755
--- a/script/gen_crd.sh
+++ b/script/gen_crd.sh
@@ -40,16 +40,9 @@ deploy_crd_file() {
   # Post-process source
   cat ./script/headers/yaml.txt > "$source"
   echo "" >> "$source"
-  if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-    cat "${source}.orig" | sed -n '/^---/,/^status/p;/^status/q' \
-      | sed '1d;$d' \
-      | sed '/creationTimestamp:/a\  labels:\n    app: camel-k' >> "$source"
-  elif [[ "$OSTYPE" == "darwin"* ]]; then
-    # Mac OSX
-    cat "${source}.orig" | sed -n '/^---/,/^status/p;/^status/q' \
-      | sed '1d;$d' \
-      | sed -e $'/^  creationTimestamp:/a\\\n  labels:\\\n    app: camel-k' >> 
"$source"
-  fi
+  cat "${source}.orig" | sed -n '/^---/,/^status/p;/^status/q' \
+    | sed '1d;$d' \
+    | sed '/creationTimestamp:/a\  labels:\n    app: camel-k' >> "$source"
 
   for dest in "${@:2}"; do
     cp "$source" "$dest"
diff --git a/script/set_go_modules_version.sh b/script/set_go_modules_version.sh
index 091f8533a..d67ae5d59 100755
--- a/script/set_go_modules_version.sh
+++ b/script/set_go_modules_version.sh
@@ -30,19 +30,9 @@ api_rule="s/github.com\/apache\/camel-k\/pkg\/apis\/camel 
[A-Za-z0-9\.\-]+.*$/gi
 client_rule="s/github.com\/apache\/camel-k\/pkg\/client\/camel 
[A-Za-z0-9\.\-]+.*$/github.com\/apache\/camel-k\/pkg\/client\/camel 
$target_tag/"
 kr_rule="s/github.com\/apache\/camel-k\/pkg\/kamelet\/repository 
[A-Za-z0-9\.\-]+.*$/github.com\/apache\/camel-k\/pkg\/kamelet\/repository 
$target_tag/"
 
-if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-  sed -i -r "$api_rule"    $location/../go.mod
-  sed -i -r "$client_rule" $location/../go.mod
-  sed -i -r "$kr_rule"     $location/../go.mod
-  sed -i -r "$api_rule"    $location/../pkg/client/camel/go.mod
-  sed -i -r "$api_rule"    $location/../pkg/kamelet/repository/go.mod
-  sed -i -r "$client_rule" $location/../pkg/kamelet/repository/go.mod
-elif [[ "$OSTYPE" == "darwin"* ]]; then
-  # Mac OSX
-  sed -i '' -E "$api_rule"    $location/../go.mod
-  sed -i '' -E "$client_rule" $location/../go.mod
-  sed -i '' -E "$kr_rule"     $location/../go.mod
-  sed -i '' -E "$api_rule"    $location/../pkg/client/camel/go.mod
-  sed -i '' -E "$api_rule"    $location/../pkg/kamelet/repository/go.mod
-  sed -i '' -E "$client_rule" $location/../pkg/kamelet/repository/go.mod
-fi
+sed -i -r "$api_rule"    $location/../go.mod
+sed -i -r "$client_rule" $location/../go.mod
+sed -i -r "$kr_rule"     $location/../go.mod
+sed -i -r "$api_rule"    $location/../pkg/client/camel/go.mod
+sed -i -r "$api_rule"    $location/../pkg/kamelet/repository/go.mod
+sed -i -r "$client_rule" $location/../pkg/kamelet/repository/go.mod
diff --git a/script/set_version.sh b/script/set_version.sh
index 0d6dd1183..d47714d9d 100755
--- a/script/set_version.sh
+++ b/script/set_version.sh
@@ -30,34 +30,17 @@ k8s_version_label="app.kubernetes.io\/version"
 
 for f in $(find $location/../config/manager -type f -name "*.yaml");
 do
-  if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-    sed -i -r "s/image: .*/image: ${sanitized_image_name}:${version}/" $f
-    sed -i -r "s/${k8s_version_label}: .*/${k8s_version_label}: 
\""${version}"\"/" $f
-  elif [[ "$OSTYPE" == "darwin"* ]]; then
-    # Mac OSX
-    sed -i '' -E "s/image: .*/image: ${sanitized_image_name}:${version}/" $f
-    sed -i '' -E "s/${k8s_version_label}: .*/${k8s_version_label}: 
\""${version}"\"/" $f
-  fi
+  sed -i -r "s/image: .*/image: ${sanitized_image_name}:${version}/" $f
+  sed -i -r "s/${k8s_version_label}: .*/${k8s_version_label}: 
\""${version}"\"/" $f
 done
 
 for f in $(find $location/../config/manifests/bases -type f -name "*.yaml");
 do
-  if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-    sed -i -r "s/containerImage: .*/containerImage: 
${sanitized_image_name}:${version}/" $f
-  elif [[ "$OSTYPE" == "darwin"* ]]; then
-    # Mac OSX
-    sed -i '' -E "s/containerImage: .*/containerImage: 
${sanitized_image_name}:${version}/" $f
-  fi
+  sed -i -r "s/containerImage: .*/containerImage: 
${sanitized_image_name}:${version}/" $f
 done
 
 # Update helm chart
-if [[ "$OSTYPE" == "linux-gnu"* ]]; then
-  sed -i -r "s/image: .*/image: ${sanitized_image_name}:${version}/" 
$location/../helm/camel-k/values.yaml
-  sed -i -r "s/appVersion:\s([0-9]+[a-zA-Z0-9\-\.].*).*/appVersion: 
${version}/" $location/../helm/camel-k/Chart.yaml
-elif [[ "$OSTYPE" == "darwin"* ]]; then
-  # Mac OSX
-  sed -i '' -E 
"s/docker.io\/apache\/camel-k:([0-9]+[a-zA-Z0-9\-\.].*).*/${sanitized_image_name}:${version}/"
 $location/../helm/camel-k/values.yaml
-  sed -i '' -E "s/appVersion:\s([0-9]+[a-zA-Z0-9\-\.].*).*/appVersion: 
${version}/" $location/../helm/camel-k/Chart.yaml
-fi
+sed -i -r "s/image: .*/image: ${sanitized_image_name}:${version}/" 
$location/../helm/camel-k/values.yaml
+sed -i -r "s/appVersion:\s([0-9]+[a-zA-Z0-9\-\.].*).*/appVersion: ${version}/" 
$location/../helm/camel-k/Chart.yaml
 
 echo "Camel K version set to: $version and image name to: $image_name"

Reply via email to