1 | #!/bin/sh |
---|
2 | set -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 | case "$(basename "$0")" in |
---|
17 | daupload-release) |
---|
18 | repo=/mit/debathena/apt |
---|
19 | ;; |
---|
20 | daupload-beta) |
---|
21 | repo=/mit/debathena/apt-beta |
---|
22 | ;; |
---|
23 | *) |
---|
24 | echo "Unknown repo." >&2 |
---|
25 | exit 1 |
---|
26 | ;; |
---|
27 | esac |
---|
28 | |
---|
29 | v () { |
---|
30 | echo "$@" |
---|
31 | "$@" |
---|
32 | } |
---|
33 | |
---|
34 | A=0 |
---|
35 | if [ "$1" = "-A" ]; then A=1; shift; fi |
---|
36 | S=0 |
---|
37 | if [ "$1" = "-S" ]; then S=1; shift; fi |
---|
38 | |
---|
39 | change=$1 |
---|
40 | cd "$(dirname "$change")" |
---|
41 | change=$(basename "$change") |
---|
42 | |
---|
43 | check () { |
---|
44 | [ -s "$1" ] || missing="$missing$1 " |
---|
45 | } |
---|
46 | uncheck () { |
---|
47 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
48 | } |
---|
49 | |
---|
50 | missing= |
---|
51 | [ -s "$change" ] |
---|
52 | if [ $S -ne 1 ]; then |
---|
53 | check "${change%_source.changes}~debian3.1_i386.changes" |
---|
54 | check "${change%_source.changes}~debian4.0_amd64.changes" |
---|
55 | check "${change%_source.changes}~debian4.1~0.1_amd64.changes" |
---|
56 | check "${change%_source.changes}~ubuntu6.06_amd64.changes" |
---|
57 | check "${change%_source.changes}~ubuntu6.10_amd64.changes" |
---|
58 | check "${change%_source.changes}~ubuntu7.04_amd64.changes" |
---|
59 | check "${change%_source.changes}~ubuntu7.10_amd64.changes" |
---|
60 | if [ $A -eq 1 ]; then |
---|
61 | uncheck "${change%_source.changes}~debian4.0_i386.changes" |
---|
62 | uncheck "${change%_source.changes}~debian4.1~0.1_i386.changes" |
---|
63 | uncheck "${change%_source.changes}~ubuntu6.06_i386.changes" |
---|
64 | uncheck "${change%_source.changes}~ubuntu6.10_i386.changes" |
---|
65 | uncheck "${change%_source.changes}~ubuntu7.04_i386.changes" |
---|
66 | uncheck "${change%_source.changes}~ubuntu7.10_i386.changes" |
---|
67 | else |
---|
68 | check "${change%_source.changes}~debian4.0_i386.changes" |
---|
69 | check "${change%_source.changes}~debian4.1~0.1_i386.changes" |
---|
70 | check "${change%_source.changes}~ubuntu6.06_i386.changes" |
---|
71 | check "${change%_source.changes}~ubuntu6.10_i386.changes" |
---|
72 | check "${change%_source.changes}~ubuntu7.04_i386.changes" |
---|
73 | check "${change%_source.changes}~ubuntu7.10_i386.changes" |
---|
74 | fi |
---|
75 | fi |
---|
76 | |
---|
77 | if [ -n "$missing" ]; then |
---|
78 | echo "Missing $missing" >&2 |
---|
79 | echo -n "Continue? [y/N]" |
---|
80 | read a |
---|
81 | [ "$a" = "y" ] |
---|
82 | fi |
---|
83 | |
---|
84 | REPREPRO="v reprepro -Vb $repo" |
---|
85 | REPREPROI="$REPREPRO --ignore=wrongdistribution" |
---|
86 | |
---|
87 | $REPREPROI include sarge "$change" |
---|
88 | $REPREPROI include etch "$change" |
---|
89 | $REPREPROI include lenny "$change" |
---|
90 | $REPREPROI include dapper "$change" |
---|
91 | $REPREPROI include edgy "$change" |
---|
92 | $REPREPROI include feisty "$change" |
---|
93 | $REPREPROI include gutsy "$change" |
---|
94 | |
---|
95 | if [ $S -ne 1 ]; then |
---|
96 | $REPREPRO include sarge "${change%_source.changes}~debian3.1_i386.changes" |
---|
97 | [ $A -eq 1 ] || $REPREPRO include etch "${change%_source.changes}~debian4.0_i386.changes" |
---|
98 | $REPREPRO include etch "${change%_source.changes}~debian4.0_amd64.changes" |
---|
99 | [ $A -eq 1 ] || $REPREPRO include lenny "${change%_source.changes}~debian4.1~0.1_i386.changes" |
---|
100 | $REPREPRO include lenny "${change%_source.changes}~debian4.1~0.1_amd64.changes" |
---|
101 | [ $A -eq 1 ] || $REPREPRO include dapper "${change%_source.changes}~ubuntu6.06_i386.changes" |
---|
102 | $REPREPRO include dapper "${change%_source.changes}~ubuntu6.06_amd64.changes" |
---|
103 | [ $A -eq 1 ] || $REPREPRO include edgy "${change%_source.changes}~ubuntu6.10_i386.changes" |
---|
104 | $REPREPRO include edgy "${change%_source.changes}~ubuntu6.10_amd64.changes" |
---|
105 | [ $A -eq 1 ] || $REPREPRO include feisty "${change%_source.changes}~ubuntu7.04_i386.changes" |
---|
106 | $REPREPRO include feisty "${change%_source.changes}~ubuntu7.04_amd64.changes" |
---|
107 | [ $A -eq 1 ] || $REPREPRO include gutsy "${change%_source.changes}~ubuntu7.10_i386.changes" |
---|
108 | $REPREPRO include gutsy "${change%_source.changes}~ubuntu7.10_amd64.changes" |
---|
109 | fi |
---|
110 | |
---|
111 | |
---|
112 | changes=$change |
---|
113 | changes=$changes\ ${change%_source.changes}~debian3.1_i386.changes |
---|
114 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~debian4.0_i386.changes |
---|
115 | changes=$changes\ ${change%_source.changes}~debian4.0_amd64.changes |
---|
116 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~debian4.1~0.1_i386.changes |
---|
117 | changes=$changes\ ${change%_source.changes}~debian4.1~0.1_amd64.changes |
---|
118 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~ubuntu6.06_i386.changes |
---|
119 | changes=$changes\ ${change%_source.changes}~ubuntu6.06_amd64.changes |
---|
120 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~ubuntu6.10_i386.changes |
---|
121 | changes=$changes\ ${change%_source.changes}~ubuntu6.10_amd64.changes |
---|
122 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~ubuntu7.04_i386.changes |
---|
123 | changes=$changes\ ${change%_source.changes}~ubuntu7.04_amd64.changes |
---|
124 | [ $A -eq 1 ] || changes=$changes\ ${change%_source.changes}~ubuntu7.10_i386.changes |
---|
125 | changes=$changes\ ${change%_source.changes}~ubuntu7.10_amd64.changes |
---|
126 | |
---|
127 | files=${change%.changes}.build\ $changes |
---|
128 | origfiles= |
---|
129 | for change in $changes; do |
---|
130 | files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
131 | origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :) |
---|
132 | done |
---|
133 | |
---|
134 | built=built/ |
---|
135 | [ -d "$built" ] || mkdir "$built" |
---|
136 | mv -i $files "$built" |
---|
137 | if [ -n "$origfiles" ]; then |
---|
138 | for orig in $origfiles; do |
---|
139 | [ -e "$built/$orig" ] || cp -ai "$orig" "$built/" |
---|
140 | done |
---|
141 | fi |
---|