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

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