source: trunk/debathena/scripts/daupload-release @ 22977

Revision 22977, 2.7 KB checked in by broder, 16 years ago (diff)
Desupport Sarge - the new version of sbuild doesn't play nice with sarge, and we don't care enough to fix it
  • Property svn:executable set to *
Line 
1#!/bin/sh
2set -e
3
4# Usage: daupload-release [-A] [-S] CHANGESFILE
5#        daupload-beta [-A] [-S] CHANGESFILE
6
7# After a package has been built for all Debian/Ubuntu versions and
8# platforms (typically using "da sbuildhack DSCFILE"), this script
9# uploads the package into the release or beta apt repository.  If -A
10# is specified, only one architecture per Debian/Ubuntu version is
11# uploaded.  If -S is specified, only the source package is uploaded.
12
13# Upon completion, moves all of the generated files into the "built"
14# subdirectory.
15
16: ${DEBATHENA_APT=/mit/debathena/apt}
17. $(dirname "$0")/debian-versions.sh
18
19case "$(basename "$0")" in
20    daupload-release)
21        repo=$DEBATHENA_APT
22        ;;
23    daupload-beta)
24        repo=${DEBATHENA_APT}-beta
25        ;;
26    *)
27        echo "Unknown repo." >&2
28        exit 1
29        ;;
30esac
31
32v () {
33    echo "$@"
34    "$@"
35}
36
37A=0
38if [ "$1" = "-A" ]; then A=1; shift; fi
39S=0
40if [ "$1" = "-S" ]; then S=1; shift; fi
41
42change=$1
43cd "$(dirname "$change")"
44change=$(basename "$change")
45base=${change%_source.changes}
46
47check () {
48    [ -s "$1" ] || missing="$missing$1 "
49}
50uncheck () {
51    ! [ -s "$1" ] || missing="$missing-$1 "
52}
53
54missing=
55[ -s "$change" ]
56if [ $S -ne 1 ]; then
57    for code in $DEBIAN_CODES; do
58        tag=$(gettag "$code")
59        check "${base}${tag}_amd64.changes"
60    done
61    if [ $A -eq 1 ]; then
62        for code in $DEBIAN_CODES; do
63            tag=$(gettag "$code")
64            uncheck "${base}${tag}_i386.changes"
65        done
66    else
67        for code in $DEBIAN_CODES; do
68            tag=$(gettag "$code")
69            check "${base}${tag}_i386.changes"
70        done
71    fi
72fi
73
74if [ -n "$missing" ]; then
75    echo "Missing $missing" >&2
76    echo -n "Continue? [y/N]"
77    read a
78    [ "$a" = "y" ]
79fi
80
81REPREPRO="v reprepro -Vb $repo"
82REPREPROI="$REPREPRO --ignore=wrongdistribution"
83
84for code in $DEBIAN_CODES; do
85    $REPREPROI include "$code" "$change"
86done
87
88if [ $S -ne 1 ]; then
89    for code in $DEBIAN_CODES; do
90        tag=$(gettag "$code")
91        [ $A -eq 1 ] || $REPREPRO include "$code" "${base}${tag}_i386.changes"
92        $REPREPRO include "$code" "${base}${tag}_amd64.changes"
93    done
94fi
95
96changes=$change
97for code in $DEBIAN_CODES; do
98    tag=$(gettag "$code")
99    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
100    changes=$changes\ "${base}${tag}"_amd64.changes
101done
102
103files=${change%.changes}.build\ $changes
104origfiles=
105for change in $changes; do
106    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
107    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
108done
109
110built=built/
111[ -d "$built" ] || mkdir "$built"
112mv -i $files "$built"
113if [ -n "$origfiles" ]; then
114    for orig in $origfiles; do
115        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
116    done
117fi
Note: See TracBrowser for help on using the repository browser.