# - 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=( )
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 ;;
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
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
*) 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 ..."