aboutsummaryrefslogtreecommitdiffstats
path: root/packaging
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2019-01-11 22:34:03 +0000
committerGerald Combs <gerald@wireshark.org>2019-01-14 17:41:43 +0000
commit290214adc986cc5f8bbbf87df023c290f32d982d (patch)
tree40d237c5aa4f59d18d0293d705d145ba803e7260 /packaging
parentc3d198c401d5ec17289159cc88e2f891070e7779 (diff)
tarball+RPM: Fetch our version from CMake.
Move git-export-release.sh to packaging/source. Have the source and RPM packaging derive version information from CMake's VERSION variable. This brings them in line with the rest of our packaging and avoids having to read chicken entrails^W^Wgit output. Make sure we always generate wireshark.spec. Bug: 15359 Change-Id: I188efda489c94449a10a612abebf9c2872c305cb Reviewed-on: https://code.wireshark.org/review/31504 Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Gerald Combs <gerald@wireshark.org>
Diffstat (limited to 'packaging')
-rw-r--r--packaging/rpm/wireshark.spec.in3
-rwxr-xr-xpackaging/source/git-export-release.sh.in60
2 files changed, 61 insertions, 2 deletions
diff --git a/packaging/rpm/wireshark.spec.in b/packaging/rpm/wireshark.spec.in
index 066437ce7f..a9c391fb4d 100644
--- a/packaging/rpm/wireshark.spec.in
+++ b/packaging/rpm/wireshark.spec.in
@@ -3,7 +3,6 @@
# says that recent CMake versions take care of rpathification.
# To do:
-# - Find a better way to sync with git-export-release.sh.
# - Set version in version.h
# - Add bcond_with clang
@@ -32,7 +31,7 @@
# are set.
%global use_wireshark_group 1
-%global package_version @_git_description@
+%global package_version @VERSION@
Summary: Wireshark is the world's foremost protocol analyzer
diff --git a/packaging/source/git-export-release.sh.in b/packaging/source/git-export-release.sh.in
new file mode 100755
index 0000000000..ce1b0ca897
--- /dev/null
+++ b/packaging/source/git-export-release.sh.in
@@ -0,0 +1,60 @@
+#!/bin/bash
+#
+# Creates a release tarball directly from git
+
+# Note that the tarball contents might not exactly match
+# a particular git commit, particularly for untagged
+# commits.
+#
+# An alternative approach would be to generate source tarballs
+# using CPack. That would remove our dependency on git, but if
+# Autotools is any indication it would require continuous
+# maintenance.
+#
+# Copyright 2011 Balint Reczey <balint@balintreczey.hu>
+#
+# Wireshark - Network traffic analyzer
+# By Gerald Combs <gerald@wireshark.org>
+# Copyright 1998 Gerald Combs
+#
+# SPDX-License-Identifier: GPL-2.0-or-later
+
+set -e
+
+DESTDIR=.
+
+while getopts "d:" OPTCHAR ; do
+ case $OPTCHAR in
+ d) DESTDIR=$OPTARG ;;
+ *) printf "Unknown option %s\n" "$OPTCHAR" ;;
+ esac
+done
+shift $(( OPTIND - 1 ))
+
+# The remaining parameter, if set, is a package version such as 3.4.5
+# or 3.4.5-67-gabcd4321
+# By default the version from make-version.pl + CMake is used.
+VERSION=@VERSION@
+if test -n "$1"; then
+ VERSION="$1"
+fi
+
+STASH_POP=false
+XZ_OPTS=
+
+COMMIT="HEAD"
+if ! git diff-index --quiet HEAD ; then
+ git stash --keep-index
+ COMMIT="stash@{0}"
+ STASH_POP=true
+fi
+
+echo "Creating wireshark-$VERSION.tar.xz"
+
+echo . | xz --threads=0 > /dev/null 2>&1 && XZ_OPTS=--threads=0
+
+git archive --prefix="wireshark-${VERSION}/" ${COMMIT} | xz $XZ_OPTS > "${DESTDIR}/wireshark-${VERSION}.tar.xz"
+
+if $STASH_POP ; then
+ git stash pop
+fi