1 | #!/bin/sh |
---|
2 | |
---|
3 | # Usage: ood-packages [-c|-r] [LOCATION] |
---|
4 | |
---|
5 | # Outputs a list of package names which are out of date in the apt |
---|
6 | # repository relative to the source tree. This script only deals with |
---|
7 | # regular Debian package sources, not equivs-built packages or |
---|
8 | # debathenify packages. This scripts assumes gen-packages has been |
---|
9 | # run to create the packages file. |
---|
10 | |
---|
11 | # If -c is specified, scans a checkout for current version |
---|
12 | # information. If -r is specified, scans the repository. -r is the |
---|
13 | # default. Using a checkout is faster but will give the wrong results |
---|
14 | # if the checkout is not up to date. This script is kind of slow |
---|
15 | # regardless, due to all of the reprepro invocations. |
---|
16 | |
---|
17 | # If LOCATION is specified, it is used in preference to the canonical |
---|
18 | # Athena repository trunk or the canonical source checkout. |
---|
19 | |
---|
20 | set -e |
---|
21 | |
---|
22 | : ${DEBATHENA_APT=/mit/debathena/apt} |
---|
23 | . $(dirname "$0")/debian-versions.sh |
---|
24 | |
---|
25 | die() { |
---|
26 | echo "$@" >&2 |
---|
27 | exit 1 |
---|
28 | } |
---|
29 | |
---|
30 | usage() { |
---|
31 | die "ood-packages [-r|-c] [LOCATION]" |
---|
32 | } |
---|
33 | |
---|
34 | type=repos |
---|
35 | |
---|
36 | while getopts cr opt; do |
---|
37 | case "$opt" in |
---|
38 | c) |
---|
39 | type=checkout |
---|
40 | ;; |
---|
41 | r) |
---|
42 | type=repos |
---|
43 | ;; |
---|
44 | \?) |
---|
45 | usage |
---|
46 | ;; |
---|
47 | esac |
---|
48 | done |
---|
49 | |
---|
50 | shift $(($OPTIND - 1)) |
---|
51 | if [ $# -gt 0 ]; then |
---|
52 | loc=$1 |
---|
53 | elif [ $type = repos ]; then |
---|
54 | loc=svn+ssh://svn.mit.edu/athena/trunk |
---|
55 | else |
---|
56 | loc=/afs/dev.mit.edu/source/src-svn |
---|
57 | fi |
---|
58 | |
---|
59 | packages=packages |
---|
60 | |
---|
61 | if [ ! -r "$packages" ]; then |
---|
62 | packages=/mit/debathena/packages/packages |
---|
63 | fi |
---|
64 | if [ ! -r "$packages" ]; then |
---|
65 | echo "Can't read packages file; create with gen-packages." >&2 |
---|
66 | exit 1 |
---|
67 | fi |
---|
68 | |
---|
69 | exec <"$packages" |
---|
70 | while read pkg path; do |
---|
71 | # Get the version from the apt repository, checking that it is |
---|
72 | # consistent across all dists. |
---|
73 | lastver= |
---|
74 | for dist in $DEBIAN_CODES; do |
---|
75 | aptver=$(reprepro -Vb "$DEBATHENA_APT" list "$dist" "$pkg" \ |
---|
76 | | awk '/source:/ { print $3 }') |
---|
77 | if [ -n "$lastver" -a "x$aptver" != "x$lastver" ]; then |
---|
78 | echo -n "WARNING: Inconsistent versions for $pkg: " |
---|
79 | echo "$lastdist $lastver != $dist $aptver" >&2 |
---|
80 | fi |
---|
81 | lastver=$aptver |
---|
82 | lastdist=$dist |
---|
83 | done |
---|
84 | |
---|
85 | # Get the current version from the checkout or repository. |
---|
86 | if [ $type = repos ]; then |
---|
87 | svn cat $loc/$path/debian/changelog > changelog |
---|
88 | cfile=changelog |
---|
89 | else |
---|
90 | cfile=$loc/$path/debian/changelog |
---|
91 | fi |
---|
92 | curver=$(dpkg-parsechangelog -l$cfile | sed -n 's/Version: //p') |
---|
93 | |
---|
94 | # Display the package name if the apt repository version does not |
---|
95 | # match the current version. |
---|
96 | if [ "x$aptver" != "x$curver" ]; then |
---|
97 | case "$pkg" in |
---|
98 | debathena-linerva*) |
---|
99 | ;; |
---|
100 | *) |
---|
101 | echo "$pkg" |
---|
102 | ;; |
---|
103 | esac |
---|
104 | fi |
---|
105 | done |
---|
106 | |
---|
107 | if [ $type = repos ]; then |
---|
108 | rm -rf changelog |
---|
109 | fi |
---|