Patchwork D3760: packaging: don't write files for templatized Dockerfiles

login
register
mail settings
Submitter phabricator
Date June 16, 2018, 6:19 p.m.
Message ID <differential-rev-PHID-DREV-4ikvkr4ihw3wt7pfiqlx-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/32201/
State Superseded
Headers show

Comments

phabricator - June 16, 2018, 6:19 p.m.
indygreg created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D3760

AFFECTED FILES
  .hgignore
  contrib/packaging/Makefile
  contrib/packaging/docker/debian.template
  contrib/packaging/docker/ubuntu.template
  contrib/packaging/dockerdeb

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/contrib/packaging/dockerdeb b/contrib/packaging/dockerdeb
--- a/contrib/packaging/dockerdeb
+++ b/contrib/packaging/dockerdeb
@@ -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
diff --git a/contrib/packaging/docker/ubuntu.template b/contrib/packaging/docker/ubuntu.template
--- a/contrib/packaging/docker/ubuntu.template
+++ b/contrib/packaging/docker/ubuntu.template
@@ -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
diff --git a/contrib/packaging/docker/debian.template b/contrib/packaging/docker/debian.template
--- a/contrib/packaging/docker/debian.template
+++ b/contrib/packaging/docker/debian.template
@@ -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
diff --git a/contrib/packaging/Makefile b/contrib/packaging/Makefile
--- a/contrib/packaging/Makefile
+++ b/contrib/packaging/Makefile
@@ -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
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -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