Patchwork [1,of,6,STABLE,V2] make: turn ubuntu docker into template

login
register
mail settings
Submitter Sean Farley
Date April 27, 2016, 6:12 p.m.
Message ID <f2e879f9f08606a580df.1461780724@laptop.office.atlassian.com>
Download mbox | patch
Permalink /patch/14808/
State Superseded
Commit e63dfbbdbd078a6c822e1903c298783d261eee82
Headers show

Comments

Sean Farley - April 27, 2016, 6:12 p.m.
# HG changeset patch
# User Sean Farley <sean@farley.io>
# Date 1461738797 25200
#      Tue Apr 26 23:33:17 2016 -0700
# Branch stable
# Node ID f2e879f9f08606a580dfb55e9ac1c6d8d9caf649
# Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
# EXP-Topic docker-ppa
make: turn ubuntu docker into template

This allows us to easily add more ubuntu docker targets (which following
patches will do).

Also, we no longer need the mkdir command.
Yuya Nishihara - April 29, 2016, 9:39 a.m.
On Wed, 27 Apr 2016 11:12:04 -0700, Sean Farley wrote:
> # HG changeset patch
> # User Sean Farley <sean@farley.io>
> # Date 1461738797 25200
> #      Tue Apr 26 23:33:17 2016 -0700
> # Branch stable
> # Node ID f2e879f9f08606a580dfb55e9ac1c6d8d9caf649
> # Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
> # EXP-Topic docker-ppa
> make: turn ubuntu docker into template

The series looks okay to me. I expect Augie will decide on taking this or not.

> -docker-ubuntu-trusty:
> -	mkdir -p packages/ubuntu-trusty
> -	contrib/dockerdeb ubuntu trusty
> +docker-ubuntu-gen:
> +	sed "s/__CODENAME__/$(CODENAME)/" contrib/docker/ubuntu-template > contrib/docker/ubuntu-$(CODENAME)
> +
> +docker-ubuntu-trusty: CODENAME=trusty
> +docker-ubuntu-trusty: docker-ubuntu-gen
> +	contrib/dockerdeb ubuntu $(CODENAME)

The make way would be to depend on real files, but I don't care much about it
since our Makefile is full of phony rules.

contrib/docker/ubuntu-%: contrib/docker/ubuntu.template
	sed "s/__CODENAME__/$*/" $< > $@

docker-ubuntu-trusty: contrib/docker/ubuntu-trusty
	contrib/dockerdeb ubuntu trusty
Sean Farley - April 29, 2016, 5:20 p.m.
Yuya Nishihara <yuya@tcha.org> writes:

> On Wed, 27 Apr 2016 11:12:04 -0700, Sean Farley wrote:
>> # HG changeset patch
>> # User Sean Farley <sean@farley.io>
>> # Date 1461738797 25200
>> #      Tue Apr 26 23:33:17 2016 -0700
>> # Branch stable
>> # Node ID f2e879f9f08606a580dfb55e9ac1c6d8d9caf649
>> # Parent  87d4a6c5567e81386b8c2209d95060d5bf72e064
>> # EXP-Topic docker-ppa
>> make: turn ubuntu docker into template
>
> The series looks okay to me. I expect Augie will decide on taking this or not.
>
>> -docker-ubuntu-trusty:
>> -	mkdir -p packages/ubuntu-trusty
>> -	contrib/dockerdeb ubuntu trusty
>> +docker-ubuntu-gen:
>> +	sed "s/__CODENAME__/$(CODENAME)/" contrib/docker/ubuntu-template > contrib/docker/ubuntu-$(CODENAME)
>> +
>> +docker-ubuntu-trusty: CODENAME=trusty
>> +docker-ubuntu-trusty: docker-ubuntu-gen
>> +	contrib/dockerdeb ubuntu $(CODENAME)
>
> The make way would be to depend on real files, but I don't care much about it
> since our Makefile is full of phony rules.
>
> contrib/docker/ubuntu-%: contrib/docker/ubuntu.template
> 	sed "s/__CODENAME__/$*/" $< > $@
>
> docker-ubuntu-trusty: contrib/docker/ubuntu-trusty
> 	contrib/dockerdeb ubuntu trusty

Ah, that looks a little better. I'll test it out.
Augie Fackler - April 29, 2016, 5:21 p.m.
> On Apr 29, 2016, at 13:20, Sean Farley <sean@farley.io> wrote:
> 
>> The make way would be to depend on real files, but I don't care much about it
>> since our Makefile is full of phony rules.
>> 
>> contrib/docker/ubuntu-%: contrib/docker/ubuntu.template
>> 	sed "s/__CODENAME__/$*/" $< > $@
>> 
>> docker-ubuntu-trusty: contrib/docker/ubuntu-trusty
>> 	contrib/dockerdeb ubuntu trusty
> 
> Ah, that looks a little better. I'll test it out.

Excellent. I was going to suggest this change anyway. :)

Patch

diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -28,10 +28,11 @@  tests/*.err
 tests/htmlcov
 build
 contrib/chg/chg
 contrib/hgsh/hgsh
 contrib/vagrant/.vagrant
+contrib/docker/ubuntu-*
 dist
 packages
 doc/common.txt
 doc/*.[0-9]
 doc/*.[0-9].txt
diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -173,13 +173,16 @@  ppa:
 
 docker-debian-jessie:
 	mkdir -p packages/debian-jessie
 	contrib/dockerdeb debian jessie
 
-docker-ubuntu-trusty:
-	mkdir -p packages/ubuntu-trusty
-	contrib/dockerdeb ubuntu trusty
+docker-ubuntu-gen:
+	sed "s/__CODENAME__/$(CODENAME)/" contrib/docker/ubuntu-template > contrib/docker/ubuntu-$(CODENAME)
+
+docker-ubuntu-trusty: CODENAME=trusty
+docker-ubuntu-trusty: docker-ubuntu-gen
+	contrib/dockerdeb ubuntu $(CODENAME)
 
 fedora20:
 	mkdir -p packages/fedora20
 	contrib/buildrpm
 	cp rpmbuild/RPMS/*/* packages/fedora20
diff --git a/contrib/docker/ubuntu-template b/contrib/docker/ubuntu-template
new file mode 100644
--- /dev/null
+++ b/contrib/docker/ubuntu-template
@@ -0,0 +1,11 @@ 
+FROM ubuntu:__CODENAME__
+RUN apt-get update && apt-get install -y \
+  build-essential \
+  debhelper \
+  dh-python \
+  devscripts \
+  python \
+  python-all-dev \
+  python-docutils \
+  zip \
+  unzip
diff --git a/contrib/docker/ubuntu-trusty b/contrib/docker/ubuntu-trusty
deleted file mode 100644
--- a/contrib/docker/ubuntu-trusty
+++ /dev/null
@@ -1,11 +0,0 @@ 
-FROM ubuntu:trusty
-RUN apt-get update && apt-get install -y \
-  build-essential \
-  debhelper \
-  dh-python \
-  devscripts \
-  python \
-  python-all-dev \
-  python-docutils \
-  zip \
-  unzip