[22687] | 1 | #!/bin/bash |
---|
| 2 | set -xe |
---|
| 3 | package=$1 |
---|
| 4 | stamp=$2 |
---|
[22944] | 5 | suite=$3 |
---|
| 6 | psuite=$4 |
---|
| 7 | : ${DEBATHENA_APT=/mit/debathena/apt} |
---|
| 8 | : ${DEBATHENA_BUILD_AREA=/afs/sipb.mit.edu/project/debathena/packages} |
---|
[25588] | 9 | # Release to upload to |
---|
[25586] | 10 | : ${DEBATHENA_RELEASE=-staging} |
---|
[24680] | 11 | export DEBATHENA_RELEASE |
---|
[22953] | 12 | . /mit/debathena/bin/debian-versions.sh |
---|
| 13 | tag=$(gettag $suite) |
---|
[22687] | 14 | [ -n "$1" ] |
---|
| 15 | [ -n "$2" ] |
---|
| 16 | trap 'echo "An error occured. Press Enter to continue." >&2; echo -en "\a"; read ERROR; touch "$stamp.error"' EXIT |
---|
| 17 | touch "$stamp.started" |
---|
[22944] | 18 | dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package#debathena-}") |
---|
| 19 | if [ ! -e $dir ]; then |
---|
| 20 | dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package}") |
---|
| 21 | fi |
---|
[22687] | 22 | [ -e "$dir" ] |
---|
| 23 | cd "$dir" |
---|
[25588] | 24 | # Skip the package if it's listed in nobuild |
---|
[24195] | 25 | if fgrep -q "$suite" nobuild; then |
---|
| 26 | touch "$stamp.done" |
---|
| 27 | trap - EXIT |
---|
| 28 | exit |
---|
| 29 | fi |
---|
[25588] | 30 | # Deal with debathenified packges |
---|
[23579] | 31 | debathenificator=$(echo ./debathenify-*) |
---|
| 32 | if [ "$debathenificator" != "./debathenify-*" ]; then |
---|
| 33 | "$debathenificator" "${suite}-amd64" -A source binary upload |
---|
| 34 | "$debathenificator" "${suite}-i386" source binary upload |
---|
[23582] | 35 | touch "$stamp.done" |
---|
| 36 | trap - EXIT |
---|
[23579] | 37 | exit |
---|
| 38 | fi |
---|
[25588] | 39 | # For each of the releases in the previous suite, look for the source |
---|
| 40 | # package versions and accept the last one we find. Due to the |
---|
| 41 | # current repo layout, this also happens to be the highest version. |
---|
| 42 | # We may wish to explicitly select the highest version in the code. |
---|
[25592] | 43 | extra= |
---|
| 44 | if [ "$psuite" = "$suite" ]; then |
---|
| 45 | extra="-staging" |
---|
| 46 | fi |
---|
| 47 | for suffix in "" -proposed -development $extra; do |
---|
[25130] | 48 | vv=$(zcat ${DEBATHENA_APT}/dists/$psuite$suffix/*/source/Sources.gz | dpkg-awk -f - "Package:^$package\$" -- Version | sed -n 's/Version: // p') |
---|
[25129] | 49 | if [ -n "$vv" ]; then |
---|
| 50 | version="$vv" |
---|
| 51 | fi |
---|
| 52 | done |
---|
[25588] | 53 | # Find the .dsc in the built/ directory for the package |
---|
[22687] | 54 | if [ -d "built/" ]; then |
---|
[23579] | 55 | dsc="built/${package}_$version.dsc" |
---|
[22687] | 56 | fi |
---|
[25588] | 57 | # Build the .dsc if necessary. |
---|
[23579] | 58 | if ! [ -e "$dsc" ]; then |
---|
| 59 | if ! [ -e "${package}_$version.dsc" ]; then |
---|
[25965] | 60 | schroot -c "${psuite}-amd64-sbuild" -p -u root -- sh -ec "DEBATHENA_BUILD_DIST=$psuite $(readlink -f /mit/debathena/bin/chroot-sources) && apt-get update && apt-get source $package" |
---|
[23579] | 61 | fi |
---|
[24195] | 62 | if ! ([ -e "${package}_${version}_source.changes" ] || [ -e "${package}_${version}_amd64.changes" ] || [ -e "${package}_${version}_i386.changes" ]); then |
---|
[23579] | 63 | (cd "${package}-${version/-*/}" && dpkg-genchanges -S -sa >"../${package}_${version}_source.changes") |
---|
| 64 | fi |
---|
| 65 | dsc="${package}_$version.dsc" |
---|
| 66 | fi |
---|
[22687] | 67 | [ -e "$dsc" ] |
---|
| 68 | |
---|
[22944] | 69 | if [ -e "${dsc%.dsc}_amd64.changes" ] || [ -e "${dsc%.dsc}_i386.changes" ]; then |
---|
[24880] | 70 | # If there is no ~debianX.Y tag in the .changes filename, this should be an |
---|
[24879] | 71 | # equivs package. Set variables and check that it is, in fact, an equivs |
---|
| 72 | # package. Note that it should be built already (since we build equivs |
---|
| 73 | # packages once and upload them to all releases). |
---|
[22687] | 74 | changes="${dsc%.dsc}_amd64.changes" |
---|
[22944] | 75 | buildlog="${dsc%.dsc}_amd64.build" |
---|
| 76 | if [ ! -e $changes ]; then |
---|
| 77 | changes="${dsc%.dsc}_i386.changes" |
---|
| 78 | buildlog="${dsc%.dsc}_i386.build" |
---|
| 79 | fi |
---|
[24880] | 80 | debfile="$(dpkg-awk -f "$changes" -- Files | awk '$5 ~ /_all\.deb$/ {print $5}')" |
---|
[24879] | 81 | [ -e "$debfile" ] |
---|
[24881] | 82 | dpkg --fsys-tarfile "$debfile" | tar xO ./usr/share/doc/"$package"/README.Debian | egrep -q '(The special dependencies used in this package are:|This is a Debathena manual configuration package)' |
---|
[22687] | 83 | else |
---|
[24879] | 84 | # This is a normal (non-equivs) package, so we want to build it for this |
---|
| 85 | # release. |
---|
[22687] | 86 | [ -e "${dsc%.dsc}_source.changes" ] |
---|
| 87 | changes="${dsc%.dsc}_source.changes" |
---|
| 88 | A=1 |
---|
[22944] | 89 | if (zcat ${DEBATHENA_APT}/dists/$psuite/*/binary-i386/Packages.gz | dpkg-awk -f - "Source:^$package\$" -- Architecture; zcat ${DEBATHENA_APT}/dists/$psuite/*/binary-i386/Packages.gz | dpkg-awk -f - "Package:^$package\$" -- Architecture) | grep -Fxv 'Architecture: all' | grep -q .; then |
---|
[22687] | 90 | A=0 |
---|
| 91 | fi |
---|
| 92 | sbuildhack "${suite}-amd64" -A "$dsc" |
---|
| 93 | [ $A -eq 1 ] || sbuildhack "${suite}-i386" "$dsc" |
---|
| 94 | changes=$changes\ "$(basename "${dsc%.dsc}${tag}_amd64.changes")" |
---|
| 95 | [ $A -eq 1 ] || changes=$changes\ "$(basename "${dsc%.dsc}${tag}_i386.changes")" |
---|
| 96 | fi |
---|
| 97 | |
---|
| 98 | #while |
---|
| 99 | # echo "Type yes to upload: $changes" |
---|
| 100 | # echo -en "\a" |
---|
| 101 | # read UPLOAD |
---|
| 102 | # [ "$UPLOAD" != "yes" ]; do |
---|
| 103 | # : |
---|
| 104 | #done |
---|
| 105 | |
---|
| 106 | ( |
---|
| 107 | flock -x 200 |
---|
| 108 | files= |
---|
| 109 | for change in $changes; do |
---|
| 110 | if [ "$change" = "${dsc%.dsc}_source.changes" ]; then |
---|
[24877] | 111 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 112 | else |
---|
[24877] | 113 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 114 | files=$files\ $change\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
| 115 | fi |
---|
| 116 | done |
---|
| 117 | ! [ -d "built/" ] || mv -i $files "built/" |
---|
| 118 | ) 200> /tmp/debathena-repository-lock |
---|
| 119 | |
---|
| 120 | touch "$stamp.done" |
---|
| 121 | trap - EXIT |
---|