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

Revision 24565, 3.1 KB checked in by broder, 15 years ago (diff)
Add a dareprepro script. Since there are a handful of arguments that we *always* pass to reprepro, add a wrapper for reprepro that passes them for us.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2set -e
3
4# Usage: daupload-release [-A] [-S] CHANGESFILE
5#        daupload-proposed [-A] [-S] CHANGESFILE
6#        daupload-dev [-A] [-S] CHANGESFILE
7
8# After a package has been built for all Debian/Ubuntu versions and
9# platforms (typically using "da sbuildhack DSCFILE"), this script
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.
14
15# Upon completion, moves all of the generated files into the "built"
16# subdirectory.
17
18# This script will skip dists listed in ./nobuild.
19
20. $(dirname "$0")/debian-versions.sh
21
22case "$(basename "$0")" in
23    daupload-release)
24        release=""
25        ;;
26    daupload-proposed)
27        release="-proposed"
28        ;;
29    daupload-dev)
30        release="-development"
31        ;;
32    *)
33        echo "Unknown release." >&2
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
49cd "$(dirname "$change")"
50change=$(basename "$change")
51base=${change%_source.changes}
52
53check () {
54    [ -s "$1" ] || missing="$missing$1 "
55}
56uncheck () {
57    ! [ -s "$1" ] || missing="$missing-$1 "
58}
59
60# If ./nobuild exists, filter out its contents from DEBIAN_CODES.
61if [ -e nobuild ]; then
62    newcodes=
63    for code in $DEBIAN_CODES; do
64        if ! fgrep -q "$code" nobuild; then
65            newcodes="$newcodes $code"
66        fi
67    done
68    DEBIAN_CODES=$newcodes
69fi
70
71missing=
72[ -s "$change" ]
73if [ $S -ne 1 ]; then
74    for code in $DEBIAN_CODES; do
75        tag=$(gettag "$code")
76        check "${base}${tag}_amd64.changes"
77    done
78    if [ $A -eq 1 ]; then
79        for code in $DEBIAN_CODES; do
80            tag=$(gettag "$code")
81            uncheck "${base}${tag}_i386.changes"
82        done
83    else
84        for code in $DEBIAN_CODES; do
85            tag=$(gettag "$code")
86            check "${base}${tag}_i386.changes"
87        done
88    fi
89fi
90
91if [ -n "$missing" ]; then
92    echo "Missing $missing" >&2
93    echo -n "Continue? [y/N]"
94    read a
95    [ "$a" = "y" ]
96fi
97
98REPREPRO="v dareprepro"
99
100for code in $DEBIAN_CODES; do
101    $REPREPRO include "${code}${release}" "$change"
102done
103
104if [ $S -ne 1 ]; then
105    for code in $DEBIAN_CODES; do
106        tag=$(gettag "$code")
107        [ $A -eq 1 ] || $REPREPRO include "${code}${release}" "${base}${tag}_i386.changes"
108        $REPREPRO include "${code}${release}" "${base}${tag}_amd64.changes"
109    done
110fi
111
112changes=$change
113for code in $DEBIAN_CODES; do
114    tag=$(gettag "$code")
115    [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes
116    changes=$changes\ "${base}${tag}"_amd64.changes
117done
118
119files=${change%.changes}.build\ $changes
120origfiles=
121for change in $changes; do
122    files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
123    origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :)
124done
125
126built=built/
127[ -d "$built" ] || mkdir "$built"
128mv -i $files "$built"
129if [ -n "$origfiles" ]; then
130    for orig in $origfiles; do
131        [ -e "$built/$orig" ] || cp -ai "$orig" "$built/"
132    done
133fi
Note: See TracBrowser for help on using the repository browser.