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

Revision 22751, 3.1 KB checked in by ghudson, 17 years ago (diff)
* debathena/scripts/daupload-release: Fix typo.
  • 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        if [ "$code" = "sarge" ]; then
59            check "$base~debian3.1_i386.changes"
60        else
61            tag=$(gettag "$code")
62            check "${base}${tag}_amd64.changes"
63        fi
64    done
65    if [ $A -eq 1 ]; then
66        for code in $DEBIAN_CODES; do
67            if [ "$code" = "sarge" ]; then
68                true;
69            else
70                tag=$(gettag "$code")
71                uncheck "${base}${tag}_i386.changes"
72            fi
73        done
74    else
75        for code in $DEBIAN_CODES; do
76            if [ "$code" = "sarge" ]; then
77                true;
78            else
79                tag=$(gettag "$code")
80                check "${base}${tag}_i386.changes"
81            fi
82        done
83    fi
84fi
85
86if [ -n "$missing" ]; then
87    echo "Missing $missing" >&2
88    echo -n "Continue? [y/N]"
89    read a
90    [ "$a" = "y" ]
91fi
92
93REPREPRO="v reprepro -Vb $repo"
94REPREPROI="$REPREPRO --ignore=wrongdistribution"
95
96for code in $DEBIAN_CODES; do
97    $REPREPROI include "$code" "$change"
98done
99
100if [ $S -ne 1 ]; then
101    for code in $DEBIAN_CODES; do
102        if [ "$code" = "sarge" ]; then
103            $REPREPRO include sarge "$base~debian3.1_i386.changes"
104        else
105            tag=$(gettag "$code")
106            [ $A -eq 1 ] || $REPREPRO include "$code" "${base}${tag}_i386.changes"
107            $REPREPRO include "$code" "${base}${tag}_amd64.changes"
108        fi
109    done
110fi
111
112changes=$change
113for code in $DEBIAN_CODES; do
114    if [ "$code" = "sarge" ]; then
115        changes=$changes\ $base~debian3.1_i386.changes
116    else
117        tag=$(gettag "$code")
118        [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
119        changes=$changes\ "${base}${tag}"_amd64.changes
120    fi
121done
122
123files=${change%.changes}.build\ $changes
124origfiles=
125for change in $changes; do
126    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
127    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
128done
129
130built=built/
131[ -d "$built" ] || mkdir "$built"
132mv -i $files "$built"
133if [ -n "$origfiles" ]; then
134    for orig in $origfiles; do
135        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
136    done
137fi
Note: See TracBrowser for help on using the repository browser.