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 | . $(dirname "$0")/debian-versions.sh |
---|
23 | |
---|
24 | die() { |
---|
25 | echo "$@" >&2 |
---|
26 | exit 1 |
---|
27 | } |
---|
28 | |
---|
29 | usage() { |
---|
30 | die "ood-packages [-r|-c] [LOCATION]" |
---|
31 | } |
---|
32 | |
---|
33 | type=repos |
---|
34 | |
---|
35 | while getopts cr opt; do |
---|
36 | case "$opt" in |
---|
37 | c) |
---|
38 | type=checkout |
---|
39 | ;; |
---|
40 | r) |
---|
41 | type=repos |
---|
42 | ;; |
---|
43 | \?) |
---|
44 | usage |
---|
45 | ;; |
---|
46 | esac |
---|
47 | done |
---|
48 | |
---|
49 | shift $(($OPTIND - 1)) |
---|
50 | if [ $# -gt 0 ]; then |
---|
51 | loc=$1 |
---|
52 | elif [ $type = repos ]; then |
---|
53 | loc=svn+ssh://svn.mit.edu/athena/trunk |
---|
54 | else |
---|
55 | loc=/afs/dev.mit.edu/source/src-svn |
---|
56 | fi |
---|
57 | |
---|
58 | packages=packages |
---|
59 | |
---|
60 | if [ ! -r "$packages" ]; then |
---|
61 | packages=/mit/debathena/packages/packages |
---|
62 | fi |
---|
63 | if [ ! -r "$packages" ]; then |
---|
64 | echo "Can't read packages file; create with gen-packages." >&2 |
---|
65 | exit 1 |
---|
66 | fi |
---|
67 | |
---|
68 | exec <"$packages" |
---|
69 | while read pkg path; do |
---|
70 | # Get the version from the apt repository, checking that it is |
---|
71 | # consistent across all dists. |
---|
72 | lastver= |
---|
73 | for dist in $DEBIAN_CODES; do |
---|
74 | aptver=$(dareprepro list "$dist" "$pkg" \ |
---|
75 | | awk '/source:/ { print $3 }') |
---|
76 | if [ -n "$lastver" -a "x$aptver" != "x$lastver" ]; then |
---|
77 | echo -n "WARNING: Inconsistent versions for $pkg: " |
---|
78 | echo "$lastdist $lastver != $dist $aptver" >&2 |
---|
79 | fi |
---|
80 | lastver=$aptver |
---|
81 | lastdist=$dist |
---|
82 | done |
---|
83 | |
---|
84 | # Get the current version from the checkout or repository. |
---|
85 | if [ $type = repos ]; then |
---|
86 | svn cat $loc/$path/debian/changelog > changelog |
---|
87 | cfile=changelog |
---|
88 | else |
---|
89 | cfile=$loc/$path/debian/changelog |
---|
90 | fi |
---|
91 | curver=$(dpkg-parsechangelog -l$cfile | sed -n 's/Version: //p') |
---|
92 | |
---|
93 | # Display the package name if the apt repository version does not |
---|
94 | # match the current version. |
---|
95 | if [ "x$aptver" != "x$curver" ]; then |
---|
96 | case "$pkg" in |
---|
97 | debathena-linerva*) |
---|
98 | ;; |
---|
99 | *) |
---|
100 | echo "$pkg" |
---|
101 | ;; |
---|
102 | esac |
---|
103 | fi |
---|
104 | done |
---|
105 | |
---|
106 | if [ $type = repos ]; then |
---|
107 | rm -rf changelog |
---|
108 | fi |
---|