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

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