summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-07-08 09:51:43 +0200
committerOndřej Surý <ondrej@sury.org>2011-07-18 11:33:01 +0200
commitcf1c39b9324859fd196d317d4c9f9c5e60ee632f (patch)
treee5c095c0d5b9393d282e0eb1aa53f3d182a21390
parent0448fb0d14fc8d7403a968e55a34772ef8de062e (diff)
downloadgolang-cf1c39b9324859fd196d317d4c9f9c5e60ee632f.tar.gz
Update version.bash to work with Debian packaging and not hg repository
-rw-r--r--debian/patches/010-getgoversion_from_debian_changelog.patch46
-rw-r--r--debian/patches/series1
2 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/010-getgoversion_from_debian_changelog.patch b/debian/patches/010-getgoversion_from_debian_changelog.patch
new file mode 100644
index 000000000..1729f0b69
--- /dev/null
+++ b/debian/patches/010-getgoversion_from_debian_changelog.patch
@@ -0,0 +1,46 @@
+--- a/src/version.bash
++++ b/src/version.bash
+@@ -3,36 +3,25 @@
+ # Use of this source code is governed by a BSD-style
+ # license that can be found in the LICENSE file.
+
+-# Check that we can use 'hg'
+-if ! hg version > /dev/null 2>&1; then
+- echo 'hg not installed' 1>&2
+- exit 2
+-fi
++cd $(dirname $0)/..
+
+ # Get numerical revision
+-VERSION=$(hg identify -n 2>/dev/null)
+-if [ $? != 0 ]; then
+- OLD=$(hg identify | sed 1q)
+- VERSION=$(echo $OLD | awk '{print $1}')
+-fi
++# DEBIAN: We don't have a numerical revision
++VERSION=
+
+ # Get branch type
++# DEBIAN: Get release/weekly from source package name
+ BRANCH=release
+-if [ "$(hg identify -b 2>/dev/null)" == "default" ]; then
++if [ "$(dpkg-parsechangelog | sed -n 's/Source: golang-//p;')" == "" ]; then
+ BRANCH=weekly
+ fi
+
+ # Find most recent known release or weekly tag.
+-TAG=$(hg tags |
+- grep $BRANCH |
+- sed 's/:.*//' |
+- sort -rn -k2 |
+- awk -v ver=$VERSION '$2 <= ver && $1~/^(release|weekly)\./ {print $1}' |
+- sed -n 1p)
++# DEBIAN: get tag from Debian changelog version
++TAG=$BRANCH.$(dpkg-parsechangelog | sed -n 's/Version: \([^-]*\)-.*/\1/p;')
+
+ if [ "$TAG" != "" ]; then
+ VERSION="$TAG $VERSION"
+ fi
+
+ echo $VERSION
+-
diff --git a/debian/patches/series b/debian/patches/series
index 11d541638..a35fdde47 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -5,3 +5,4 @@
007-use_native_dynamic_linker_on_kfreebsd.patch
008-emacs-mode-key-literal-indent.patch
009-goinstall_can_install_to_GOPATH.patch
+010-getgoversion_from_debian_changelog.patch