source: trunk/debathena/scripts/ood-packages @ 24612

Revision 24612, 2.6 KB checked in by broder, 14 years ago (diff)
Deal with -proposed in ood-packages. If a package exists in -proposed, use that version for comparison instead of the version in production.
  • Property svn:executable set to *
Line 
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
20set -e
21
22. $(dirname "$0")/debian-versions.sh
23
24die() {
25  echo "$@" >&2
26  exit 1
27}
28
29usage() {
30  die "ood-packages [-r|-c] [LOCATION]"
31}
32
33type=repos
34
35while 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
47done
48
49shift $(($OPTIND - 1))
50if [ $# -gt 0 ]; then
51  loc=$1
52elif [ $type = repos ]; then
53  loc=svn+ssh://svn.mit.edu/athena/trunk
54else
55  loc=/afs/dev.mit.edu/source/src-svn
56fi
57
58packages=packages
59
60if [ ! -r "$packages" ]; then
61    packages=/mit/debathena/packages/packages
62fi
63if [ ! -r "$packages" ]; then
64  echo "Can't read packages file; create with gen-packages." >&2
65  exit 1
66fi
67
68exec <"$packages"
69while 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    if dareprepro list "${dist}-proposed" "$pkg" | grep -q 'source: '; then
75      release=-proposed
76    else
77      release=''
78    fi
79    aptver=$(dareprepro list "${dist}${release}" "$pkg" \
80          | awk '/source:/ { print $3 }')
81    if [ -n "$lastver" -a "x$aptver" != "x$lastver" ]; then
82      echo -n "WARNING: Inconsistent versions for $pkg: "
83      echo "$lastdist $lastver != $dist $aptver" >&2
84    fi
85    lastver=$aptver
86    lastdist=$dist
87  done
88
89  # Get the current version from the checkout or repository.
90  if [ $type = repos ]; then
91    svn cat $loc/$path/debian/changelog > changelog
92    cfile=changelog
93  else
94    cfile=$loc/$path/debian/changelog
95  fi
96  curver=$(dpkg-parsechangelog -l$cfile | sed -n 's/Version: //p')
97
98  # Display the package name if the apt repository version does not
99  # match the current version.
100  if [ "x$aptver" != "x$curver" ]; then
101    case "$pkg" in
102      debathena-linerva*)
103      ;;
104      *)
105        echo "$pkg"
106      ;;
107    esac
108  fi
109done
110
111if [ $type = repos ]; then
112  rm -rf changelog
113fi
Note: See TracBrowser for help on using the repository browser.