[22687] | 1 | #!/bin/sh |
---|
| 2 | set -e |
---|
| 3 | |
---|
[22688] | 4 | # Usage: daupload-release [-A] [-S] CHANGESFILE |
---|
[23553] | 5 | # daupload-proposed [-A] [-S] CHANGESFILE |
---|
| 6 | # daupload-dev [-A] [-S] CHANGESFILE |
---|
[22688] | 7 | |
---|
| 8 | # After a package has been built for all Debian/Ubuntu versions and |
---|
| 9 | # platforms (typically using "da sbuildhack DSCFILE"), this script |
---|
[23553] | 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. |
---|
[22688] | 14 | |
---|
| 15 | # Upon completion, moves all of the generated files into the "built" |
---|
| 16 | # subdirectory. |
---|
| 17 | |
---|
[23072] | 18 | # This script will skip dists listed in ./nobuild. |
---|
| 19 | |
---|
[22740] | 20 | : ${DEBATHENA_APT=/mit/debathena/apt} |
---|
[22748] | 21 | . $(dirname "$0")/debian-versions.sh |
---|
[22700] | 22 | |
---|
[22687] | 23 | case "$(basename "$0")" in |
---|
| 24 | daupload-release) |
---|
[23553] | 25 | release="" |
---|
[22687] | 26 | ;; |
---|
[23553] | 27 | daupload-proposed) |
---|
| 28 | release="-proposed" |
---|
[22687] | 29 | ;; |
---|
[23553] | 30 | daupload-dev) |
---|
[23568] | 31 | release="-development" |
---|
[23553] | 32 | ;; |
---|
[22687] | 33 | *) |
---|
[23553] | 34 | echo "Unknown release." >&2 |
---|
[22687] | 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") |
---|
[22730] | 52 | base=${change%_source.changes} |
---|
[22687] | 53 | |
---|
| 54 | check () { |
---|
| 55 | [ -s "$1" ] || missing="$missing$1 " |
---|
| 56 | } |
---|
| 57 | uncheck () { |
---|
| 58 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
| 59 | } |
---|
| 60 | |
---|
[23072] | 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 | |
---|
[22687] | 72 | missing= |
---|
| 73 | [ -s "$change" ] |
---|
| 74 | if [ $S -ne 1 ]; then |
---|
[22739] | 75 | for code in $DEBIAN_CODES; do |
---|
[22977] | 76 | tag=$(gettag "$code") |
---|
| 77 | check "${base}${tag}_amd64.changes" |
---|
[22739] | 78 | done |
---|
[22687] | 79 | if [ $A -eq 1 ]; then |
---|
[22739] | 80 | for code in $DEBIAN_CODES; do |
---|
[22977] | 81 | tag=$(gettag "$code") |
---|
| 82 | uncheck "${base}${tag}_i386.changes" |
---|
[22739] | 83 | done |
---|
[22687] | 84 | else |
---|
[22739] | 85 | for code in $DEBIAN_CODES; do |
---|
[22977] | 86 | tag=$(gettag "$code") |
---|
| 87 | check "${base}${tag}_i386.changes" |
---|
[22739] | 88 | done |
---|
[22687] | 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 | |
---|
[23553] | 99 | REPREPRO="v reprepro -Vb $DEBATHENA_APT" |
---|
[22687] | 100 | REPREPROI="$REPREPRO --ignore=wrongdistribution" |
---|
| 101 | |
---|
[22739] | 102 | for code in $DEBIAN_CODES; do |
---|
[23553] | 103 | $REPREPROI include "${code}${release}" "$change" |
---|
[22739] | 104 | done |
---|
[22687] | 105 | |
---|
| 106 | if [ $S -ne 1 ]; then |
---|
[22739] | 107 | for code in $DEBIAN_CODES; do |
---|
[22977] | 108 | tag=$(gettag "$code") |
---|
[23553] | 109 | [ $A -eq 1 ] || $REPREPROI include "${code}${release}" "${base}${tag}_i386.changes" |
---|
| 110 | $REPREPROI include "${code}${release}" "${base}${tag}_amd64.changes" |
---|
[22739] | 111 | done |
---|
[22687] | 112 | fi |
---|
| 113 | |
---|
| 114 | changes=$change |
---|
[22751] | 115 | for code in $DEBIAN_CODES; do |
---|
[22977] | 116 | tag=$(gettag "$code") |
---|
| 117 | [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes |
---|
| 118 | changes=$changes\ "${base}${tag}"_amd64.changes |
---|
[22739] | 119 | done |
---|
[22687] | 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 |
---|