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

Revision 25940, 3.5 KB checked in by jdreed, 11 years ago (diff)
Allow overriding of DEBIAN_CODES (e.g., if you need to build and upload for a single release). This is preferable to running 'dareprepro include' by hand.
  • 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: ${DA_SCRIPTS_DIR="$(dirname "$0")"}
21. "$DA_SCRIPTS_DIR"/debian-versions.sh
22
23if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
24    echo "Will override DEBIAN_CODES with: $DEBIAN_CODES_OVERRIDE"
25    echo -n "Continue? [y/N]"
26    read a
27    [ "$a" = "y" ]
28    DEBIAN_CODES="$DEBIAN_CODES_OVERRIDE"
29fi
30
31case "$(basename "$0")" in
32    daupload-release)
33        release=""
34        ;;
35    daupload-proposed)
36        release="-proposed"
37        ;;
38    daupload-dev)
39        release="-development"
40        ;;
41    daupload-bleeding)
42        release="-bleeding"
43        ;;
44    *)
45        echo "Unknown release." >&2
46        exit 1
47        ;;
48esac
49
50v () {
51    echo "$@"
52    "$@"
53}
54
55A=0
56if [ "$1" = "-A" ]; then A=1; shift; fi
57S=0
58if [ "$1" = "-S" ]; then S=1; shift; fi
59
60change=$1
61cd "$(dirname "$change")"
62change=$(basename "$change")
63base=${change%_source.changes}
64
65check () {
66    [ -s "$1" ] || missing="$missing$1 "
67}
68uncheck () {
69    ! [ -s "$1" ] || missing="$missing-$1 "
70}
71
72# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
73if [ -e nobuild ]; then
74    newcodes=
75    for code in $DEBIAN_CODES; do
76        if ! fgrep -q "$code" nobuild; then
77            newcodes="$newcodes $code"
78        fi
79    done
80    DEBIAN_CODES=$newcodes
81fi
82
83missing=
84[ -s "$change" ]
85if [ $S -ne 1 ]; then
86    for code in $DEBIAN_CODES; do
87        tag=$(gettag "$code")
88        check "${base}${tag}_amd64.changes"
89    done
90    if [ $A -eq 1 ]; then
91        for code in $DEBIAN_CODES; do
92            tag=$(gettag "$code")
93            uncheck "${base}${tag}_i386.changes"
94        done
95    else
96        for code in $DEBIAN_CODES; do
97            tag=$(gettag "$code")
98            check "${base}${tag}_i386.changes"
99        done
100    fi
101fi
102
103if [ -n "$missing" ]; then
104    echo "Missing $missing" >&2
105    echo -n "Continue? [y/N]"
106    read a
107    [ "$a" = "y" ]
108fi
109
110for code in $DEBIAN_CODES; do
111    v dareprepro include "${code}${release}" "$change"
112done
113
114if [ $S -ne 1 ]; then
115    for code in $DEBIAN_CODES; do
116        tag=$(gettag "$code")
117        [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
118        v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
119    done
120fi
121
122if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
123    echo "Codes overridden, skipping copy of files.  Cleanup by hand."
124    exit 0
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.