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 *
RevLine 
[22687]1#!/bin/sh
2set -e
3
[22688]4# Usage: daupload-release [-A] [-S] CHANGESFILE
[23553]5#        daupload-proposed [-A] [-S] CHANGESFILE
6#        daupload-dev [-A] [-S] CHANGESFILE
[22688]7
8# After a package has been built for all Debian/Ubuntu versions and
9# platforms (typically using "da sbuildhack DSCFILE"), this script
[23553]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.
[22688]14
15# Upon completion, moves all of the generated files into the "built"
16# subdirectory.
17
[23072]18# This script will skip dists listed in ./nobuild.
19
[25747]20: ${DA_SCRIPTS_DIR="$(dirname "$0")"}
21. "$DA_SCRIPTS_DIR"/debian-versions.sh
[22700]22
[25940]23if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
24    echo "Will override DEBIAN_CODES with: $DEBIAN_CODES_OVERRIDE"
[25952]25    echo -n "Continue? [y/N] "
[25940]26    read a
27    [ "$a" = "y" ]
28    DEBIAN_CODES="$DEBIAN_CODES_OVERRIDE"
29fi
30
[22687]31case "$(basename "$0")" in
32    daupload-release)
[25952]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" ]
[23553]37        release=""
[22687]38        ;;
[23553]39    daupload-proposed)
40        release="-proposed"
[22687]41        ;;
[23553]42    daupload-dev)
[23568]43        release="-development"
[23553]44        ;;
[25562]45    daupload-bleeding)
46        release="-bleeding"
47        ;;
[22687]48    *)
[23553]49        echo "Unknown release." >&2
[22687]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")
[22730]67base=${change%_source.changes}
[22687]68
69check () {
70    [ -s "$1" ] || missing="$missing$1 "
71}
72uncheck () {
73    ! [ -s "$1" ] || missing="$missing-$1 "
74}
75
[25497]76# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
77if [ -e nobuild ]; then
[23072]78    newcodes=
79    for code in $DEBIAN_CODES; do
[25497]80        if ! fgrep -q "$code" nobuild; then
[23072]81            newcodes="$newcodes $code"
82        fi
83    done
84    DEBIAN_CODES=$newcodes
85fi
86
[22687]87missing=
88[ -s "$change" ]
89if [ $S -ne 1 ]; then
[22739]90    for code in $DEBIAN_CODES; do
[22977]91        tag=$(gettag "$code")
92        check "${base}${tag}_amd64.changes"
[22739]93    done
[22687]94    if [ $A -eq 1 ]; then
[22739]95        for code in $DEBIAN_CODES; do
[22977]96            tag=$(gettag "$code")
97            uncheck "${base}${tag}_i386.changes"
[22739]98        done
[22687]99    else
[22739]100        for code in $DEBIAN_CODES; do
[22977]101            tag=$(gettag "$code")
102            check "${base}${tag}_i386.changes"
[22739]103        done
[22687]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
[22739]114for code in $DEBIAN_CODES; do
[24566]115    v dareprepro include "${code}${release}" "$change"
[22739]116done
[22687]117
118if [ $S -ne 1 ]; then
[22739]119    for code in $DEBIAN_CODES; do
[22977]120        tag=$(gettag "$code")
[24566]121        [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
[24570]122        v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
[22739]123    done
[22687]124fi
125
[25940]126if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then
127    echo "Codes overridden, skipping copy of files.  Cleanup by hand."
128    exit 0
129fi
130
[22687]131changes=$change
[22751]132for code in $DEBIAN_CODES; do
[22977]133    tag=$(gettag "$code")
134    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
135    changes=$changes\ "${base}${tag}"_amd64.changes
[22739]136done
[22687]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.