aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-08-31 23:56:25 +0000
committerMichael Mann <mmann78@netscape.net>2017-09-20 11:56:19 +0000
commitee4c70b92cfa0b44eed3d0d07078f943ce34c56a (patch)
treeb2f1acf42764ec4bc1682cc21a62d6923041bfe6 /tools
parent72415b50661c639d0f1fb7e261241da73cd4867c (diff)
Add version.conf to git-export-release.
Create and stash version.conf before archiving our repository. This makes git-export-release behave more like the current Autotools dist target. Make sure the `git describe` command in git-export-release and make-version.pl use the same match pattern and abbreviation length. Abbreviate to 8 characters. That's our current unique minimum according to the git-unique-abbrev script at https://blog.cuviper.com/2013/11/10/how-short-can-git-abbreviate/ : 516409 objects 4: 516194 / 65293 5: 200900 / 92205 6: 15979 / 7957 7: 1038 / 519 8: 74 / 37 9: 0 / 0 Change-Id: Id2279a59a2e24a9ecd816458f399bcd2b4c94185 Reviewed-on: https://code.wireshark.org/review/23344 Reviewed-by: Peter Wu <peter@lekensteyn.nl> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/git-export-release.sh28
1 files changed, 27 insertions, 1 deletions
diff --git a/tools/git-export-release.sh b/tools/git-export-release.sh
index 729c4703eb..233ab9f8fe 100755
--- a/tools/git-export-release.sh
+++ b/tools/git-export-release.sh
@@ -31,6 +31,32 @@ COMMIT="HEAD"
if test -n "$1"; then
COMMIT="$1"
fi
-VERSION=$(git describe --tags ${COMMIT} | sed 's/^v//')
+
+if [ ! -e "${GIT_DIR:-.git}" ] ; then
+ echo "Must be run from the top-level repository directory."
+ exit 1
+fi
+
+# --abbrev=<n> and --match should match make-version.pl.
+DESCRIPTION=$(git describe --abbrev=8 --match "v[1-9]*" ${COMMIT})
+VERSION=${DESCRIPTION#v}
+STASH_POP=False
+
+if [ "$COMMIT" == "HEAD" ] ; then
+ echo "Adding description $DESCRIPTION"
+ echo "git_description=$DESCRIPTION" >> version.conf
+ git add version.conf
+ git stash --keep-index
+ COMMIT="stash@{0}"
+ STASH_POP=True
+else
+ echo "Not archiving HEAD. Skipping description."
+fi
+
+echo "Creating wireshark-$VERSION.tar.xz"
git archive --prefix=wireshark-${VERSION}/ ${COMMIT} | xz > wireshark-${VERSION}.tar.xz
+
+if [ "$STASH_POP" == "True" ] ; then
+ git stash pop
+fi