source: trunk/debathena/scripts/daupload @ 25952

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