From d76ee8f5345bd45cff3b86a428e68a4798e6c356 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Thu, 17 Mar 2016 17:06:11 +0100 Subject: [PATCH] Further update for #1765 --- extra/shutils/postcommit-hook | 20 ++++++++++++++++++++ extra/shutils/precommit-hook | 2 +- lib/core/settings.py | 2 +- 3 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 extra/shutils/postcommit-hook diff --git a/extra/shutils/postcommit-hook b/extra/shutils/postcommit-hook new file mode 100644 index 000000000..7bd5f16c9 --- /dev/null +++ b/extra/shutils/postcommit-hook @@ -0,0 +1,20 @@ +#!/bin/bash + +SETTINGS="../../lib/core/settings.py" + +declare -x SCRIPTPATH="${0}" + +FULLPATH=${SCRIPTPATH%/*}/$SETTINGS + +if [ -f $FULLPATH ] +then + LINE=$(grep -o ${FULLPATH} -e 'VERSION = "[0-9.]*"'); + declare -a LINE; + NEW_TAG=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); print '.'.join(_[:-1]) if len(_) == 4 and _[-1] == '0' else ''" "$LINE") + if [ -n "$NEW_TAG" ] + then + echo "Creating new tag ${NEW_TAG}"; + git tag $NEW_TAG; + #git push origin $NEW_TAG + fi +fi; diff --git a/extra/shutils/precommit-hook b/extra/shutils/precommit-hook index f12e53b8b..2b9a506c9 100644 --- a/extra/shutils/precommit-hook +++ b/extra/shutils/precommit-hook @@ -10,7 +10,7 @@ if [ -f $FULLPATH ] then LINE=$(grep -o ${FULLPATH} -e 'VERSION = "[0-9.]*"'); declare -a LINE; - INCREMENTED=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); _.append(0) if len(_) < 3 else _; _[-1] = str(int(_[-1]) + 1); month = str(time.gmtime().tm_mon); _[-1] = '1' if _[-2] != month else _[-1]; _[-2] = month; print sys.argv[1].replace(version, '.'.join(_))" "$LINE") + INCREMENTED=$(python -c "import re, sys, time; version = re.search('\"([0-9.]*)\"', sys.argv[1]).group(1); _ = version.split('.'); _.append(0) if len(_) < 3 else _; _[-1] = str(int(_[-1]) + 1); month = str(time.gmtime().tm_mon); _[-1] = '0' if _[-2] != month else _[-1]; _[-2] = month; print sys.argv[1].replace(version, '.'.join(_))" "$LINE") if [ -n "$INCREMENTED" ] then sed "s/${LINE}/${INCREMENTED}/" $FULLPATH > $FULLPATH.tmp && mv $FULLPATH.tmp $FULLPATH diff --git a/lib/core/settings.py b/lib/core/settings.py index 4700897de..f461fbacc 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.3.2" +VERSION = "1.0.3.3" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")