source: trunk/debathena/scripts/dadch @ 22688

Revision 22688, 1.4 KB checked in by ghudson, 17 years ago (diff)
Add leading comments documenting (hopefully correctly) the scripts snapshotted from /mit/debathena/bin. * debathena/scripts/dadch, debathena/scripts/clean-schroot, debathena/scripts/da, debathena/scripts/daequivsupload, debathena/scripts/upgrade-schroot, debathena/scripts/daupload-release, debathena/scripts/sbuildhack, debathena/scripts/all-schroots: Comment.
  • Property svn:executable set to *
RevLine 
[22687]1#!/bin/bash
2
[22688]3# Usage: dadch
4
5# Wrapper around dch for Debathena.  Increments the version number
6# according to Debathena rules if the current version has been
7# released, and leaves it alone otherwise.
8
[22687]9if [ -e debian/changelog ]; then
10    debian=debian
11elif [ "$(basename "$PWD")" = debian ] && [ -e changelog ]; then
12    debian=.
13else
14    echo "Cannot find debian/changelog." >&2
15    exit 1
16fi
17
18package=$(head -n1 "$debian/changelog" | sed -n 's/^\([^ ]*\).*$/\1/ p')
19version=$(head -n1 "$debian/changelog" | sed -n 's/^[^ ]* (\([^)]*\)).*$/\1/ p')
20if [ -z "$package" ] || [ -z "$version" ]; then
21    echo "Invalid debian/changelog." >&2
22fi
23
24dch_opts=()
25
26newversion=$(
27    newversion=$version
28    dpkg-awk -f <(zcat /mit/debathena/apt*/dists/*/*/source/Sources.gz) \
29        'Package:^'"$package"'$' -- Version | \
30        sed -n 's/Version: // p' | \
31        (
32            while read aptversion; do
33                if dpkg --compare-versions "$aptversion" '>=' "$newversion"; then
34                    newversion=$(
35                        echo "$aptversion" | \
36                            sed -n 's/debathena\([0-9]*\)/ \1/ p' | \
37                            (
38                                if read -r base darelease; then
39                                    echo "${base}debathena$(($darelease + 1))"
40                                else
41                                    echo "${aptversion}debathena1"
42                                fi
43                            )
44                    )
45                fi
46            done
47            echo "$newversion"
48        )
49)
50
51if [ "$newversion" != "$version" ]; then
52    echo "Changing version to $newversion"
53    dch_opts+=(--newversion "$newversion" --distribution unstable)
54fi
55
56dch "${dch_opts[@]}" "$@"
Note: See TracBrowser for help on using the repository browser.