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

Revision 24565, 2.5 KB checked in by broder, 15 years ago (diff)
Add a dareprepro script. Since there are a handful of arguments that we *always* pass to reprepro, add a wrapper for reprepro that passes them for us.
  • 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    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
104done
105
106if [ $type = repos ]; then
107  rm -rf changelog
108fi
Note: See TracBrowser for help on using the repository browser.