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 | : ${DA_SCRIPTS_DIR="$(dirname "$0")"} |
---|
21 | . "$DA_SCRIPTS_DIR"/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="-development" |
---|
32 | ;; |
---|
33 | daupload-bleeding) |
---|
34 | release="-bleeding" |
---|
35 | ;; |
---|
36 | *) |
---|
37 | echo "Unknown release." >&2 |
---|
38 | exit 1 |
---|
39 | ;; |
---|
40 | esac |
---|
41 | |
---|
42 | v () { |
---|
43 | echo "$@" |
---|
44 | "$@" |
---|
45 | } |
---|
46 | |
---|
47 | A=0 |
---|
48 | if [ "$1" = "-A" ]; then A=1; shift; fi |
---|
49 | S=0 |
---|
50 | if [ "$1" = "-S" ]; then S=1; shift; fi |
---|
51 | |
---|
52 | change=$1 |
---|
53 | cd "$(dirname "$change")" |
---|
54 | change=$(basename "$change") |
---|
55 | base=${change%_source.changes} |
---|
56 | |
---|
57 | check () { |
---|
58 | [ -s "$1" ] || missing="$missing$1 " |
---|
59 | } |
---|
60 | uncheck () { |
---|
61 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
62 | } |
---|
63 | |
---|
64 | # If ./nobuild exists, filter out its contents from DEBIAN_CODES. |
---|
65 | if [ -e nobuild ]; then |
---|
66 | newcodes= |
---|
67 | for code in $DEBIAN_CODES; do |
---|
68 | if ! fgrep -q "$code" nobuild; then |
---|
69 | newcodes="$newcodes $code" |
---|
70 | fi |
---|
71 | done |
---|
72 | DEBIAN_CODES=$newcodes |
---|
73 | fi |
---|
74 | |
---|
75 | missing= |
---|
76 | [ -s "$change" ] |
---|
77 | if [ $S -ne 1 ]; then |
---|
78 | for code in $DEBIAN_CODES; do |
---|
79 | tag=$(gettag "$code") |
---|
80 | check "${base}${tag}_amd64.changes" |
---|
81 | done |
---|
82 | if [ $A -eq 1 ]; then |
---|
83 | for code in $DEBIAN_CODES; do |
---|
84 | tag=$(gettag "$code") |
---|
85 | uncheck "${base}${tag}_i386.changes" |
---|
86 | done |
---|
87 | else |
---|
88 | for code in $DEBIAN_CODES; do |
---|
89 | tag=$(gettag "$code") |
---|
90 | check "${base}${tag}_i386.changes" |
---|
91 | done |
---|
92 | fi |
---|
93 | fi |
---|
94 | |
---|
95 | if [ -n "$missing" ]; then |
---|
96 | echo "Missing $missing" >&2 |
---|
97 | echo -n "Continue? [y/N]" |
---|
98 | read a |
---|
99 | [ "$a" = "y" ] |
---|
100 | fi |
---|
101 | |
---|
102 | for code in $DEBIAN_CODES; do |
---|
103 | v dareprepro 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 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes" |
---|
110 | v dareprepro 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 |
---|