chiark / gitweb /
devscripts (2.10.69+squeeze4) stable-security; urgency=high
[devscripts.git] / scripts / archpath.sh
1 #! /bin/bash -e
2
3 # Output arch (tla/Bazaar) archive names, with support for branches
4
5 # Copyright (C) 2005 Colin Watson <cjwatson@debian.org>
6
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option) any
10 # later version.
11 #
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19
20 # Which arch implementation should we use?
21 if type baz >/dev/null 2>&1; then
22         PROGRAM=baz
23 else
24         PROGRAM=tla
25 fi
26
27 WANTED="$1"
28 ME="$($PROGRAM tree-version)"
29
30 if [ "$WANTED" ]; then
31         ARCHIVE="$($PROGRAM parse-package-name --arch "$ME")"
32         CATEGORY="$($PROGRAM parse-package-name --category "$ME")"
33         case $WANTED in
34                 *--*)
35                         echo "$ARCHIVE/$CATEGORY--$WANTED"
36                         ;;
37                 *)
38                         VERSION="$($PROGRAM parse-package-name --vsn "$ME")"
39                         echo "$ARCHIVE/$CATEGORY--$WANTED--$VERSION"
40                         ;;
41         esac
42 else
43         echo "$ME"
44 fi