packaging: don't write files for templatized Dockerfiles
authorGregory Szorc <gregory.szorc@gmail.com>
Sat, 12 May 2018 14:41:48 -0700
changeset 38463 c8ef9d897e14
parent 38462 e5916f1236f3
child 38464 7f738edc4a27
packaging: don't write files for templatized Dockerfiles Now that Docker image building is implemented in Python and we can perform template substitution in memory, we don't need to write out produced Dockerfiles to disk. Differential Revision: https://phab.mercurial-scm.org/D3760
.hgignore
contrib/packaging/Makefile
contrib/packaging/docker/debian.template
contrib/packaging/docker/ubuntu.template
contrib/packaging/dockerdeb
--- a/.hgignore	Sat May 12 17:03:47 2018 -0700
+++ b/.hgignore	Sat May 12 14:41:48 2018 -0700
@@ -31,8 +31,6 @@
 contrib/chg/chg
 contrib/hgsh/hgsh
 contrib/vagrant/.vagrant
-contrib/packaging/docker/debian-*
-contrib/packaging/docker/ubuntu-*
 dist
 packages
 doc/common.txt
--- a/contrib/packaging/Makefile	Sat May 12 17:03:47 2018 -0700
+++ b/contrib/packaging/Makefile	Sat May 12 14:41:48 2018 -0700
@@ -47,50 +47,44 @@
 ppa:
 	./builddeb --source-only
 
-docker/debian-%: docker/debian.template
-	sed "s/__CODENAME__/$*/" $< > $@
-
 .PHONY: docker-debian-jessie
-docker-debian-jessie: docker/debian-jessie
+docker-debian-jessie:
 	./dockerdeb debian jessie
 
 .PHONY: docker-debian-stretch
-docker-debian-stretch: docker/debian-stretch
+docker-debian-stretch:
 	./dockerdeb debian stretch
 
-docker/ubuntu-%: docker/ubuntu.template
-	sed "s/__CODENAME__/$*/" $< > $@
-
 .PHONY: docker-ubuntu-trusty
-docker-ubuntu-trusty: docker/ubuntu-trusty
+docker-ubuntu-trusty:
 	./dockerdeb ubuntu trusty
 
 .PHONY: docker-ubuntu-trusty-ppa
-docker-ubuntu-trusty-ppa: docker/ubuntu-trusty
+docker-ubuntu-trusty-ppa:
 	./dockerdeb ubuntu trusty --source-only
 
 .PHONY: docker-ubuntu-xenial
-docker-ubuntu-xenial: docker/ubuntu-xenial
+docker-ubuntu-xenial:
 	./dockerdeb ubuntu xenial
 
 .PHONY: docker-ubuntu-xenial-ppa
-docker-ubuntu-xenial-ppa: docker/ubuntu-xenial
+docker-ubuntu-xenial-ppa:
 	./dockerdeb ubuntu xenial --source-only
 
 .PHONY: docker-ubuntu-artful
-docker-ubuntu-artful: docker/ubuntu-artful
+docker-ubuntu-artful:
 	./dockerdeb ubuntu artful
 
 .PHONY: docker-ubuntu-artful-ppa
-docker-ubuntu-artful-ppa: docker/ubuntu-artful
+docker-ubuntu-artful-ppa:
 	./dockerdeb ubuntu artful --source-only
 
 .PHONY: docker-ubuntu-bionic
-docker-ubuntu-bionic: docker/ubuntu-bionic
+docker-ubuntu-bionic:
 	./dockerdeb ubuntu bionic
 
 .PHONY: docker-ubuntu-bionic-ppa
-docker-ubuntu-bionic-ppa: docker/ubuntu-bionic
+docker-ubuntu-bionic-ppa:
 	./dockerdeb ubuntu bionic --source-only
 
 .PHONY: fedora20
--- a/contrib/packaging/docker/debian.template	Sat May 12 17:03:47 2018 -0700
+++ b/contrib/packaging/docker/debian.template	Sat May 12 14:41:48 2018 -0700
@@ -1,4 +1,4 @@
-FROM debian:__CODENAME__
+FROM debian:%CODENAME%
 
 RUN groupadd -g 1000 build && \
     useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
--- a/contrib/packaging/docker/ubuntu.template	Sat May 12 17:03:47 2018 -0700
+++ b/contrib/packaging/docker/ubuntu.template	Sat May 12 14:41:48 2018 -0700
@@ -1,4 +1,4 @@
-FROM ubuntu:__CODENAME__
+FROM ubuntu:%CODENAME%
 
 RUN groupadd -g 1000 build && \
     useradd -u 1000 -g 1000 -s /bin/bash -d /build -m build
--- a/contrib/packaging/dockerdeb	Sat May 12 17:03:47 2018 -0700
+++ b/contrib/packaging/dockerdeb	Sat May 12 14:41:48 2018 -0700
@@ -15,7 +15,10 @@
 
 DOCKER=$($BUILDDIR/hg-docker docker-path)
 
-$BUILDDIR/hg-docker build $BUILDDIR/docker/$PLATFORM $CONTAINER
+$BUILDDIR/hg-docker build \
+    --build-arg CODENAME=$CODENAME \
+    $BUILDDIR/docker/$DISTID.template \
+    $CONTAINER
 
 # 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