packaging: move some docker scripts into contrib/packaging/
This required some minor path adjustments in the scripts.
Differential Revision: https://phab.mercurial-scm.org/D3542
--- a/Makefile Sat May 12 13:17:01 2018 -0700
+++ b/Makefile Sat May 12 10:33:11 2018 -0700
@@ -213,37 +213,37 @@
sed "s/__CODENAME__/$*/" $< > $@
docker-debian-jessie: contrib/packaging/docker/debian-jessie
- contrib/dockerdeb debian jessie
+ contrib/packaging/dockerdeb debian jessie
docker-debian-stretch: contrib/packaging/docker/debian-stretch
- contrib/dockerdeb debian stretch
+ contrib/packaging/dockerdeb debian stretch
contrib/packaging/docker/ubuntu-%: contrib/packaging/docker/ubuntu.template
sed "s/__CODENAME__/$*/" $< > $@
docker-ubuntu-trusty: contrib/packaging/docker/ubuntu-trusty
- contrib/dockerdeb ubuntu trusty
+ contrib/packaging/dockerdeb ubuntu trusty
docker-ubuntu-trusty-ppa: contrib/packaging/docker/ubuntu-trusty
- contrib/dockerdeb ubuntu trusty --source-only
+ contrib/packaging/dockerdeb ubuntu trusty --source-only
docker-ubuntu-xenial: contrib/packaging/docker/ubuntu-xenial
- contrib/dockerdeb ubuntu xenial
+ contrib/packaging/dockerdeb ubuntu xenial
docker-ubuntu-xenial-ppa: contrib/packaging/docker/ubuntu-xenial
- contrib/dockerdeb ubuntu xenial --source-only
+ contrib/packaging/dockerdeb ubuntu xenial --source-only
docker-ubuntu-artful: contrib/packaging/docker/ubuntu-artful
- contrib/dockerdeb ubuntu artful
+ contrib/packaging/dockerdeb ubuntu artful
docker-ubuntu-artful-ppa: contrib/packaging/docker/ubuntu-artful
- contrib/dockerdeb ubuntu artful --source-only
+ contrib/packaging/dockerdeb ubuntu artful --source-only
docker-ubuntu-bionic: contrib/packaging/docker/ubuntu-bionic
- contrib/dockerdeb ubuntu bionic
+ contrib/packaging/dockerdeb ubuntu bionic
docker-ubuntu-bionic-ppa: contrib/packaging/docker/ubuntu-bionic
- contrib/dockerdeb ubuntu bionic --source-only
+ contrib/packaging/dockerdeb ubuntu bionic --source-only
fedora20:
mkdir -p packages/fedora20
@@ -254,7 +254,7 @@
docker-fedora20:
mkdir -p packages/fedora20
- contrib/dockerrpm fedora20
+ contrib/packaging/dockerrpm fedora20
fedora21:
mkdir -p packages/fedora21
@@ -265,7 +265,7 @@
docker-fedora21:
mkdir -p packages/fedora21
- contrib/dockerrpm fedora21
+ contrib/packaging/dockerrpm fedora21
centos5:
mkdir -p packages/centos5
@@ -275,7 +275,7 @@
docker-centos5:
mkdir -p packages/centos5
- contrib/dockerrpm centos5 --withpython
+ contrib/packaging/dockerrpm centos5 --withpython
centos6:
mkdir -p packages/centos6
@@ -285,7 +285,7 @@
docker-centos6:
mkdir -p packages/centos6
- contrib/dockerrpm centos6 --withpython
+ contrib/packaging/dockerrpm centos6 --withpython
centos7:
mkdir -p packages/centos7
@@ -295,7 +295,7 @@
docker-centos7:
mkdir -p packages/centos7
- contrib/dockerrpm centos7
+ contrib/packaging/dockerrpm centos7
linux-wheels: linux-wheels-x86_64 linux-wheels-i686
--- a/contrib/dockerdeb Sat May 12 13:17:01 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#!/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
--- a/contrib/dockerlib.sh Sat May 12 13:17:01 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,42 +0,0 @@
-#!/bin/sh -eu
-
-# This function exists to set up the DOCKER variable and verify that
-# it's the binary we expect. It also verifies that the docker service
-# is running on the system and we can talk to it.
-function checkdocker() {
- if which docker.io >> /dev/null 2>&1 ; then
- DOCKER=docker.io
- elif which docker >> /dev/null 2>&1 ; then
- DOCKER=docker
- else
- echo "Error: docker must be installed"
- exit 1
- fi
-
- $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; }
- $DOCKER version | grep -Eq "^Client( version)?:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
- $DOCKER version | grep -Eq "^Server( version)?:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
-}
-
-# Construct a container and leave its name in $CONTAINER for future use.
-function initcontainer() {
- [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; }
-
- DFILE="$ROOTDIR/contrib/packaging/docker/$1"
- [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
-
- CONTAINER="hg-dockerrpm-$1"
- DBUILDUSER=build
- (
- cat $DFILE
- if [ $(uname) = "Darwin" ] ; then
- # The builder is using boot2docker on OS X, so we're going to
- # *guess* the uid of the user inside the VM that is actually
- # running docker. This is *very likely* to fail at some point.
- echo RUN useradd $DBUILDUSER -u 1000
- else
- echo RUN groupadd $DBUILDUSER -g `id -g` -o
- echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER -o
- fi
- ) | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER -
-}
--- a/contrib/dockerrpm Sat May 12 13:17:01 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-#!/bin/bash -e
-
-. $(dirname $0)/dockerlib.sh
-
-BUILDDIR=$(dirname $0)
-export ROOTDIR=$(cd $BUILDDIR/..; pwd)
-
-checkdocker
-
-PLATFORM="$1"
-shift # extra params are passed to buildrpm
-
-initcontainer $PLATFORM
-
-RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
-contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
-
-DSHARED=/mnt/shared
-$DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
- rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean
-
-$DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
- createrepo $DSHARED
-
-cat << EOF > $RPMBUILDDIR/mercurial.repo
-# Place this file in /etc/yum.repos.d/mercurial.repo
-[mercurial]
-name=Mercurial packages for $PLATFORM
-# baseurl=file://$RPMBUILDDIR/
-baseurl=http://hg.example.com/build/$PLATFORM/
-skip_if_unavailable=True
-gpgcheck=0
-enabled=1
-EOF
-
-echo
-echo "Build complete - results can be found in $RPMBUILDDIR"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/dockerdeb Sat May 12 10:33:11 2018 -0700
@@ -0,0 +1,35 @@
+#!/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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/dockerlib.sh Sat May 12 10:33:11 2018 -0700
@@ -0,0 +1,42 @@
+#!/bin/sh -eu
+
+# This function exists to set up the DOCKER variable and verify that
+# it's the binary we expect. It also verifies that the docker service
+# is running on the system and we can talk to it.
+function checkdocker() {
+ if which docker.io >> /dev/null 2>&1 ; then
+ DOCKER=docker.io
+ elif which docker >> /dev/null 2>&1 ; then
+ DOCKER=docker
+ else
+ echo "Error: docker must be installed"
+ exit 1
+ fi
+
+ $DOCKER -h 2> /dev/null | grep -q Jansens && { echo "Error: $DOCKER is the Docking System Tray - install docker.io instead"; exit 1; }
+ $DOCKER version | grep -Eq "^Client( version)?:" || { echo "Error: unexpected output from \"$DOCKER version\""; exit 1; }
+ $DOCKER version | grep -Eq "^Server( version)?:" || { echo "Error: could not get docker server version - check it is running and your permissions"; exit 1; }
+}
+
+# Construct a container and leave its name in $CONTAINER for future use.
+function initcontainer() {
+ [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; }
+
+ DFILE="$ROOTDIR/contrib/packaging/docker/$1"
+ [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; }
+
+ CONTAINER="hg-dockerrpm-$1"
+ DBUILDUSER=build
+ (
+ cat $DFILE
+ if [ $(uname) = "Darwin" ] ; then
+ # The builder is using boot2docker on OS X, so we're going to
+ # *guess* the uid of the user inside the VM that is actually
+ # running docker. This is *very likely* to fail at some point.
+ echo RUN useradd $DBUILDUSER -u 1000
+ else
+ echo RUN groupadd $DBUILDUSER -g `id -g` -o
+ echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER -o
+ fi
+ ) | $DOCKER build --build-arg http_proxy --build-arg https_proxy --tag $CONTAINER -
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/contrib/packaging/dockerrpm Sat May 12 10:33:11 2018 -0700
@@ -0,0 +1,37 @@
+#!/bin/bash -e
+
+. $(dirname $0)/dockerlib.sh
+
+BUILDDIR=$(dirname $0)
+export ROOTDIR=$(cd $BUILDDIR/../..; pwd)
+
+checkdocker
+
+PLATFORM="$1"
+shift # extra params are passed to buildrpm
+
+initcontainer $PLATFORM
+
+RPMBUILDDIR=$ROOTDIR/packages/$PLATFORM
+contrib/buildrpm --rpmbuilddir $RPMBUILDDIR --prepare $*
+
+DSHARED=/mnt/shared
+$DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
+ rpmbuild --define "_topdir $DSHARED" -ba $DSHARED/SPECS/mercurial.spec --clean
+
+$DOCKER run -e http_proxy -e https_proxy -u $DBUILDUSER --rm -v $RPMBUILDDIR:$DSHARED $CONTAINER \
+ createrepo $DSHARED
+
+cat << EOF > $RPMBUILDDIR/mercurial.repo
+# Place this file in /etc/yum.repos.d/mercurial.repo
+[mercurial]
+name=Mercurial packages for $PLATFORM
+# baseurl=file://$RPMBUILDDIR/
+baseurl=http://hg.example.com/build/$PLATFORM/
+skip_if_unavailable=True
+gpgcheck=0
+enabled=1
+EOF
+
+echo
+echo "Build complete - results can be found in $RPMBUILDDIR"