view contrib/dockerdeb @ 36991:d683c7367989

wireproto: explicitly flush stdio to prevent stalls on Windows This is the key to fixing the hangs on Windows in D2720[1]. I put flushes in a bunch of other places that didn't help, but I suspect that's more a lack of test coverage than anything else. Chasing down stuff like this is pretty painful. I'm wondering if we can put a proxy around sys.stderr (and sys.stdout?) on Windows (only when daemonized?) that will flush on every write (or at least every write with a '\n'). [1] https://www.mercurial-scm.org/pipermail/mercurial-devel/2018-March/113352.html
author Matt Harbison <matt_harbison@yahoo.com>
date Sat, 10 Mar 2018 23:58:01 -0500
parents 78074575df2e
children
line wrap: on
line source

#!/bin/bash -eu

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

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

checkdocker

DISTID="$1"
CODENAME="$2"
PLATFORM="$1-$2"
shift; shift # extra params are passed to build process

OUTPUTDIR=${OUTPUTDIR:=$ROOTDIR/packages/$PLATFORM}

initcontainer $PLATFORM

# debuild only appears to be able to save built debs etc to .., so we
# have to share the .. of the current directory with the docker
# container and hope it's writable. Whee.
dn=$(basename $PWD)

if [ $(uname) = "Darwin" ] ; then
    $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
            sh -c "cd /mnt/$dn && make clean && make local"
fi
$DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
  sh -c "cd /mnt/$dn && DEB_BUILD_OPTIONS='${DEB_BUILD_OPTIONS:=}' contrib/builddeb --build --distid $DISTID --codename $CODENAME $@"
contrib/builddeb --cleanup --distid $DISTID --codename $CODENAME
if [ $(uname) = "Darwin" ] ; then
    $DOCKER run -u $DBUILDUSER --rm -v $PWD/..:/mnt $CONTAINER \
            sh -c "cd /mnt/$dn && make clean"
fi