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

Revision 25129, 4.1 KB checked in by geofft, 13 years ago (diff)
do-build: Take non-production releases of into account
  • Property svn:executable set to *
Line 
1#!/bin/bash
2set -xe
3package=$1
4stamp=$2
5suite=$3
6psuite=$4
7: ${DEBATHENA_APT=/mit/debathena/apt}
8: ${DEBATHENA_BUILD_AREA=/afs/sipb.mit.edu/project/debathena/packages}
9: ${DEBATHENA_RELEASE=-development}
10export DEBATHENA_RELEASE
11. /mit/debathena/bin/debian-versions.sh
12tag=$(gettag $suite)
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"
17dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package#debathena-}")
18if [ ! -e $dir ]; then
19    dir=$(echo ${DEBATHENA_BUILD_AREA}/*/"${package}")
20fi
21[ -e "$dir" ]
22cd "$dir"
23if fgrep -q "$suite" nobuild; then
24    touch "$stamp.done"
25    trap - EXIT
26    exit
27fi
28debathenificator=$(echo ./debathenify-*)
29if [ "$debathenificator" != "./debathenify-*" ]; then
30    "$debathenificator" "${suite}-amd64" -A source binary upload
31    "$debathenificator" "${suite}-i386" source binary upload
32    touch "$stamp.done"
33    trap - EXIT
34    exit
35fi
36for suffix in "" -proposed -development; do
37    vv=$(zcat ${DEBATHENA_APT}/dists/$psuite/*/source/Sources.gz | dpkg-awk -f - "Package:^$package\$" -- Version | sed -n 's/Version: // p')
38    if [ -n "$vv" ]; then
39        version="$vv"
40    fi
41done
42if [ -d "built/" ]; then
43    dsc="built/${package}_$version.dsc"
44fi
45if ! [ -e "$dsc" ]; then
46    if ! [ -e "${package}_$version.dsc" ]; then
47        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"
48    fi
49    if ! ([ -e "${package}_${version}_source.changes" ] || [ -e "${package}_${version}_amd64.changes" ] || [ -e "${package}_${version}_i386.changes" ]); then
50        (cd "${package}-${version/-*/}" && dpkg-genchanges -S -sa >"../${package}_${version}_source.changes")
51    fi
52    dsc="${package}_$version.dsc"
53fi
54[ -e "$dsc" ]
55
56if [ -e "${dsc%.dsc}_amd64.changes" ] || [ -e "${dsc%.dsc}_i386.changes" ]; then
57    # If there is no ~debianX.Y tag in the .changes filename, this should be an
58    # equivs package. Set variables and check that it is, in fact, an equivs
59    # package. Note that it should be built already (since we build equivs
60    # packages once and upload them to all releases).
61    changes="${dsc%.dsc}_amd64.changes"
62    buildlog="${dsc%.dsc}_amd64.build"
63    if [ ! -e $changes ]; then
64        changes="${dsc%.dsc}_i386.changes"
65        buildlog="${dsc%.dsc}_i386.build"
66    fi
67    debfile="$(dpkg-awk -f "$changes" -- Files | awk '$5 ~ /_all\.deb$/ {print $5}')"
68    [ -e "$debfile" ]
69    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)'
70else
71    # This is a normal (non-equivs) package, so we want to build it for this
72    # release.
73    [ -e "${dsc%.dsc}_source.changes" ]
74    changes="${dsc%.dsc}_source.changes"
75    A=1
76    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
77        A=0
78    fi
79    sbuildhack "${suite}-amd64" -A "$dsc"
80    [ $A -eq 1 ] || sbuildhack "${suite}-i386" "$dsc"
81    changes=$changes\ "$(basename "${dsc%.dsc}${tag}_amd64.changes")"
82    [ $A -eq 1 ] || changes=$changes\ "$(basename "${dsc%.dsc}${tag}_i386.changes")"
83fi
84
85#while
86#    echo "Type yes to upload: $changes"
87#    echo -en "\a"
88#    read UPLOAD
89#    [ "$UPLOAD" != "yes" ]; do
90#    :
91#done
92
93(
94    flock -x 200
95    files=
96    for change in $changes; do
97        if [ "$change" = "${dsc%.dsc}_source.changes" ]; then
98            dareprepro include "$suite$DEBATHENA_RELEASE" "$change"
99        else
100            dareprepro include "$suite$DEBATHENA_RELEASE" "$change"
101            files=$files\ $change\ $(perl -0ne '$_ =~ /\nFiles: *\n(( [^\n]*\n)*)/; print $1;' "$change" | awk '{print $5}' | grep -v '\.orig\.tar\.gz$' || :)
102        fi
103    done
104    ! [ -d "built/" ] || mv -i $files "built/"
105) 200> /tmp/debathena-repository-lock
106
107touch "$stamp.done"
108trap - EXIT
Note: See TracBrowser for help on using the repository browser.