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 | set +e |
---|
50 | NOBUILD=$(grep-dctrl -n -s Debathena-No-Build -F Debathena-No-Build -e . "$change") |
---|
51 | BUILDFOR=$(grep-dctrl -n -s Debathena-Build-For -F Debathena-Build-For -e . "$change") |
---|
52 | if [ -n "$NOBUILD" ] && [ -n "$BUILDFOR" ]; then |
---|
53 | echo "Error: changes file contains both Debathena-Build-For and Debathena-No-Build" |
---|
54 | echo "(This should never happen, since sbuildhack should have caught it.)" |
---|
55 | exit 1 |
---|
56 | fi |
---|
57 | if [ -z "$NOBUILD" ] && [ -z "$BUILDFOR" ] && [ -e nobuild ]; then |
---|
58 | NOBUILD="$(cat nobuild)" |
---|
59 | echo "NOTE: Please migrate ./nobuild to XSC-Debathena-No-Build!" |
---|
60 | fi |
---|
61 | |
---|
62 | |
---|
63 | set -e |
---|
64 | cd "$(dirname "$change")" |
---|
65 | change=$(basename "$change") |
---|
66 | base=${change%_source.changes} |
---|
67 | |
---|
68 | check () { |
---|
69 | [ -s "$1" ] || missing="$missing$1 " |
---|
70 | } |
---|
71 | uncheck () { |
---|
72 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
73 | } |
---|
74 | |
---|
75 | # Adjust DEBIAN_CODES based on Debathena-Build-For or Debathena-No-Build |
---|
76 | if [ -n "$BUILDFOR" ]; then |
---|
77 | DEBIAN_CODES=$BUILDFOR |
---|
78 | elif [ -n "$NOBUILD" ]; then |
---|
79 | newcodes= |
---|
80 | for code in $DEBIAN_CODES; do |
---|
81 | if ! echo $NOBUILD | fgrep -q "$code"; then |
---|
82 | newcodes="$newcodes $code" |
---|
83 | fi |
---|
84 | done |
---|
85 | DEBIAN_CODES=$newcodes |
---|
86 | fi |
---|
87 | |
---|
88 | missing= |
---|
89 | [ -s "$change" ] |
---|
90 | if [ $S -ne 1 ]; then |
---|
91 | for code in $DEBIAN_CODES; do |
---|
92 | tag=$(gettag "$code") |
---|
93 | check "${base}${tag}_amd64.changes" |
---|
94 | done |
---|
95 | if [ $A -eq 1 ]; then |
---|
96 | for code in $DEBIAN_CODES; do |
---|
97 | tag=$(gettag "$code") |
---|
98 | uncheck "${base}${tag}_i386.changes" |
---|
99 | done |
---|
100 | else |
---|
101 | for code in $DEBIAN_CODES; do |
---|
102 | tag=$(gettag "$code") |
---|
103 | check "${base}${tag}_i386.changes" |
---|
104 | done |
---|
105 | fi |
---|
106 | fi |
---|
107 | |
---|
108 | if [ -n "$missing" ]; then |
---|
109 | echo "Missing $missing" >&2 |
---|
110 | echo -n "Continue? [y/N]" |
---|
111 | read a |
---|
112 | [ "$a" = "y" ] |
---|
113 | fi |
---|
114 | |
---|
115 | for code in $DEBIAN_CODES; do |
---|
116 | v dareprepro include "${code}${release}" "$change" |
---|
117 | done |
---|
118 | |
---|
119 | if [ $S -ne 1 ]; then |
---|
120 | for code in $DEBIAN_CODES; do |
---|
121 | tag=$(gettag "$code") |
---|
122 | [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes" |
---|
123 | v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes" |
---|
124 | done |
---|
125 | fi |
---|
126 | |
---|
127 | changes=$change |
---|
128 | for code in $DEBIAN_CODES; do |
---|
129 | tag=$(gettag "$code") |
---|
130 | [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes |
---|
131 | changes=$changes\ "${base}${tag}"_amd64.changes |
---|
132 | done |
---|
133 | |
---|
134 | files=${change%.changes}.build\ $changes |
---|
135 | origfiles= |
---|
136 | for change in $changes; do |
---|
137 | files=$files\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
138 | origfiles=$origfiles\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep '\.orig\.tar\.gz$' || :) |
---|
139 | done |
---|
140 | |
---|
141 | built=built/ |
---|
142 | [ -d "$built" ] || mkdir "$built" |
---|
143 | mv -i $files "$built" |
---|
144 | if [ -n "$origfiles" ]; then |
---|
145 | for orig in $origfiles; do |
---|
146 | [ -e "$built/$orig" ] || cp -ai "$orig" "$built/" |
---|
147 | done |
---|
148 | fi |
---|