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

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