Skip to contentSkip to conversation

docker-engine: fix docker version output

PATCH New Christian Stewart 2 participants 2 messages Dec 24, 2016 – Dec 25, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 docker-engine: fix docker version output

At compile-time the docker build scripts generate a version file used to build the output of the docker version command. This file is generated somewhat properly by the Buildroot build system, however the version number and commit ID are incorrectly formatted. This patch fixes the output to the correct format.

This is important as some tools like WeaveWorks won't even start unless they can parse the Docker Version output correctly.

---
 package/docker-engine/docker-engine.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/docker-engine/docker-engine.mk +4 -1
index ade6fbb..d60ae37 100644
@@ -5,6 +5,7 @@
 ################################################################################
 
 DOCKER_ENGINE_VERSION = v1.12.5
+DOCKER_ENGINE_COMMIT = 7392c3b0ce0f9d3e918a321c66668c5d1ef4f689
 DOCKER_ENGINE_SITE = $(call github,docker,docker,$(DOCKER_ENGINE_VERSION))
 
 DOCKER_ENGINE_LICENSE = Apache-2.0
@@ -67,7 +68,9 @@ endif
 define DOCKER_ENGINE_CONFIGURE_CMDS
 	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
 	cd $(@D) && \
-		GITCOMMIT="unknown" BUILDTIME="$$(date)" VERSION="$(DOCKER_ENGINE_VERSION)" \
+		GITCOMMIT="$$(echo $(DOCKER_ENGINE_COMMIT) | head -c7)" \
+		BUILDTIME="$$(date)" \
+		VERSION="$$(echo $(DOCKER_ENGINE_VERSION) | tail -c +2)" \
 		PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" $(TARGET_MAKE_ENV) \
 		bash ./hack/make/.go-autogen
 endef
Signature · 1 line
2.10.2
#1 lore raw

PATCH 1/1 docker-engine: fix docker version output

Quoted 29 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Christian" == Christian Stewart <[email protected]> writes:

At compile-time the docker build scripts generate a version file used to build the output of the docker version command. This file is generated somewhat properly by the Buildroot build system, however the version number and commit ID are incorrectly formatted. This patch fixes the output to the correct format.

This is important as some tools like WeaveWorks won't even start unless they can parse the Docker Version output correctly.

---
 package/docker-engine/docker-engine.mk | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
package/docker-engine/docker-engine.mk +1 -0
index ade6fbb..d60ae37 100644
@@ -5,6 +5,7 @@
 ################################################################################
 
 DOCKER_ENGINE_VERSION = v1.12.5
+DOCKER_ENGINE_COMMIT = 7392c3b0ce0f9d3e918a321c66668c5d1ef4f689
 DOCKER_ENGINE_SITE = $(call github,docker,docker,$(DOCKER_ENGINE_VERSION))
 
 DOCKER_ENGINE_LICENSE = Apache-2.0

package/docker-engine/docker-engine.mk endif · line 73

Quoted 7 lines
package/docker-engine/docker-engine.mk +3 -1
@@ -67,7 +68,9 @@ endif
 define DOCKER_ENGINE_CONFIGURE_CMDS
 	ln -fs $(@D) $(DOCKER_ENGINE_GOPATH)/src/github.com/docker/docker
 	cd $(@D) && \
-		GITCOMMIT="unknown" BUILDTIME="$$(date)" VERSION="$(DOCKER_ENGINE_VERSION)" \
+		GITCOMMIT="$$(echo $(DOCKER_ENGINE_COMMIT) | head -c7)" \
+		BUILDTIME="$$(date)" \
+		VERSION="$$(echo $(DOCKER_ENGINE_VERSION) | tail -c +2)" \

We prefer to do text processing in make instead of shell where possible as that is (a bit) faster, easier to read (E.G. no double $$) and easier to debug (E.G. the make output directly shows the result of the commands).

There is no simple way of doing head -c7, so I've left that but changed the VERSION calculation to use patsubst.

Committed with that fixed, thanks.

Signature · 1 line
Bye, Peter Korsgaard