Skip to contentSkip to conversation

docker: add docker-app support

PATCH In review [email protected] 2 participants 2 messages Aug 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker: add docker-app support

From: Ming Liu <[email protected]>

A docker-cpp binary would be generated after this change.

---
 recipes-containers/docker/docker_git.bb            |  9 +++++++
 .../0001-Makefile-do-not-override-LDFLAGS.patch    | 31 ++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 recipes-containers/docker/files/0001-Makefile-do-not-override-LDFLAGS.patch
recipes-containers/docker/docker_git.bb +9 -0
index e45f87e..bf9cdc7 100644
@@ -38,13 +38,16 @@ DESCRIPTION = "Linux container runtime \
 SRCREV_moby = "344b093258fcb2195fa393081e5224a6c766c798"
 SRCREV_libnetwork = "5ac07abef4eee176423fdc1b870d435258e2d381"
 SRCREV_cli = "2f1931f9eb2d6bac2efd48d94739f2e9919d4d7d"
+SRCREV_app = "ad4481ea1a063659f15cac38048883b54f0820e2"
 SRC_URI = "\
 	git://github.com/moby/moby.git;nobranch=1;name=moby \
 	git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \
 	git://github.com/docker/cli;branch=19.03;name=cli;destsuffix=git/cli \
+	git://github.com/docker/app;branch=master;name=app;destsuffix=git/app \
 	file://docker.init \
 	file://0001-libnetwork-use-GO-instead-of-go.patch \
 	file://0001-imporve-hardcoded-CC-on-cross-compile.patch \
+	file://0001-Makefile-do-not-override-LDFLAGS.patch \
 	"
 
 require docker.inc
@@ -83,6 +86,7 @@ do_compile() {
 	mkdir -p .gopath/src/github.com/docker
 	ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
 	ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
+	ln -sf ${WORKDIR}/git/app .gopath/src/github.com/docker/app
 
 	export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
 	export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
@@ -111,6 +115,10 @@ do_compile() {
 	export DOCKER_VERSION=${DOCKER_VERSION}
 	VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
 
+	# build the app
+	cd ${S}/src/import/.gopath/src/github.com/docker/app
+	make dynamic
+
 	# build the proxy
 	cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
 	oe_runmake cross-local
@@ -119,6 +127,7 @@ do_compile() {
 do_install() {
 	mkdir -p ${D}/${bindir}
 	cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
+	cp ${WORKDIR}/git/app/bin/docker-app ${D}/${bindir}/docker-app
 	cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
 	cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
 
recipes-containers/docker/files/0001-Makefile-do-not-override-LDFLAGS.patch new file +31 -0
new file mode 100644
index 0000000..c987a51
@@ -0,0 +1,31 @@
+From 494b5f6982a35e285d3ef15e67d2fe27873909e4 Mon Sep 17 00:00:00 2001
+From: Ming Liu <[email protected]>
+Date: Sun, 18 Aug 2019 11:52:14 +0800
+Subject: [PATCH] Makefile: do not override LDFLAGS
+
+Replace a ":=" by "+=" when setting LDFLAGS, this ensures it would not
+override the linking flags from OE environment.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Ming Liu <[email protected]>
+---
+ app/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/app/Makefile b/app/Makefile
+index 77f18b4..d311726 100644
+--- a/app/Makefile
++++ b/app/Makefile
+@@ -13,7 +13,7 @@ ifeq ($(EXPERIMENTAL),on)
+   BUILDTAGS="experimental"
+ endif
+ 
+-LDFLAGS := "-s -w \
++LDFLAGS := " \
+   -X $(PKG_NAME)/internal.GitCommit=$(COMMIT) \
+   -X $(PKG_NAME)/internal.Version=$(TAG)      \
+   -X $(PKG_NAME)/internal.Experimental=$(EXPERIMENTAL) \
+-- 
+2.7.4
+
Signature · 1 line
2.7.4
#1 lore raw
Quoted 4 lines · On Tue, Aug 20, 2019 at 4:56 AM <[email protected]> wrote:

From: Ming Liu <[email protected]>

A docker-cpp binary would be generated after this change.

Looks like auto-correct changed "docker-app" to "docker-cpp".

Also, can you include some of the information from docker-app in the long log, that way we have a recorded description of what it is.

I'm also trying to make sure these components are testable, can you put of your testing, can you include it in the long log as well ? Eventually we need unit tests for everything, but having a log of the tests is a minimum starting point.

Quoted 13 lines
---
 recipes-containers/docker/docker_git.bb            |  9 +++++++
 .../0001-Makefile-do-not-override-LDFLAGS.patch    | 31 ++++++++++++++++++++++
 2 files changed, 40 insertions(+)
 create mode 100644 recipes-containers/docker/files/0001-Makefile-do-not-override-LDFLAGS.patch
recipes-containers/docker/docker_git.bb +0 -0
index e45f87e..bf9cdc7 100644

recipes-containers/docker/docker_git.bb DESCRIPTION = "Linux container runtime \ · line 46

Quoted 9 lines
recipes-containers/docker/docker_git.bb +2 -0
@@ -38,13 +38,16 @@ DESCRIPTION = "Linux container runtime \
 SRCREV_moby = "344b093258fcb2195fa393081e5224a6c766c798"
 SRCREV_libnetwork = "5ac07abef4eee176423fdc1b870d435258e2d381"
 SRCREV_cli = "2f1931f9eb2d6bac2efd48d94739f2e9919d4d7d"
+SRCREV_app = "ad4481ea1a063659f15cac38048883b54f0820e2"
 SRC_URI = "\
        git://github.com/moby/moby.git;nobranch=1;name=moby \
        git://github.com/docker/libnetwork.git;branch=master;name=libnetwork;destsuffix=git/libnetwork \
        git://github.com/docker/cli;branch=19.03;name=cli;destsuffix=git/cli \
+       git://github.com/docker/app;branch=master;name=app;destsuffix=git/app \

I'm trying to decide if we want this to also be part of the docker-ce build.

While it is true that it isn't part of docker-ce, I'm trying to keep the build outputs of the two very similar. I'd also rather not break this up into a separate recipe at the moment, since having all of the components build out of a single recipe was a design choice, and I'd like to keep that intact.

I'm thinking we can hit a middle ground on this. Leave the build as you have it, but package the resulting binary in a separate package out of this single recipe. That way we can avoid adding it to docker-ce for now, and it can be an optional install.

I have another round of updates to the recipes almost ready to go, but I can easily stack this on top of the work that I'm doing.

Quoted 16 lines
recipes-containers/docker/docker_git.bb +2 -0
        file://docker.init \
        file://0001-libnetwork-use-GO-instead-of-go.patch \
        file://0001-imporve-hardcoded-CC-on-cross-compile.patch \
+       file://0001-Makefile-do-not-override-LDFLAGS.patch \
        "
 
 require docker.inc
@@ -83,6 +86,7 @@ do_compile() {
        mkdir -p .gopath/src/github.com/docker
        ln -sf ${WORKDIR}/git/libnetwork .gopath/src/github.com/docker/libnetwork
        ln -sf ${WORKDIR}/git/cli .gopath/src/github.com/docker/cli
+       ln -sf ${WORKDIR}/git/app .gopath/src/github.com/docker/app
 
        export GOPATH="${S}/src/import/.gopath:${S}/src/import/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
        export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"

recipes-containers/docker/docker_git.bb do_compile() { · line 120

Quoted 6 lines
recipes-containers/docker/docker_git.bb +3 -0
@@ -111,6 +115,10 @@ do_compile() {
        export DOCKER_VERSION=${DOCKER_VERSION}
        VERSION="${DOCKER_VERSION}" DOCKER_GITCOMMIT="${SRCREV_docker}" make dynbinary
 
+       # build the app
+       cd ${S}/src/import/.gopath/src/github.com/docker/app
+       make dynamic

I noticed another raw "make" call in one of the other recipes while doing another round of uprevs (which I'll submit shortly), but this should be oe_runmake to match other calls.

Bruce

Quoted 57 lines
recipes-containers/docker/docker_git.bb +2 -0
+
        # build the proxy
        cd ${S}/src/import/.gopath/src/github.com/docker/libnetwork
        oe_runmake cross-local
@@ -119,6 +127,7 @@ do_compile() {
 do_install() {
        mkdir -p ${D}/${bindir}
        cp ${WORKDIR}/git/cli/build/docker ${D}/${bindir}/docker
+       cp ${WORKDIR}/git/app/bin/docker-app ${D}/${bindir}/docker-app
        cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
        cp ${WORKDIR}/git/libnetwork/bin/docker-proxy* ${D}/${bindir}/docker-proxy
 
recipes-containers/docker/files/0001-Makefile-do-not-override-LDFLAGS.patch new file +31 -1
new file mode 100644
index 0000000..c987a51
@@ -0,0 +1,31 @@
+From 494b5f6982a35e285d3ef15e67d2fe27873909e4 Mon Sep 17 00:00:00 2001
+From: Ming Liu <[email protected]>
+Date: Sun, 18 Aug 2019 11:52:14 +0800
+Subject: [PATCH] Makefile: do not override LDFLAGS
+
+Replace a ":=" by "+=" when setting LDFLAGS, this ensures it would not
+override the linking flags from OE environment.
+
+Upstream-Status: Inappropriate [oe-core specific]
+
+Signed-off-by: Ming Liu <[email protected]>
+---
+ app/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/app/Makefile b/app/Makefile
+index 77f18b4..d311726 100644
+--- a/app/Makefile
++++ b/app/Makefile
+@@ -13,7 +13,7 @@ ifeq ($(EXPERIMENTAL),on)
+   BUILDTAGS="experimental"
+ endif
+
+-LDFLAGS := "-s -w \
++LDFLAGS := " \
+   -X $(PKG_NAME)/internal.GitCommit=$(COMMIT) \
+   -X $(PKG_NAME)/internal.Version=$(TAG)      \
+   -X $(PKG_NAME)/internal.Experimental=$(EXPERIMENTAL) \
+--
+2.7.4
+
--

2.7.4

--
_______________________________________________
meta-virtualization mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/meta-virtualization

Signature · 3 lines
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II