~john-koepi/ubuntu/trusty/golang/default

« back to all changes in this revision

Viewing changes to .pc/010-getgoversion_from_debian_changelog.patch/src/version.bash

  • Committer: Bazaar Package Importer
  • Author(s): Ondřej Surý
  • Date: 2011-08-03 17:04:59 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20110803170459-wzd99m3567y80ila
Tags: 1:59-1
* Imported Upstream version 59
* Refresh patches to a new release
* Fix FTBFS on ARM (Closes: #634270)
* Update version.bash to work with Debian packaging and not hg
  repository

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/env bash
 
2
# Copyright 2010 The Go Authors. All rights reserved.
 
3
# Use of this source code is governed by a BSD-style
 
4
# license that can be found in the LICENSE file.
 
5
 
 
6
# Check that we can use 'hg'
 
7
if ! hg version > /dev/null 2>&1; then
 
8
        echo 'hg not installed' 1>&2
 
9
        exit 2
 
10
fi
 
11
 
 
12
# Get numerical revision
 
13
VERSION=$(hg identify -n 2>/dev/null)
 
14
if [ $? != 0 ]; then
 
15
        OLD=$(hg identify | sed 1q)
 
16
        VERSION=$(echo $OLD | awk '{print $1}')
 
17
fi
 
18
 
 
19
# Get branch type
 
20
BRANCH=release
 
21
if [ "$(hg identify -b 2>/dev/null)" == "default" ]; then
 
22
        BRANCH=weekly
 
23
fi
 
24
 
 
25
# Find most recent known release or weekly tag.
 
26
TAG=$(hg tags |
 
27
        grep $BRANCH |
 
28
        sed 's/:.*//' |
 
29
        sort -rn -k2 |
 
30
        awk -v ver=$VERSION '$2 <= ver && $1~/^(release|weekly)\./ {print $1}' |
 
31
        sed -n 1p)
 
32
 
 
33
if [ "$TAG" != "" ]; then
 
34
        VERSION="$TAG $VERSION"
 
35
fi
 
36
 
 
37
echo $VERSION
 
38