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

Revision 23072, 3.0 KB checked in by ghudson, 16 years ago (diff)
In daupload-release and sbuildhack, add support for a ./nobuild file specifying distributions not to build a package for. For now, nobuild files will live in the build parent directory and not be versioned.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2set -e
3
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
16# This script will skip dists listed in ./nobuild.
17
18: ${DEBATHENA_APT=/mit/debathena/apt}
19. $(dirname "$0")/debian-versions.sh
20
21case "$(basename "$0")" in
22    daupload-release)
23        repo=$DEBATHENA_APT
24        ;;
25    daupload-beta)
26        repo=${DEBATHENA_APT}-beta
27        ;;
28    *)
29        echo "Unknown repo." >&2
30        exit 1
31        ;;
32esac
33
34v () {
35    echo "$@"
36    "$@"
37}
38
39A=0
40if [ "$1" = "-A" ]; then A=1; shift; fi
41S=0
42if [ "$1" = "-S" ]; then S=1; shift; fi
43
44change=$1
45cd "$(dirname "$change")"
46change=$(basename "$change")
47base=${change%_source.changes}
48
49check () {
50    [ -s "$1" ] || missing="$missing$1 "
51}
52uncheck () {
53    ! [ -s "$1" ] || missing="$missing-$1 "
54}
55
56# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
57if [ -e nobuild ]; then
58    newcodes=
59    for code in $DEBIAN_CODES; do
60        if ! fgrep -q "$code" nobuild; then
61            newcodes="$newcodes $code"
62        fi
63    done
64    DEBIAN_CODES=$newcodes
65fi
66
67missing=
68[ -s "$change" ]
69if [ $S -ne 1 ]; then
70    for code in $DEBIAN_CODES; do
71        tag=$(gettag "$code")
72        check "${base}${tag}_amd64.changes"
73    done
74    if [ $A -eq 1 ]; then
75        for code in $DEBIAN_CODES; do
76            tag=$(gettag "$code")
77            uncheck "${base}${tag}_i386.changes"
78        done
79    else
80        for code in $DEBIAN_CODES; do
81            tag=$(gettag "$code")
82            check "${base}${tag}_i386.changes"
83        done
84    fi
85fi
86
87if [ -n "$missing" ]; then
88    echo "Missing $missing" >&2
89    echo -n "Continue? [y/N]"
90    read a
91    [ "$a" = "y" ]
92fi
93
94REPREPRO="v reprepro -Vb $repo"
95REPREPROI="$REPREPRO --ignore=wrongdistribution"
96
97for code in $DEBIAN_CODES; do
98    $REPREPROI include "$code" "$change"
99done
100
101if [ $S -ne 1 ]; then
102    for code in $DEBIAN_CODES; do
103        tag=$(gettag "$code")
104        [ $A -eq 1 ] || $REPREPRO include "$code" "${base}${tag}_i386.changes"
105        $REPREPRO include "$code" "${base}${tag}_amd64.changes"
106    done
107fi
108
109changes=$change
110for code in $DEBIAN_CODES; do
111    tag=$(gettag "$code")
112    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
113    changes=$changes\ "${base}${tag}"_amd64.changes
114done
115
116files=${change%.changes}.build\ $changes
117origfiles=
118for change in $changes; do
119    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
120    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
121done
122
123built=built/
124[ -d "$built" ] || mkdir "$built"
125mv -i $files "$built"
126if [ -n "$origfiles" ]; then
127    for orig in $origfiles; do
128        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
129    done
130fi
Note: See TracBrowser for help on using the repository browser.