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