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

Revision 25497, 3.1 KB checked in by jdreed, 12 years ago (diff)
Revert r25476 and r25479
  • 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
49cd "$(dirname "$change")"
50change=$(basename "$change")
51base=${change%_source.changes}
52
53check () {
54    [ -s "$1" ] || missing="$missing$1 "
55}
56uncheck () {
57    ! [ -s "$1" ] || missing="$missing-$1 "
58}
59
60# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
61if [ -e nobuild ]; then
62    newcodes=
63    for code in $DEBIAN_CODES; do
64        if ! fgrep -q "$code" nobuild; then
65            newcodes="$newcodes $code"
66        fi
67    done
68    DEBIAN_CODES=$newcodes
69fi
70
71missing=
72[ -s "$change" ]
73if [ $S -ne 1 ]; then
74    for code in $DEBIAN_CODES; do
75        tag=$(gettag "$code")
76        check "${base}${tag}_amd64.changes"
77    done
78    if [ $A -eq 1 ]; then
79        for code in $DEBIAN_CODES; do
80            tag=$(gettag "$code")
81            uncheck "${base}${tag}_i386.changes"
82        done
83    else
84        for code in $DEBIAN_CODES; do
85            tag=$(gettag "$code")
86            check "${base}${tag}_i386.changes"
87        done
88    fi
89fi
90
91if [ -n "$missing" ]; then
92    echo "Missing $missing" >&2
93    echo -n "Continue? [y/N]"
94    read a
95    [ "$a" = "y" ]
96fi
97
98for code in $DEBIAN_CODES; do
99    v dareprepro include "${code}${release}" "$change"
100done
101
102if [ $S -ne 1 ]; then
103    for code in $DEBIAN_CODES; do
104        tag=$(gettag "$code")
105        [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
106        v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
107    done
108fi
109
110changes=$change
111for code in $DEBIAN_CODES; do
112    tag=$(gettag "$code")
113    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
114    changes=$changes\ "${base}${tag}"_amd64.changes
115done
116
117files=${change%.changes}.build\ $changes
118origfiles=
119for change in $changes; do
120    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
121    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
122done
123
124built=built/
125[ -d "$built" ] || mkdir "$built"
126mv -i $files "$built"
127if [ -n "$origfiles" ]; then
128    for orig in $origfiles; do
129        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
130    done
131fi
Note: See TracBrowser for help on using the repository browser.