4 read oldrev newrev head
5 if [ $head != 'refs/heads/dev' ]; then
6 echo "error: head not recognized: $head" >&2
10 echo "error: one update at a time, please" >&2
14 tmpdir=$(mktemp -d /tmp/xvm-git-XXXXXX)
15 echo "build directory $tmpdir"
18 sbuild () { echo " SBUILD" "$@"; }
24 package=${packagepath#packages/}
25 url=$(git config -f $tmpdir/git/.gitmodules submodule.$packagepath.url)
26 echo "building $package at new version $rev"
28 srcdir=$tmpdir/$package
30 # XXX remove that .git -- be sure to include it in `git submodule add`
31 git --git-dir=$url.git archive $rev | tar -xf - -C $srcdir
32 pushd $srcdir >/dev/null
34 eval $(perl -ne 'print if s/^(Version|Source|Distribution): /\1=/' \
35 <(dpkg-parsechangelog))
36 dpkg-buildpackage -us -uc -rfakeroot -S
39 eval $(perl -ne 'print if s/^(Architecture): /\1=/' ${Source}_${Version}.dsc)
42 sbuild -d $distribution --arch-all ${Source}_${Version}.dsc;;
44 sbuild -d $distribution --arch amd64 --arch-all ${Source}_${Version}.dsc
45 sbuild -d $distribution --arch i386 ${Source}_${Version}.dsc;;
47 echo "build-pre-receive: arch '$Architecture' unimplemented" >&2
51 echo "XXX tag submodule as $Version"
53 [ $Distribution = 'unstable' ] \
54 || echo "$(basename $0): warning: Distribution is $Distribution, script expects unstable"
56 echo "built $package version $Version from commit $rev"
60 git clone . $tmpdir/git
62 git ls-tree $newrev packages/ \
63 | grep ^160000\ commit \
64 | while read x y newsubrev packagepath; do
65 # XXX deal with new packages
66 # XX deal with removed packages
67 oldsubrev=$(git ls-tree $oldrev $packagepath | perl -lane 'print $F[2]')
68 if [ $newsubrev == $oldsubrev ]; then
72 build_package $packagepath $newsubrev
79 changesfile=`pwd`/${Source}_*${Version}*.changes
80 for i in $changesfile; do
81 reprepro-env include unstable $i
82 reprepro-env copy stable unstable $(sed -ne 's/^Binary: //p' $i)
84 reprepro-env copy stable unstable $Source
87 rm -rf build-release/$package