[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} |
---|
[24877] | 9 | : ${DEBATHENA_RELEASE=-development} |
---|
[24680] | 10 | export DEBATHENA_RELEASE |
---|
[22953] | 11 | . /mit/debathena/bin/debian-versions.sh |
---|
| 12 | tag=$(gettag $suite) |
---|
[22687] | 13 | [ -n "$1" ] |
---|
| 14 | [ -n "$2" ] |
---|
| 15 | trap 'echo "An error occured. Press Enter to continue." >&2; echo -en "\a"; read ERROR; touch "$stamp.error"' EXIT |
---|
| 16 | touch "$stamp.started" |
---|
[22944] | 17 | dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package#debathena-}") |
---|
| 18 | if [ ! -e $dir ]; then |
---|
| 19 | dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package}") |
---|
| 20 | fi |
---|
[22687] | 21 | [ -e "$dir" ] |
---|
| 22 | cd "$dir" |
---|
[24195] | 23 | if fgrep -q "$suite" nobuild; then |
---|
| 24 | touch "$stamp.done" |
---|
| 25 | trap - EXIT |
---|
| 26 | exit |
---|
| 27 | fi |
---|
[23579] | 28 | debathenificator=$(echo ./debathenify-*) |
---|
| 29 | if [ "$debathenificator" != "./debathenify-*" ]; then |
---|
| 30 | "$debathenificator" "${suite}-amd64" -A source binary upload |
---|
| 31 | "$debathenificator" "${suite}-i386" source binary upload |
---|
[23582] | 32 | touch "$stamp.done" |
---|
| 33 | trap - EXIT |
---|
[23579] | 34 | exit |
---|
| 35 | fi |
---|
[22944] | 36 | version=$(zcat ${DEBATHENA_APT}/dists/$psuite/*/source/Sources.gz | dpkg-awk -f - "Package:^$package\$" -- Version | sed -n 's/Version: // p') |
---|
[22687] | 37 | if [ -d "built/" ]; then |
---|
[23579] | 38 | dsc="built/${package}_$version.dsc" |
---|
[22687] | 39 | fi |
---|
[23579] | 40 | if ! [ -e "$dsc" ]; then |
---|
| 41 | if ! [ -e "${package}_$version.dsc" ]; then |
---|
[24884] | 42 | schroot -c "${psuite}-amd64-sbuild" -u root -- sh -ec "SBUILD_BUILD_CONF_DISTRIBUTION=$psuite $(readlink -f /mit/debathena/bin/chroot-sources) && apt-get update && apt-get source $package" |
---|
[23579] | 43 | fi |
---|
[24195] | 44 | if ! ([ -e "${package}_${version}_source.changes" ] || [ -e "${package}_${version}_amd64.changes" ] || [ -e "${package}_${version}_i386.changes" ]); then |
---|
[23579] | 45 | (cd "${package}-${version/-*/}" && dpkg-genchanges -S -sa >"../${package}_${version}_source.changes") |
---|
| 46 | fi |
---|
| 47 | dsc="${package}_$version.dsc" |
---|
| 48 | fi |
---|
[22687] | 49 | [ -e "$dsc" ] |
---|
| 50 | |
---|
[22944] | 51 | if [ -e "${dsc%.dsc}_amd64.changes" ] || [ -e "${dsc%.dsc}_i386.changes" ]; then |
---|
[24880] | 52 | # If there is no ~debianX.Y tag in the .changes filename, this should be an |
---|
[24879] | 53 | # equivs package. Set variables and check that it is, in fact, an equivs |
---|
| 54 | # package. Note that it should be built already (since we build equivs |
---|
| 55 | # packages once and upload them to all releases). |
---|
[22687] | 56 | changes="${dsc%.dsc}_amd64.changes" |
---|
[22944] | 57 | buildlog="${dsc%.dsc}_amd64.build" |
---|
| 58 | if [ ! -e $changes ]; then |
---|
| 59 | changes="${dsc%.dsc}_i386.changes" |
---|
| 60 | buildlog="${dsc%.dsc}_i386.build" |
---|
| 61 | fi |
---|
[24880] | 62 | debfile="$(dpkg-awk -f "$changes" -- Files | awk '$5 ~ /_all\.deb$/ {print $5}')" |
---|
[24879] | 63 | [ -e "$debfile" ] |
---|
[24881] | 64 | 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] | 65 | else |
---|
[24879] | 66 | # This is a normal (non-equivs) package, so we want to build it for this |
---|
| 67 | # release. |
---|
[22687] | 68 | [ -e "${dsc%.dsc}_source.changes" ] |
---|
| 69 | changes="${dsc%.dsc}_source.changes" |
---|
| 70 | A=1 |
---|
[22944] | 71 | 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] | 72 | A=0 |
---|
| 73 | fi |
---|
| 74 | sbuildhack "${suite}-amd64" -A "$dsc" |
---|
| 75 | [ $A -eq 1 ] || sbuildhack "${suite}-i386" "$dsc" |
---|
| 76 | changes=$changes\ "$(basename "${dsc%.dsc}${tag}_amd64.changes")" |
---|
| 77 | [ $A -eq 1 ] || changes=$changes\ "$(basename "${dsc%.dsc}${tag}_i386.changes")" |
---|
| 78 | fi |
---|
| 79 | |
---|
| 80 | #while |
---|
| 81 | # echo "Type yes to upload: $changes" |
---|
| 82 | # echo -en "\a" |
---|
| 83 | # read UPLOAD |
---|
| 84 | # [ "$UPLOAD" != "yes" ]; do |
---|
| 85 | # : |
---|
| 86 | #done |
---|
| 87 | |
---|
| 88 | ( |
---|
| 89 | flock -x 200 |
---|
| 90 | files= |
---|
| 91 | for change in $changes; do |
---|
| 92 | if [ "$change" = "${dsc%.dsc}_source.changes" ]; then |
---|
[24877] | 93 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 94 | else |
---|
[24877] | 95 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 96 | files=$files\ $change\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
| 97 | fi |
---|
| 98 | done |
---|
| 99 | ! [ -d "built/" ] || mv -i $files "built/" |
---|
| 100 | ) 200> /tmp/debathena-repository-lock |
---|
| 101 | |
---|
| 102 | touch "$stamp.done" |
---|
| 103 | trap - EXIT |
---|