[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. |
---|
| 43 | for suffix in "" -proposed -development; do |
---|
[25130] | 44 | vv=$(zcat ${DEBATHENA_APT}/dists/$psuite$suffix/*/source/Sources.gz | dpkg-awk -f - "Package:^$package\$" -- Version | sed -n 's/Version: // p') |
---|
[25129] | 45 | if [ -n "$vv" ]; then |
---|
| 46 | version="$vv" |
---|
| 47 | fi |
---|
| 48 | done |
---|
[25588] | 49 | # Find the .dsc in the built/ directory for the package |
---|
[22687] | 50 | if [ -d "built/" ]; then |
---|
[23579] | 51 | dsc="built/${package}_$version.dsc" |
---|
[22687] | 52 | fi |
---|
[25588] | 53 | # Build the .dsc if necessary. |
---|
[23579] | 54 | if ! [ -e "$dsc" ]; then |
---|
| 55 | if ! [ -e "${package}_$version.dsc" ]; then |
---|
[24884] | 56 | 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] | 57 | fi |
---|
[24195] | 58 | if ! ([ -e "${package}_${version}_source.changes" ] || [ -e "${package}_${version}_amd64.changes" ] || [ -e "${package}_${version}_i386.changes" ]); then |
---|
[23579] | 59 | (cd "${package}-${version/-*/}" && dpkg-genchanges -S -sa >"../${package}_${version}_source.changes") |
---|
| 60 | fi |
---|
| 61 | dsc="${package}_$version.dsc" |
---|
| 62 | fi |
---|
[22687] | 63 | [ -e "$dsc" ] |
---|
| 64 | |
---|
[22944] | 65 | if [ -e "${dsc%.dsc}_amd64.changes" ] || [ -e "${dsc%.dsc}_i386.changes" ]; then |
---|
[24880] | 66 | # If there is no ~debianX.Y tag in the .changes filename, this should be an |
---|
[24879] | 67 | # equivs package. Set variables and check that it is, in fact, an equivs |
---|
| 68 | # package. Note that it should be built already (since we build equivs |
---|
| 69 | # packages once and upload them to all releases). |
---|
[22687] | 70 | changes="${dsc%.dsc}_amd64.changes" |
---|
[22944] | 71 | buildlog="${dsc%.dsc}_amd64.build" |
---|
| 72 | if [ ! -e $changes ]; then |
---|
| 73 | changes="${dsc%.dsc}_i386.changes" |
---|
| 74 | buildlog="${dsc%.dsc}_i386.build" |
---|
| 75 | fi |
---|
[24880] | 76 | debfile="$(dpkg-awk -f "$changes" -- Files | awk '$5 ~ /_all\.deb$/ {print $5}')" |
---|
[24879] | 77 | [ -e "$debfile" ] |
---|
[24881] | 78 | 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] | 79 | else |
---|
[24879] | 80 | # This is a normal (non-equivs) package, so we want to build it for this |
---|
| 81 | # release. |
---|
[22687] | 82 | [ -e "${dsc%.dsc}_source.changes" ] |
---|
| 83 | changes="${dsc%.dsc}_source.changes" |
---|
| 84 | A=1 |
---|
[22944] | 85 | 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] | 86 | A=0 |
---|
| 87 | fi |
---|
| 88 | sbuildhack "${suite}-amd64" -A "$dsc" |
---|
| 89 | [ $A -eq 1 ] || sbuildhack "${suite}-i386" "$dsc" |
---|
| 90 | changes=$changes\ "$(basename "${dsc%.dsc}${tag}_amd64.changes")" |
---|
| 91 | [ $A -eq 1 ] || changes=$changes\ "$(basename "${dsc%.dsc}${tag}_i386.changes")" |
---|
| 92 | fi |
---|
| 93 | |
---|
| 94 | #while |
---|
| 95 | # echo "Type yes to upload: $changes" |
---|
| 96 | # echo -en "\a" |
---|
| 97 | # read UPLOAD |
---|
| 98 | # [ "$UPLOAD" != "yes" ]; do |
---|
| 99 | # : |
---|
| 100 | #done |
---|
| 101 | |
---|
| 102 | ( |
---|
| 103 | flock -x 200 |
---|
| 104 | files= |
---|
| 105 | for change in $changes; do |
---|
| 106 | if [ "$change" = "${dsc%.dsc}_source.changes" ]; then |
---|
[24877] | 107 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 108 | else |
---|
[24877] | 109 | dareprepro include "$suite$DEBATHENA_RELEASE" "$change" |
---|
[22687] | 110 | files=$files\ $change\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :) |
---|
| 111 | fi |
---|
| 112 | done |
---|
| 113 | ! [ -d "built/" ] || mv -i $files "built/" |
---|
| 114 | ) 200> /tmp/debathena-repository-lock |
---|
| 115 | |
---|
| 116 | touch "$stamp.done" |
---|
| 117 | trap - EXIT |
---|