view contrib/dockerdeb @ 26108:05306b9359d3

builddeb: rework how output dir and platform are specified This makes it possible to write tests for both builddeb and dockerdeb that actually build .debs and then sanity check the contents.
author Augie Fackler <augie@google.com>
date Tue, 25 Aug 2015 00:02:44 -0400
parents 4c4d0012db4f
children 7f49efcaa9b4
line wrap: on
line source

#!/bin/bash -eu

. $(dirname $0)/dockerlib.sh
. $(dirname $0)/packagelib.sh

BUILDDIR=$(dirname $0)
export ROOTDIR=$(cd $BUILDDIR/..; pwd)

checkdocker

DEBPLATFORM="$1"
PLATFORM="debian-$1"
shift # extra params are passed to build process

initcontainer $PLATFORM

DEBBUILDDIR=${OUTPUTDIR:=$ROOTDIR/packages/$PLATFORM}
OUTPUTDIR=$DEBBUILDDIR/staged contrib/builddeb --release $DEBPLATFORM --prepare

DSHARED=/mnt/shared/
if [ $(uname) = "Darwin" ] ; then
    $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
            sh -c "cd /mnt/hg && make clean && make local"
fi
$DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
  sh -c "cd /mnt/hg && make PREFIX=$DSHARED/staged/usr install"
$DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED $CONTAINER \
  dpkg-deb --build $DSHARED/staged
if [ $(uname) = "Darwin" ] ; then
    $DOCKER run -u $DBUILDUSER --rm -v $DEBBUILDDIR:$DSHARED -v $PWD:/mnt/hg $CONTAINER \
            sh -c "cd /mnt/hg && make clean"
fi

gethgversion

rm -r $DEBBUILDDIR/staged
mv $DEBBUILDDIR/staged.deb $DEBBUILDDIR/mercurial-$version-$release.deb

echo
echo "Build complete - results can be found in $DEBBUILDDIR"