1 | #!/bin/sh |
---|
2 | set -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 | |
---|
22 | case "$(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 | ;; |
---|
36 | esac |
---|
37 | |
---|
38 | v () { |
---|
39 | echo "$@" |
---|
40 | "$@" |
---|
41 | } |
---|
42 | |
---|
43 | A=0 |
---|
44 | if [ "$1" = "-A" ]; then A=1; shift; fi |
---|
45 | S=0 |
---|
46 | if [ "$1" = "-S" ]; then S=1; shift; fi |
---|
47 | |
---|
48 | change=$1 |
---|
49 | cd "$(dirname "$change")" |
---|
50 | change=$(basename "$change") |
---|
51 | base=${change%_source.changes} |
---|
52 | |
---|
53 | check () { |
---|
54 | [ -s "$1" ] || missing="$missing$1 " |
---|
55 | } |
---|
56 | uncheck () { |
---|
57 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
58 | } |
---|
59 | |
---|
60 | # If ./nobuild exists, filter out its contents from DEBIAN_CODES. |
---|
61 | if [ -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 |
---|
69 | fi |
---|
70 | |
---|
71 | missing= |
---|
72 | [ -s "$change" ] |
---|
73 | if [ $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 |
---|
89 | fi |
---|
90 | |
---|
91 | if [ -n "$missing" ]; then |
---|
92 | echo "Missing $missing" >&2 |
---|
93 | echo -n "Continue? [y/N]" |
---|
94 | read a |
---|
95 | [ "$a" = "y" ] |
---|
96 | fi |
---|
97 | |
---|
98 | for code in $DEBIAN_CODES; do |
---|
99 | v dareprepro include "${code}${release}" "$change" |
---|
100 | done |
---|
101 | |
---|
102 | if [ $S -ne 1 ]; then |
---|
103 | for code in $DEBIAN_CODES; do |
---|
104 | tag=$(gettag "$code") |
---|
105 | [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes" |
---|
106 | v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes" |
---|
107 | done |
---|
108 | fi |
---|
109 | |
---|
110 | changes=$change |
---|
111 | for code in $DEBIAN_CODES; do |
---|
112 | tag=$(gettag "$code") |
---|
113 | [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes |
---|
114 | changes=$changes\ "${base}${tag}"_amd64.changes |
---|
115 | done |
---|
116 | |
---|
117 | files=${change%.changes}.build\ $changes |
---|
118 | origfiles= |
---|
119 | for change in $changes; do |
---|
120 | files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
121 | origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :) |
---|
122 | done |
---|
123 | |
---|
124 | built=built/ |
---|
125 | [ -d "$built" ] || mkdir "$built" |
---|
126 | mv -i $files "$built" |
---|
127 | if [ -n "$origfiles" ]; then |
---|
128 | for orig in $origfiles; do |
---|
129 | [ -e "$built/$orig" ] || cp -ai "$orig" "$built/" |
---|
130 | done |
---|
131 | fi |
---|