source: trunk/debathena/scripts/daupload-release @ 22977

Revision 22977, 2.7 KB checked in by broder, 16 years ago (diff)
Desupport Sarge - the new version of sbuild doesn't play nice with sarge, and we don't care enough to fix it
  • Property svn:executable set to *
RevLine 
[22687]1#!/bin/sh
2set -e
3
[22688]4# Usage: daupload-release [-A] [-S] CHANGESFILE
5#        daupload-beta [-A] [-S] CHANGESFILE
6
7# After a package has been built for all Debian/Ubuntu versions and
8# platforms (typically using "da sbuildhack DSCFILE"), this script
9# uploads the package into the release or beta apt repository.  If -A
10# is specified, only one architecture per Debian/Ubuntu version is
11# uploaded.  If -S is specified, only the source package is uploaded.
12
13# Upon completion, moves all of the generated files into the "built"
14# subdirectory.
15
[22740]16: ${DEBATHENA_APT=/mit/debathena/apt}
[22748]17. $(dirname "$0")/debian-versions.sh
[22700]18
[22687]19case "$(basename "$0")" in
20    daupload-release)
[22700]21        repo=$DEBATHENA_APT
[22687]22        ;;
23    daupload-beta)
[22700]24        repo=${DEBATHENA_APT}-beta
[22687]25        ;;
26    *)
27        echo "Unknown repo." >&2
28        exit 1
29        ;;
30esac
31
32v () {
33    echo "$@"
34    "$@"
35}
36
37A=0
38if [ "$1" = "-A" ]; then A=1; shift; fi
39S=0
40if [ "$1" = "-S" ]; then S=1; shift; fi
41
42change=$1
43cd "$(dirname "$change")"
44change=$(basename "$change")
[22730]45base=${change%_source.changes}
[22687]46
47check () {
48    [ -s "$1" ] || missing="$missing$1 "
49}
50uncheck () {
51    ! [ -s "$1" ] || missing="$missing-$1 "
52}
53
54missing=
55[ -s "$change" ]
56if [ $S -ne 1 ]; then
[22739]57    for code in $DEBIAN_CODES; do
[22977]58        tag=$(gettag "$code")
59        check "${base}${tag}_amd64.changes"
[22739]60    done
[22687]61    if [ $A -eq 1 ]; then
[22739]62        for code in $DEBIAN_CODES; do
[22977]63            tag=$(gettag "$code")
64            uncheck "${base}${tag}_i386.changes"
[22739]65        done
[22687]66    else
[22739]67        for code in $DEBIAN_CODES; do
[22977]68            tag=$(gettag "$code")
69            check "${base}${tag}_i386.changes"
[22739]70        done
[22687]71    fi
72fi
73
74if [ -n "$missing" ]; then
75    echo "Missing $missing" >&2
76    echo -n "Continue? [y/N]"
77    read a
78    [ "$a" = "y" ]
79fi
80
81REPREPRO="v reprepro -Vb $repo"
82REPREPROI="$REPREPRO --ignore=wrongdistribution"
83
[22739]84for code in $DEBIAN_CODES; do
85    $REPREPROI include "$code" "$change"
86done
[22687]87
88if [ $S -ne 1 ]; then
[22739]89    for code in $DEBIAN_CODES; do
[22977]90        tag=$(gettag "$code")
91        [ $A -eq 1 ] || $REPREPRO include "$code" "${base}${tag}_i386.changes"
92        $REPREPRO include "$code" "${base}${tag}_amd64.changes"
[22739]93    done
[22687]94fi
95
96changes=$change
[22751]97for code in $DEBIAN_CODES; do
[22977]98    tag=$(gettag "$code")
99    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
100    changes=$changes\ "${base}${tag}"_amd64.changes
[22739]101done
[22687]102
103files=${change%.changes}.build\ $changes
104origfiles=
105for change in $changes; do
106    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
107    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
108done
109
110built=built/
111[ -d "$built" ] || mkdir "$built"
112mv -i $files "$built"
113if [ -n "$origfiles" ]; then
114    for orig in $origfiles; do
115        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
116    done
117fi
Note: See TracBrowser for help on using the repository browser.