source: trunk/debathena/scripts/daupload-proposed @ 23637

Revision 23637, 3.2 KB checked in by broder, 16 years ago (diff)
Remove daupload-release, making daupload-proposed the canonical name of the script. This is to prevent people from uploading changes without testing them first. If you really want to upload something directly to production, you can use damove, but you better be thinking damn hard about it first.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2set -e
3
4# Usage: daupload-release [-A] [-S] CHANGESFILE
5#        daupload-proposed [-A] [-S] CHANGESFILE
6#        daupload-dev [-A] [-S] CHANGESFILE
7
8# After a package has been built for all Debian/Ubuntu versions and
9# platforms (typically using "da sbuildhack DSCFILE"), this script
10# uploads the package into the release, proposed, or beta apt
11# repository.  If -A is specified, only one architecture per
12# Debian/Ubuntu version is uploaded.  If -S is specified, only the
13# source package is uploaded.
14
15# Upon completion, moves all of the generated files into the "built"
16# subdirectory.
17
18# This script will skip dists listed in ./nobuild.
19
20: ${DEBATHENA_APT=/mit/debathena/apt}
21. $(dirname "$0")/debian-versions.sh
22
23case "$(basename "$0")" in
24    daupload-release)
25        release=""
26        ;;
27    daupload-proposed)
28        release="-proposed"
29        ;;
30    daupload-dev)
31        release="-development"
32        ;;
33    *)
34        echo "Unknown release." >&2
35        exit 1
36        ;;
37esac
38
39v () {
40    echo "$@"
41    "$@"
42}
43
44A=0
45if [ "$1" = "-A" ]; then A=1; shift; fi
46S=0
47if [ "$1" = "-S" ]; then S=1; shift; fi
48
49change=$1
50cd "$(dirname "$change")"
51change=$(basename "$change")
52base=${change%_source.changes}
53
54check () {
55    [ -s "$1" ] || missing="$missing$1 "
56}
57uncheck () {
58    ! [ -s "$1" ] || missing="$missing-$1 "
59}
60
61# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
62if [ -e nobuild ]; then
63    newcodes=
64    for code in $DEBIAN_CODES; do
65        if ! fgrep -q "$code" nobuild; then
66            newcodes="$newcodes $code"
67        fi
68    done
69    DEBIAN_CODES=$newcodes
70fi
71
72missing=
73[ -s "$change" ]
74if [ $S -ne 1 ]; then
75    for code in $DEBIAN_CODES; do
76        tag=$(gettag "$code")
77        check "${base}${tag}_amd64.changes"
78    done
79    if [ $A -eq 1 ]; then
80        for code in $DEBIAN_CODES; do
81            tag=$(gettag "$code")
82            uncheck "${base}${tag}_i386.changes"
83        done
84    else
85        for code in $DEBIAN_CODES; do
86            tag=$(gettag "$code")
87            check "${base}${tag}_i386.changes"
88        done
89    fi
90fi
91
92if [ -n "$missing" ]; then
93    echo "Missing $missing" >&2
94    echo -n "Continue? [y/N]"
95    read a
96    [ "$a" = "y" ]
97fi
98
99REPREPRO="v reprepro -Vb $DEBATHENA_APT"
100REPREPROI="$REPREPRO --ignore=wrongdistribution"
101
102for code in $DEBIAN_CODES; do
103    $REPREPROI include "${code}${release}" "$change"
104done
105
106if [ $S -ne 1 ]; then
107    for code in $DEBIAN_CODES; do
108        tag=$(gettag "$code")
109        [ $A -eq 1 ] || $REPREPROI include "${code}${release}" "${base}${tag}_i386.changes"
110        $REPREPROI include "${code}${release}" "${base}${tag}_amd64.changes"
111    done
112fi
113
114changes=$change
115for code in $DEBIAN_CODES; do
116    tag=$(gettag "$code")
117    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
118    changes=$changes\ "${base}${tag}"_amd64.changes
119done
120
121files=${change%.changes}.build\ $changes
122origfiles=
123for change in $changes; do
124    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
125    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
126done
127
128built=built/
129[ -d "$built" ] || mkdir "$built"
130mv -i $files "$built"
131if [ -n "$origfiles" ]; then
132    for orig in $origfiles; do
133        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
134    done
135fi
Note: See TracBrowser for help on using the repository browser.