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