From: Willy Tarreau Date: Fri, 9 Jun 2017 13:54:39 +0000 (+0200) Subject: BUILD: scripts: add an automatic mode for publish-release X-Git-Tag: v1.8-dev3~297 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7ca88159a18682e413258444b1c087203f598a46;p=thirdparty%2Fhaproxy.git BUILD: scripts: add an automatic mode for publish-release Passing "-a" will make it easier to automatically create archives from tagged repositories. It doesn't ask any question and doesn't return an error when the current branch is not tagged nor if the release already exists. --- diff --git a/scripts/publish-release b/scripts/publish-release index 8a1645e464..e2b22303a6 100755 --- a/scripts/publish-release +++ b/scripts/publish-release @@ -8,12 +8,13 @@ # - copies & compresses files, changelog & docs to the final destination # - shows a listing of the final file -USAGE="Usage: ${0##*/} [-y] [-b branch] [-n newver] DIR" +USAGE="Usage: ${0##*/} [-a] [-y] [-b branch] [-n newver] DIR" TARGET_DIR= OUTPUT= SAYYES= BRANCH= DEVEL= +AUTO= NEW= DIR= DOC=( ) @@ -34,6 +35,7 @@ quit() { while [ -n "$1" -a -z "${1##-*}" ]; do case "$1" in + -a) AUTO=1 ; shift ;; -y) SAYYES=1 ; shift ;; -b) BRANCH="$2" ; shift 2 ;; -n) NEW="$2" ; shift 2 ;; @@ -84,13 +86,19 @@ if [ "$(git diff HEAD 2>/dev/null |wc -c)" != 0 ]; then die fi -if [ -z "$NEW" ]; then - NEW="$(git describe --tags HEAD --abbrev=0)" - NEW="${NEW#v}" +if [ -z "$NEW" -o -n "$AUTO" ]; then if [ -z "$NEW" ]; then - die "Fatal: cannot determine new version, please specify it." + NEW="$(git describe --tags HEAD --abbrev=0)" + NEW="${NEW#v}" + if [ -z "$NEW" ]; then + die "Fatal: cannot determine new version, please specify it." + fi fi + if [ "$(git describe --tags HEAD)" != "v$NEW" ]; then + if [ -n "$AUTO" ]; then + quit "Not tagged, nothing to do." + fi die "Current version doesn't seem tagged, it reports $(git describe --tags "v$NEW"). Did you release it ?" fi fi @@ -117,6 +125,10 @@ if [ -z "${NEW##*-dev*}" ]; then DEVEL="/devel" fi +if [ -n "$AUTO" -a -e "$TARGET_DIR/src${DEVEL}/haproxy-$NEW.tar.gz.md5" ]; then + quit "Version $NEW Already released." +fi + if ! mkdir -p "$TARGET_DIR/src$DEVEL" "$TARGET_DIR/doc"; then die "failed to create target directories." fi @@ -129,17 +141,19 @@ case "$BRANCH" in *) DOC=( doc/{coding-style,intro,management,configuration,proxy-protocol,lua,SPOE}.txt ) ;; esac -echo "Ready to produce the following files in $TARGET_DIR/ :" -echo " haproxy-$NEW.tar.gz -> src${DEVEL}/" -echo " CHANGELOG -> src/CHANGELOG" -echo " ${DOC[@]} -> doc/*{,.gz}" -echo +if [ -z "$AUTO" ]; then + echo "Ready to produce the following files in $TARGET_DIR/ :" + echo " haproxy-$NEW.tar.gz -> src${DEVEL}/" + echo " CHANGELOG -> src/CHANGELOG" + echo " ${DOC[@]} -> doc/*{,.gz}" + echo -git ls-tree -l --abbrev=12 "v$NEW" -- CHANGELOG "${DOC[@]}" + git ls-tree -l --abbrev=12 "v$NEW" -- CHANGELOG "${DOC[@]}" -if [ -z "$SAYYES" ]; then - echo "Press ENTER to continue or Ctrl-C to abort now!" - read + if [ -z "$SAYYES" ]; then + echo "Press ENTER to continue or Ctrl-C to abort now!" + read + fi fi echo "Archiving sources for version $NEW ..."