~cyphermox/ubuntu-archive-tools/update-output-helper

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#! /bin/sh

# Copyright (C) 2009, 2010, 2011, 2012  Canonical Ltd.

# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

DIST="${DIST:-wily}"

MADISON="$(rmadison -a source -s "$DIST" "$1")"
[ "$MADISON" ] || exit 1

VER="$(echo "$MADISON" | cut -d'|' -f2 | tr -d ' ' | sed -r 's/^[0-9]+://')"
SECTION="$(echo "$MADISON" | cut -d'|' -f3 | tr -d ' ')"
case $SECTION in
	$DIST)
		SECTION=main
		;;
	$DIST/*)
		SECTION="${SECTION#$DIST/}"
		;;
esac
case $1 in
	lib?*)
		POOLINDEX="$(echo "$1" | cut -c 1-4)"
		;;
	*)
		POOLINDEX="$(echo "$1" | cut -c 1)"
		;;
esac

NL='
'
OLDIFS="$IFS"
IFS="$NL"
wget -q -O- http://changelogs.ubuntu.com/changelogs/pool/$SECTION/$POOLINDEX/$1/${1}_$VER/changelog | while read -r line; do
	IFS="$OLDIFS"
	case $line in
		[A-Za-z0-9]*)
			# changelog entry header
			target="$(echo "$line" | cut -d' ' -f3)"
			target="${target%;}"
			target="${target%%-*}"
			case $target in
				warty|hoary|breezy|dapper|edgy|feisty|gutsy|hardy|intrepid|jaunty|karmic|lucid|maverick|natty|oneiric|precise|quantal|raring|saucy|trusty|utopic|vivid|wily|devel)
					;;
				*)
					exit 0
					;;
			esac
			;;
	esac
	echo "$line"
	IFS="$NL"
done
IFS="$OLDIFS"