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

Revision 25747, 3.2 KB checked in by jdreed, 12 years ago (diff)
Get rid of "dirname $0" and replace with DA_SCRIPTS_DIR, which allows overriding at run time. (Trac: #1191)
  • 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
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    daupload-bleeding)
34        release="-bleeding"
35        ;;
36    *)
37        echo "Unknown release." >&2
38        exit 1
39        ;;
40esac
41
42v () {
43    echo "$@"
44    "$@"
45}
46
47A=0
48if [ "$1" = "-A" ]; then A=1; shift; fi
49S=0
50if [ "$1" = "-S" ]; then S=1; shift; fi
51
52change=$1
53cd "$(dirname "$change")"
54change=$(basename "$change")
55base=${change%_source.changes}
56
57check () {
58    [ -s "$1" ] || missing="$missing$1 "
59}
60uncheck () {
61    ! [ -s "$1" ] || missing="$missing-$1 "
62}
63
64# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
65if [ -e nobuild ]; then
66    newcodes=
67    for code in $DEBIAN_CODES; do
68        if ! fgrep -q "$code" nobuild; then
69            newcodes="$newcodes $code"
70        fi
71    done
72    DEBIAN_CODES=$newcodes
73fi
74
75missing=
76[ -s "$change" ]
77if [ $S -ne 1 ]; then
78    for code in $DEBIAN_CODES; do
79        tag=$(gettag "$code")
80        check "${base}${tag}_amd64.changes"
81    done
82    if [ $A -eq 1 ]; then
83        for code in $DEBIAN_CODES; do
84            tag=$(gettag "$code")
85            uncheck "${base}${tag}_i386.changes"
86        done
87    else
88        for code in $DEBIAN_CODES; do
89            tag=$(gettag "$code")
90            check "${base}${tag}_i386.changes"
91        done
92    fi
93fi
94
95if [ -n "$missing" ]; then
96    echo "Missing $missing" >&2
97    echo -n "Continue? [y/N]"
98    read a
99    [ "$a" = "y" ]
100fi
101
102for code in $DEBIAN_CODES; do
103    v dareprepro 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 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
110        v dareprepro 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.