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

Revision 25476, 3.7 KB checked in by jdreed, 13 years ago (diff)
Use control fields instead of nobuild files (Trac #913)
  • 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. $(dirname "$0")/debian-versions.sh
21
22case "$(basename "$0")" in
23    daupload-release)
24        release=""
25        ;;
26    daupload-proposed)
27        release="-proposed"
28        ;;
29    daupload-dev)
30        release="-development"
31        ;;
32    *)
33        echo "Unknown release." >&2
34        exit 1
35        ;;
36esac
37
38v () {
39    echo "$@"
40    "$@"
41}
42
43A=0
44if [ "$1" = "-A" ]; then A=1; shift; fi
45S=0
46if [ "$1" = "-S" ]; then S=1; shift; fi
47
48change=$1
49set +e
50NOBUILD=$(grep-dctrl -n -s Debathena-No-Build -F Debathena-No-Build -e . "$change")
51BUILDFOR=$(grep-dctrl -n -s Debathena-Build-For -F Debathena-Build-For -e . "$change")
52if [ -n "$NOBUILD" ] && [ -n "$BUILDFOR" ]; then
53    echo "Error: changes file contains both Debathena-Build-For and Debathena-No-Build"
54    echo "(This should never happen, since sbuildhack should have caught it.)"
55    exit 1
56fi
57if [ -z "$NOBUILD" ] && [ -z "$BUILDFOR" ] && [ -e nobuild ]; then
58    NOBUILD="$(cat nobuild)"
59    echo "NOTE: Please migrate ./nobuild to XSC-Debathena-No-Build!"
60fi
61
62
63set -e
64cd "$(dirname "$change")"
65change=$(basename "$change")
66base=${change%_source.changes}
67
68check () {
69    [ -s "$1" ] || missing="$missing$1 "
70}
71uncheck () {
72    ! [ -s "$1" ] || missing="$missing-$1 "
73}
74
75# Adjust DEBIAN_CODES based on Debathena-Build-For or Debathena-No-Build
76if [ -n "$BUILDFOR" ]; then
77    DEBIAN_CODES=$BUILDFOR
78elif [ -n "$NOBUILD" ]; then
79    newcodes=
80    for code in $DEBIAN_CODES; do
81        if ! echo $NOBUILD | fgrep -q "$code"; then
82            newcodes="$newcodes $code"
83        fi
84    done
85    DEBIAN_CODES=$newcodes
86fi
87
88missing=
89[ -s "$change" ]
90if [ $S -ne 1 ]; then
91    for code in $DEBIAN_CODES; do
92        tag=$(gettag "$code")
93        check "${base}${tag}_amd64.changes"
94    done
95    if [ $A -eq 1 ]; then
96        for code in $DEBIAN_CODES; do
97            tag=$(gettag "$code")
98            uncheck "${base}${tag}_i386.changes"
99        done
100    else
101        for code in $DEBIAN_CODES; do
102            tag=$(gettag "$code")
103            check "${base}${tag}_i386.changes"
104        done
105    fi
106fi
107
108if [ -n "$missing" ]; then
109    echo "Missing $missing" >&2
110    echo -n "Continue? [y/N]"
111    read a
112    [ "$a" = "y" ]
113fi
114
115for code in $DEBIAN_CODES; do
116    v dareprepro include "${code}${release}" "$change"
117done
118
119if [ $S -ne 1 ]; then
120    for code in $DEBIAN_CODES; do
121        tag=$(gettag "$code")
122        [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
123        v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
124    done
125fi
126
127changes=$change
128for code in $DEBIAN_CODES; do
129    tag=$(gettag "$code")
130    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
131    changes=$changes\ "${base}${tag}"_amd64.changes
132done
133
134files=${change%.changes}.build\ $changes
135origfiles=
136for change in $changes; do
137    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
138    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
139done
140
141built=built/
142[ -d "$built" ] || mkdir "$built"
143mv -i $files "$built"
144if [ -n "$origfiles" ]; then
145    for orig in $origfiles; do
146        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
147    done
148fi
Note: See TracBrowser for help on using the repository browser.