dockerdeb: rules to build a debian package using docker
Currently only supports jessie (current stable), but other version
should be trivial.
--- a/Makefile Thu May 07 10:28:58 2015 -0400
+++ b/Makefile Wed May 06 13:15:39 2015 -0400
@@ -163,6 +163,10 @@
mv debbuild/*.deb packages/debian-jessie
rm -rf debbuild
+docker-debian-jessie:
+ mkdir -p packages/debian/jessie
+ contrib/dockerdeb jessie
+
fedora20:
mkdir -p packages/fedora20
contrib/buildrpm
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/docker/debian-jessie Wed May 06 13:15:39 2015 -0400
@@ -0,0 +1,11 @@
+FROM debian:jessie
+RUN apt-get update && apt-get install -y \
+ build-essential \
+ debhelper \
+ dh-python \
+ devscripts \
+ python \
+ python-all-dev \
+ python-docutils \
+ zip \
+ unzip
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/dockerdeb Wed May 06 13:15:39 2015 -0400
@@ -0,0 +1,39 @@
+#!/bin/bash -eu
+
+. $(dirname $0)/dockerlib.sh
+. $(dirname $0)/packagelib.sh
+
+BUILDDIR=$(dirname $0)
+export ROOTDIR=$(cd $BUILDDIR/..; pwd)
+
+checkdocker
+
+PLATFORM="debian-$1"
+shift # extra params are passed to build process
+
+initcontainer $PLATFORM
+
+DEBBUILDDIR=$ROOTDIR/packages/$PLATFORM
+contrib/builddeb --debbuilddir $DEBBUILDDIR/staged --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"