Patchwork [17,of,22] docker: replace explicit docker-* Makefile rules with simpler rpm-%

login
register
mail settings
Submitter Mads Kiilerich
Date May 20, 2014, 2:10 a.m.
Message ID <87a2621530e1db8a9478.1400551812@mk-desktop>
Download mbox | patch
Permalink /patch/4839/
State Changes Requested
Headers show

Comments

Mads Kiilerich - May 20, 2014, 2:10 a.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# 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.

Patch

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