[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 | ;; |
---|
[25562] | 32 | daupload-bleeding) |
---|
| 33 | release="-bleeding" |
---|
| 34 | ;; |
---|
[22687] | 35 | *) |
---|
[23553] | 36 | echo "Unknown release." >&2 |
---|
[22687] | 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") |
---|
[22730] | 54 | base=${change%_source.changes} |
---|
[22687] | 55 | |
---|
| 56 | check () { |
---|
| 57 | [ -s "$1" ] || missing="$missing$1 " |
---|
| 58 | } |
---|
| 59 | uncheck () { |
---|
| 60 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
| 61 | } |
---|
| 62 | |
---|
[25497] | 63 | # If ./nobuild exists, filter out its contents from DEBIAN_CODES. |
---|
| 64 | if [ -e nobuild ]; then |
---|
[23072] | 65 | newcodes= |
---|
| 66 | for code in $DEBIAN_CODES; do |
---|
[25497] | 67 | if ! fgrep -q "$code" nobuild; then |
---|
[23072] | 68 | newcodes="$newcodes $code" |
---|
| 69 | fi |
---|
| 70 | done |
---|
| 71 | DEBIAN_CODES=$newcodes |
---|
| 72 | fi |
---|
| 73 | |
---|
[22687] | 74 | missing= |
---|
| 75 | [ -s "$change" ] |
---|
| 76 | if [ $S -ne 1 ]; then |
---|
[22739] | 77 | for code in $DEBIAN_CODES; do |
---|
[22977] | 78 | tag=$(gettag "$code") |
---|
| 79 | check "${base}${tag}_amd64.changes" |
---|
[22739] | 80 | done |
---|
[22687] | 81 | if [ $A -eq 1 ]; then |
---|
[22739] | 82 | for code in $DEBIAN_CODES; do |
---|
[22977] | 83 | tag=$(gettag "$code") |
---|
| 84 | uncheck "${base}${tag}_i386.changes" |
---|
[22739] | 85 | done |
---|
[22687] | 86 | else |
---|
[22739] | 87 | for code in $DEBIAN_CODES; do |
---|
[22977] | 88 | tag=$(gettag "$code") |
---|
| 89 | check "${base}${tag}_i386.changes" |
---|
[22739] | 90 | done |
---|
[22687] | 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 | |
---|
[22739] | 101 | for code in $DEBIAN_CODES; do |
---|
[24566] | 102 | v dareprepro include "${code}${release}" "$change" |
---|
[22739] | 103 | done |
---|
[22687] | 104 | |
---|
| 105 | if [ $S -ne 1 ]; then |
---|
[22739] | 106 | for code in $DEBIAN_CODES; do |
---|
[22977] | 107 | tag=$(gettag "$code") |
---|
[24566] | 108 | [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes" |
---|
[24570] | 109 | v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes" |
---|
[22739] | 110 | done |
---|
[22687] | 111 | fi |
---|
| 112 | |
---|
| 113 | changes=$change |
---|
[22751] | 114 | for code in $DEBIAN_CODES; do |
---|
[22977] | 115 | tag=$(gettag "$code") |
---|
| 116 | [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes |
---|
| 117 | changes=$changes\ "${base}${tag}"_amd64.changes |
---|
[22739] | 118 | done |
---|
[22687] | 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 |
---|