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