From patchwork Tue May 20 02:10:12 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [17, of, 22] docker: replace explicit docker-* Makefile rules with simpler rpm-% From: Mads Kiilerich X-Patchwork-Id: 4839 Message-Id: <87a2621530e1db8a9478.1400551812@mk-desktop> To: mercurial-devel@selenic.com Date: Tue, 20 May 2014 04:10:12 +0200 # HG changeset patch # User Mads Kiilerich # Date 1400551681 -7200 # Tue May 20 04:08:01 2014 +0200 # Node ID 87a2621530e1db8a9478d00829073dc84ffb72bd # Parent 9bb7bfeec498683597b167d0aa55422f1c36fc8a docker: replace explicit docker-* Makefile rules with simpler rpm-% Docker is just an implementation detail - what really matters is that it creates rpms for a platform. diff --git a/Makefile b/Makefile --- a/Makefile +++ b/Makefile @@ -140,14 +140,10 @@ rpm: rpm-py: contrib/buildrpm --rpmbuilddir $(PWD)/build/rpm --withpython --suffix -py -docker-fedora: - mkdir -p build/fedora - contrib/dockerrpm fedora - -docker-centos6: - mkdir -p build/centos6 - contrib/dockerrpm centos6 +# Valid rpm-$NAME targets have a corresponding contrib/docker/$NAME +rpm-%: + contrib/dockerrpm $@ .PHONY: help all local build doc clean install install-bin install-doc \ install-home install-home-bin install-home-doc dist dist-notests tests \ - update-pot rpm rpm-py docker-fedora + update-pot rpm rpm-py diff --git a/contrib/dockerrpm b/contrib/dockerrpm --- a/contrib/dockerrpm +++ b/contrib/dockerrpm @@ -15,11 +15,13 @@ fi $DOCKER version | grep -q "^Server version:" || { echo "Error: docker server not found - check it is running and your permissions"; exit 1; } [ "$1" ] || { echo "Error: platform name must be specified"; exit 1; } +NAME="$1" +NAME="${NAME#rpm-}" -DFILE="$ROOTDIR/contrib/docker/$1" +DFILE="$ROOTDIR/contrib/docker/$NAME" [ -f "$DFILE" ] || { echo "Error: docker file $DFILE not found"; exit 1; } -CONTAINER="hg-rpm-$1" +CONTAINER="hg-rpm-$NAME" DBUILDUSER=build ( @@ -28,7 +30,7 @@ echo RUN groupadd $DBUILDUSER -g `id -g` echo RUN useradd $DBUILDUSER -u `id -u` -g $DBUILDUSER ) | $DOCKER build --tag $CONTAINER - -RPMBUILD=$ROOTDIR/build/$1 +RPMBUILD=$ROOTDIR/build/$NAME contrib/buildrpm --rpmbuilddir $RPMBUILD --prepare DSHARED=/mnt/shared