source: trunk/debathena/third/cyrus-sasl2-mit/debathenify-cyrus-sasl2-mit @ 22790

Revision 22790, 4.1 KB checked in by ghudson, 17 years ago (diff)
* debathena/third/cyrus-sasl2-mit/debian: Import from Debathena package. Based on the defunct Debian cyrus-sasl2-mit package materials, with substantial modification. * debathena/third/cyrus-sasl2-mit/debathena-cyrus-sasl2-mit: Debathenificator-style script to create the packages. Does not use the debathenificator back end since we're not directly modifying a native system package.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# This script follows the interface of debathenificator scripts but
4# does not itself use debathenificator because what we need to do
5# doesn't fit the model.  Most of the code here is copied from
6# debathenificator, but:
7#
8# 1. We don't do anything on platforms which already have a usable
9#    version of cyrus-sasl2-mit.
10#
11# 2. The version check is modified to check the native version of
12#    cybus-sasl2 (which we want to match) rather than cyrus-sasl2-mit
13#    (which does not exist on most of the platforms we want to build
14#    for).
15#
16# 3. cmd_source creates the source package by combining the tarfile
17#    from the native cyrus-sasl2 package with the packaging materials
18#    stored here (which are based on the now-defunct cyrus-sasl2-mit
19#    but are heavily modified).
20
21set -e
22
23: ${DEBATHENA_APT=/mit/debathena/apt}
24
25name=cyrus-sasl2-mit
26daversionappend=$(dpkg-parsechangelog -l$(dirname "$0")/debian/changelog |
27  sed -nre 's/Version: .*(debathena.*)$/\1/p')
28
29cmd_source() {
30  if [ "$a" != "-A" ]; then
31    echo "Not building source package for $dist_arch." >&2
32    return
33  fi
34
35  if [ ! -e "cyrus-sasl2_$version.dsc" ]; then
36    schroot -c "$chroot" -- apt-get -d source cyrus-sasl2
37  fi
38
39  if [ ! -e "${name}_$daversion.dsc" ]; then
40    tmpdir=$(mktemp -td "debathenify.$$.XXXXXXXXXX")
41    trap 'rm -rf "$tmpdir"' EXIT
42    pkgdir=$tmpdir/$name-$origversion
43    mkdir "$pkgdir"
44    cp -a $(dirname "$0")/debian "$pkgdir"
45    cp -a "cyrus-sasl2_$origversion.orig.tar.gz" "$pkgdir"
46    (cd $tmpdir && tar czf "${name}_$origversion.orig.tar.gz" \
47      "$name-$origversion/cyrus-sasl2_$origversion.orig.tar.gz")
48    perl -0pe "s/\@TARDIR\@/cyrus-sasl-$origversion/m or die" \
49      -i "$pkgdir/debian/rules"
50    (
51      sid=$(schroot -b -c "$chroot")
52      trap 'schroot -e -c "$sid"' EXIT
53      set -x
54      cd "$tmpdir/$name-$origversion"
55      schroot -r -c "$sid" -u root -- apt-get -q -y build-dep cyrus-sasl2
56      schroot -r -c "$sid" -u root -- apt-get -q -y install dbs
57      schroot -r -c "$sid" -u root -- apt-get -q -y install devscripts
58      schroot -r -c "$sid" -- debuild -S -sa -us -uc -i -I.svn
59    )
60    cp -a "$tmpdir/${name}_$daversion"* .
61    cp -a "$tmpdir/${name}_$origversion.orig.tar.gz" .
62  fi
63}
64
65cmd_binary () {
66  sbuildhack "$dist_arch" $a "${name}_$daversion.dsc"
67}
68
69v() {
70    echo "$@"
71    "$@"
72}
73
74cmd_upload () {
75  REPREPRO="v reprepro -Vb $DEBATHENA_APT"
76  REPREPROI="$REPREPRO --ignore=wrongdistribution --ignore=missingfield"
77   
78  case "$dist" in
79    sarge) tag='~debian3.1' ;;
80    etch) tag='~debian4.0' ;;
81    lenny) tag='~debian4.1~0.1' ;;
82    dapper) tag='~ubuntu6.06' ;;
83    edgy) tag='~ubuntu6.10' ;;
84    feisty) tag='~ubuntu7.04' ;;
85    gutsy) tag='~ubuntu7.10' ;;
86  esac
87   
88  if [ "$a" = "-A" ]; then
89    $REPREPROI include "$dist" "${name}_${daversion}_source.changes"
90  fi
91  $REPREPRO include "$dist" "${name}_${daversion}${tag}_${arch}.changes"
92}
93
94dist_arch=$1; shift
95a=
96if [ "$1" = "-A" ]; then a=-A; shift; fi
97chroot=$dist_arch-sbuild
98
99if [ -z "$dist_arch" -o $# -eq 0 ]; then
100  echo 'No arguments!' >&2
101  exit 2
102fi
103
104dist=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\1/')
105arch=$(echo "$dist_arch" | sed 's/^\(.*\)-\([^-]*\)$/\2/')
106
107case $dist in
108sarge|dapper|edgy)
109  echo "Native libsasl2-krb4-mit package exists; skipping $dist_arch." >&2
110  exit
111esac
112
113version=$(
114  schroot -q -c "$chroot" -- apt-cache showsrc cyrus-sasl2 | \
115    sed -n 's/^Version: \(.*\)$/\1/ p' | (
116      version='~~~'
117      while read -r newversion; do
118        if dpkg --compare-versions "$newversion" '>' "$version"; then
119          version=$newversion
120        fi
121      done
122      if [ "$version" = '~~~' ]; then
123        echo "No version of $name found." >&2
124        exit 1
125      fi
126      echo "$version"
127    )
128)
129origversion=$(echo "$version" | sed 's/-[^-]*$//')
130daversion=$origversion-0$daversionappend
131
132if zcat "$DEBATHENA_APT/dists/$dist/debathena-system/binary-$arch/Packages.gz" | \
133  dpkg-awk -f - "Source:^$name\$" "Version:^$daversion~" -- Architecture | \
134  if [ "$a" = "-A" ]; then cat; else fgrep -vx 'Architecture: all'; fi | \
135  grep -q .; then
136  echo "$name $daversion already exists for $dist_arch." >&2
137  exit 0
138fi
139
140for cmd; do
141  "cmd_$cmd"
142done
Note: See TracBrowser for help on using the repository browser.