[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 | |
---|
[25747] | 20 | : ${DA_SCRIPTS_DIR="$(dirname "$0")"} |
---|
| 21 | . "$DA_SCRIPTS_DIR"/debian-versions.sh |
---|
[22700] | 22 | |
---|
[25940] | 23 | if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then |
---|
| 24 | echo "Will override DEBIAN_CODES with: $DEBIAN_CODES_OVERRIDE" |
---|
| 25 | echo -n "Continue? [y/N]" |
---|
| 26 | read a |
---|
| 27 | [ "$a" = "y" ] |
---|
| 28 | DEBIAN_CODES="$DEBIAN_CODES_OVERRIDE" |
---|
| 29 | fi |
---|
| 30 | |
---|
[22687] | 31 | case "$(basename "$0")" in |
---|
| 32 | daupload-release) |
---|
[23553] | 33 | release="" |
---|
[22687] | 34 | ;; |
---|
[23553] | 35 | daupload-proposed) |
---|
| 36 | release="-proposed" |
---|
[22687] | 37 | ;; |
---|
[23553] | 38 | daupload-dev) |
---|
[23568] | 39 | release="-development" |
---|
[23553] | 40 | ;; |
---|
[25562] | 41 | daupload-bleeding) |
---|
| 42 | release="-bleeding" |
---|
| 43 | ;; |
---|
[22687] | 44 | *) |
---|
[23553] | 45 | echo "Unknown release." >&2 |
---|
[22687] | 46 | exit 1 |
---|
| 47 | ;; |
---|
| 48 | esac |
---|
| 49 | |
---|
| 50 | v () { |
---|
| 51 | echo "$@" |
---|
| 52 | "$@" |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | A=0 |
---|
| 56 | if [ "$1" = "-A" ]; then A=1; shift; fi |
---|
| 57 | S=0 |
---|
| 58 | if [ "$1" = "-S" ]; then S=1; shift; fi |
---|
| 59 | |
---|
| 60 | change=$1 |
---|
| 61 | cd "$(dirname "$change")" |
---|
| 62 | change=$(basename "$change") |
---|
[22730] | 63 | base=${change%_source.changes} |
---|
[22687] | 64 | |
---|
| 65 | check () { |
---|
| 66 | [ -s "$1" ] || missing="$missing$1 " |
---|
| 67 | } |
---|
| 68 | uncheck () { |
---|
| 69 | ! [ -s "$1" ] || missing="$missing-$1 " |
---|
| 70 | } |
---|
| 71 | |
---|
[25497] | 72 | # If ./nobuild exists, filter out its contents from DEBIAN_CODES. |
---|
| 73 | if [ -e nobuild ]; then |
---|
[23072] | 74 | newcodes= |
---|
| 75 | for code in $DEBIAN_CODES; do |
---|
[25497] | 76 | if ! fgrep -q "$code" nobuild; then |
---|
[23072] | 77 | newcodes="$newcodes $code" |
---|
| 78 | fi |
---|
| 79 | done |
---|
| 80 | DEBIAN_CODES=$newcodes |
---|
| 81 | fi |
---|
| 82 | |
---|
[22687] | 83 | missing= |
---|
| 84 | [ -s "$change" ] |
---|
| 85 | if [ $S -ne 1 ]; then |
---|
[22739] | 86 | for code in $DEBIAN_CODES; do |
---|
[22977] | 87 | tag=$(gettag "$code") |
---|
| 88 | check "${base}${tag}_amd64.changes" |
---|
[22739] | 89 | done |
---|
[22687] | 90 | if [ $A -eq 1 ]; then |
---|
[22739] | 91 | for code in $DEBIAN_CODES; do |
---|
[22977] | 92 | tag=$(gettag "$code") |
---|
| 93 | uncheck "${base}${tag}_i386.changes" |
---|
[22739] | 94 | done |
---|
[22687] | 95 | else |
---|
[22739] | 96 | for code in $DEBIAN_CODES; do |
---|
[22977] | 97 | tag=$(gettag "$code") |
---|
| 98 | check "${base}${tag}_i386.changes" |
---|
[22739] | 99 | done |
---|
[22687] | 100 | fi |
---|
| 101 | fi |
---|
| 102 | |
---|
| 103 | if [ -n "$missing" ]; then |
---|
| 104 | echo "Missing $missing" >&2 |
---|
| 105 | echo -n "Continue? [y/N]" |
---|
| 106 | read a |
---|
| 107 | [ "$a" = "y" ] |
---|
| 108 | fi |
---|
| 109 | |
---|
[22739] | 110 | for code in $DEBIAN_CODES; do |
---|
[24566] | 111 | v dareprepro include "${code}${release}" "$change" |
---|
[22739] | 112 | done |
---|
[22687] | 113 | |
---|
| 114 | if [ $S -ne 1 ]; then |
---|
[22739] | 115 | for code in $DEBIAN_CODES; do |
---|
[22977] | 116 | tag=$(gettag "$code") |
---|
[24566] | 117 | [ $A -eq 1 ] || v dareprepro include "${code}${release}" "${base}${tag}_i386.changes" |
---|
[24570] | 118 | v dareprepro include "${code}${release}" "${base}${tag}_amd64.changes" |
---|
[22739] | 119 | done |
---|
[22687] | 120 | fi |
---|
| 121 | |
---|
[25940] | 122 | if [ -n "$DEBIAN_CODES_OVERRIDE" ]; then |
---|
| 123 | echo "Codes overridden, skipping copy of files. Cleanup by hand." |
---|
| 124 | exit 0 |
---|
| 125 | fi |
---|
| 126 | |
---|
[22687] | 127 | changes=$change |
---|
[22751] | 128 | for code in $DEBIAN_CODES; do |
---|
[22977] | 129 | tag=$(gettag "$code") |
---|
| 130 | [ $A -eq 1 ] || changes=$changes\ "${base}${tag}"_i386.changes |
---|
| 131 | changes=$changes\ "${base}${tag}"_amd64.changes |
---|
[22739] | 132 | done |
---|
[22687] | 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 |
---|