source: trunk/debathena/scripts/build-server/build-all/do-build @ 24884

Revision 24884, 4.0 KB checked in by geofft, 14 years ago (diff)
do-build: Oops, --setup-hook is an sbuild option, not an schroot one This is getting a bit ugly. We should have a better way of downloading source packages.
  • Property svn:executable set to *
RevLine 
[22687]1#!/bin/bash
2set -xe
3package=$1
4stamp=$2
[22944]5suite=$3
6psuite=$4
7: ${DEBATHENA_APT=/mit/debathena/apt}
8: ${DEBATHENA_BUILD_AREA=/afs/sipb.mit.edu/project/debathena/packages}
[24877]9: ${DEBATHENA_RELEASE=-development}
[24680]10export DEBATHENA_RELEASE
[22953]11. /mit/debathena/bin/debian-versions.sh
12tag=$(gettag $suite)
[22687]13[ -n "$1" ]
14[ -n "$2" ]
15trap 'echo "An error occured.  Press Enter to continue." >&2; echo -en "\a"; read ERROR; touch "$stamp.error"' EXIT
16touch "$stamp.started"
[22944]17dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package#debathena-}")
18if [ ! -e $dir ]; then
19    dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package}")
20fi
[22687]21[ -e "$dir" ]
22cd "$dir"
[24195]23if fgrep -q "$suite" nobuild; then
24    touch "$stamp.done"
25    trap - EXIT
26    exit
27fi
[23579]28debathenificator=$(echo ./debathenify-*)
29if [ "$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
35fi
[22944]36version=$(zcat ${DEBATHENA_APT}/dists/$psuite/*/source/Sources.gz | dpkg-awk -f - "Package:^$package\$" -- Version | sed -n 's/Version: // p')
[22687]37if [ -d "built/" ]; then
[23579]38    dsc="built/${package}_$version.dsc"
[22687]39fi
[23579]40if ! [ -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"
48fi
[22687]49[ -e "$dsc" ]
50
[22944]51if [ -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]65else
[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")"
78fi
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
102touch "$stamp.done"
103trap - EXIT
Note: See TracBrowser for help on using the repository browser.