88
99basedir=$( dirname $0 )
1010GIT_COMMIT=$( git rev-parse HEAD)
11- RELEASE_VERSION=
12- RELEASE_SUBVERSION=
11+ RELEASE_VERSION=${RELEASE_VERSION :- " " }
12+ RELEASE_SUBVERSION=${RELEASE_SUBVERSION :- " " }
1313release_base_path=/tmp/orchestrator-release
1414export RELEASE_VERSION release_base_path
1515
@@ -36,8 +36,8 @@ usage() {
3636 echo " -R retain existing build/deployment paths"
3737 echo " -p build prefix Default:(/usr/local)"
3838 echo " -r build with race detector"
39- echo " -v release version (optional; default: content of RELEASE_VERSION file)"
40- echo " -s release subversion (optional; default: empty)"
39+ echo " -v release version (optional; default: the value of RELEASE_VERSION environment variable, or content of RELEASE_VERSION file)"
40+ echo " -s release subversion (optional; default: the value of RELEASE_SUBVERSION environment variable, or empty)"
4141 echo
4242}
4343
@@ -227,9 +227,13 @@ package_linux() {
227227 [ $do_rpm -eq 1 ] && fpm -v " ${RELEASE_VERSION} " --epoch 1 -f -s dir -n orchestrator-client -m shlomi-noach --description " MySQL replication topology management and HA: client script" --url " https://github.com/openark/orchestrator" --vendor " GitHub" --license " Apache 2.0" -C $build_path /orchestrator-client --prefix=/ --depends ' jq >= 1.5' -t rpm .
228228 [ $do_deb -eq 1 ] && fpm -v " ${RELEASE_VERSION} " --epoch 1 -f -s dir -n orchestrator-client -m shlomi-noach --description " MySQL replication topology management and HA: client script" --url " https://github.com/openark/orchestrator" --vendor " GitHub" --license " Apache 2.0" -C $build_path /orchestrator-client --prefix=/ --depends ' jq >= 1.5' -t deb --deb-no-default-config-files .
229229
230- if [ ! -z " $package_name_extra " ] ; then
231- ls * .rpm | while read f; do package_file=$( echo $f | sed -r -e " s/^(.*)-${RELEASE_VERSION} (.*)/\1${package_name_extra} -${RELEASE_VERSION} \2/g" ) ; mv $f $package_file ; done
232- ls * .deb | while read f; do package_file=$( echo $f | sed -r -e " s/^(.*)_${RELEASE_VERSION} (.*)/\1${package_name_extra} -${RELEASE_VERSION} \2/g" ) ; mv $f $package_file ; done
230+ if [ -n " $package_name_extra " ] ; then
231+ # Strip version core out of sting like "3.2.6-pre123+g1234567" to "3.2.6".
232+ # We need it because `-` is converted to `_` in rpm package name,
233+ # and `+` have a special meaning for `sed`.
234+ VERSION_CORE=$( echo $RELEASE_VERSION | sed -r -e " s/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/g" )
235+ ls * .rpm | while read f; do package_file=$( echo $f | sed -r -e " s/^(.*)-${VERSION_CORE} (.*)/\1${package_name_extra} -${VERSION_CORE} \2/g" ) ; mv $f $package_file ; done
236+ ls * .deb | while read f; do package_file=$( echo $f | sed -r -e " s/^(.*)_${VERSION_CORE} (.*)/\1${package_name_extra} -${VERSION_CORE} \2/g" ) ; mv $f $package_file ; done
233237 fi
234238
235239 debug " packeges:"
0 commit comments