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

Revision 25476, 3.7 KB checked in by jdreed, 12 years ago (diff)
Use control fields instead of nobuild files (Trac #913)
  • 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
[22748]20. $(dirname "$0")/debian-versions.sh
[22700]21
[22687]22case "$(basename "$0")" in
23    daupload-release)
[23553]24        release=""
[22687]25        ;;
[23553]26    daupload-proposed)
27        release="-proposed"
[22687]28        ;;
[23553]29    daupload-dev)
[23568]30        release="-development"
[23553]31        ;;
[22687]32    *)
[23553]33        echo "Unknown release." >&2
[22687]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
[25476]49set +e
50NOBUILD=$(grep-dctrl -n -s Debathena-No-Build -F Debathena-No-Build -e . "$change")
51BUILDFOR=$(grep-dctrl -n -s Debathena-Build-For -F Debathena-Build-For -e . "$change")
52if [ -n "$NOBUILD" ] && [ -n "$BUILDFOR" ]; then
53    echo "Error: changes file contains both Debathena-Build-For and Debathena-No-Build"
54    echo "(This should never happen, since sbuildhack should have caught it.)"
55    exit 1
56fi
57if [ -z "$NOBUILD" ] && [ -z "$BUILDFOR" ] && [ -e nobuild ]; then
58    NOBUILD="$(cat nobuild)"
59    echo "NOTE: Please migrate ./nobuild to XSC-Debathena-No-Build!"
60fi
61
62
63set -e
[22687]64cd "$(dirname "$change")"
65change=$(basename "$change")
[22730]66base=${change%_source.changes}
[22687]67
68check () {
69    [ -s "$1" ] || missing="$missing$1 "
70}
71uncheck () {
72    ! [ -s "$1" ] || missing="$missing-$1 "
73}
74
[25476]75# Adjust DEBIAN_CODES based on Debathena-Build-For or Debathena-No-Build
76if [ -n "$BUILDFOR" ]; then
77    DEBIAN_CODES=$BUILDFOR
78elif [ -n "$NOBUILD" ]; then
[23072]79    newcodes=
80    for code in $DEBIAN_CODES; do
[25476]81        if ! echo $NOBUILD | fgrep -q "$code"; then
[23072]82            newcodes="$newcodes $code"
83        fi
84    done
85    DEBIAN_CODES=$newcodes
86fi
87
[22687]88missing=
89[ -s "$change" ]
90if [ $S -ne 1 ]; then
[22739]91    for code in $DEBIAN_CODES; do
[22977]92        tag=$(gettag "$code")
93        check "${base}${tag}_amd64.changes"
[22739]94    done
[22687]95    if [ $A -eq 1 ]; then
[22739]96        for code in $DEBIAN_CODES; do
[22977]97            tag=$(gettag "$code")
98            uncheck "${base}${tag}_i386.changes"
[22739]99        done
[22687]100    else
[22739]101        for code in $DEBIAN_CODES; do
[22977]102            tag=$(gettag "$code")
103            check "${base}${tag}_i386.changes"
[22739]104        done
[22687]105    fi
106fi
107
108if [ -n "$missing" ]; then
109    echo "Missing $missing" >&2
110    echo -n "Continue? [y/N]"
111    read a
112    [ "$a" = "y" ]
113fi
114
[22739]115for code in $DEBIAN_CODES; do
[24566]116    v dareprepro include "${code}${release}" "$change"
[22739]117done
[22687]118
119if [ $S -ne 1 ]; then
[22739]120    for code in $DEBIAN_CODES; do
[22977]121        tag=$(gettag "$code")
[24566]122        [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes"
[24570]123        v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes"
[22739]124    done
[22687]125fi
126
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.