Unverified Commit 0c889e43 authored by Florian Klink's avatar Florian Klink Committed by GitHub
Browse files

buildRustCrate: also replace hyphens in CRATEVERSION (#423307)

parents 08f67066 c2f705ce
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -246,7 +246,10 @@ in
     IFS="$_OLDIFS"

     CRATENAME=$(echo ${crateName} | sed -e "s/\(.*\)-sys$/\U\1/" -e "s/-/_/g")
     CRATEVERSION=$(echo ${crateVersion} | sed -e "s/[\.\+]/_/g")
     # SemVer allows version numbers to contain alphanumeric characters and `.+-`
     # which aren't legal bash identifiers.
     # https://semver.org/#backusnaur-form-grammar-for-valid-semver-versions
     CRATEVERSION=$(echo ${crateVersion} | sed -e "s/[\.\+-]/_/g")
     grep -P "^cargo:(?!:?(rustc-|warning=|rerun-if-changed=|rerun-if-env-changed))" target/build/${crateName}.opt \
       | awk -F= "/^cargo::metadata=/ {  gsub(/-/, \"_\", \$2); print \"export \" toupper(\"DEP_$(echo $CRATENAME)_\" \$2) \"=\" \"\\\"\"\$3\"\\\"\"; next }
                  /^cargo:/ { sub(/^cargo::?/, \"\", \$1); gsub(/-/, \"_\", \$1); print \"export \" toupper(\"DEP_$(echo $CRATENAME)_\" \$1) \"=\" \"\\\"\"\$2\"\\\"\"; print \"export \" toupper(\"DEP_$(echo $CRATENAME)_$(echo $CRATEVERSION)_\" \$1) \"=\" \"\\\"\"\$2\"\\\"\"; next }" > target/env