Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 2/3] docker-containerd: new package
Date: Thu, 26 May 2016 21:29:58 +0200	[thread overview]
Message-ID: <20160526212958.36eeac5e@free-electrons.com> (raw)
In-Reply-To: <1464219082-3818-3-git-send-email-christian@paral.in>

Hello,

On Wed, 25 May 2016 16:31:21 -0700, Christian Stewart wrote:
> docker-containerd is a daemon and API for controlling and managing runC
> containers.
> 
> Note: fixes for arm64 (armv8) will be included in the next Docker
> release. A temporary cherry-pick of relevant arm64 fixes is available:
> 
> Commit f51d17f7 from https://github.com/paralin/buildroot.git

Well, then either include the required patch, or disable the build on
arm64 for now.

> diff --git a/package/docker-containerd/Config.in b/package/docker-containerd/Config.in
> new file mode 100644
> index 0000000..6b3760d
> --- /dev/null
> +++ b/package/docker-containerd/Config.in
> @@ -0,0 +1,8 @@
> +config BR2_PACKAGE_DOCKER_CONTAINERD
> +	bool "docker-containerd"
> +	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS

Thread dependency or not?

> +	select BR2_PACKAGE_RUNC
> +	help
> +    containerd is a daemon to control runC.

Identation: one tab + two spaces.

> diff --git a/package/docker-containerd/docker-containerd.mk b/package/docker-containerd/docker-containerd.mk
> new file mode 100644
> index 0000000..9225143
> --- /dev/null
> +++ b/package/docker-containerd/docker-containerd.mk
> @@ -0,0 +1,48 @@
> +################################################################################
> +#
> +# docker-containerd
> +#
> +################################################################################
> +
> +DOCKER_CONTAINERD_VERSION = v0.2.1
> +DOCKER_CONTAINERD_VERSION_COMMIT = ca47f7e76a93e9b3768ed084d62318e85bd9f4b2

Same question: why?

> +DOCKER_CONTAINERD_SITE = $(call github,docker,containerd,$(DOCKER_CONTAINERD_VERSION))
> +
> +DOCKER_CONTAINERD_LICENSE = Apache-2.0
> +DOCKER_CONTAINERD_LICENSE_FILES = LICENSE.code
> +
> +DOCKER_CONTAINERD_DEPENDENCIES = host-go runc

So runc is really a build-time dependency?

> +
> +DOCKER_CONTAINERD_MAKE_ENV = \
> +	GOBIN="$(@D)/bin" \
> +	GOPATH="$(@D)/vendor" \
> +	GOARCH=$(GO_GOARCH) \
> +	CGO_ENABLED=1

Usage of HOST_GO_TARGET_ENV ?

> +
> +DOCKER_CONTAINERD_GLDFLAGS = \
> +	-X github.com/docker/containerd.GitCommit=$(DOCKER_CONTAINERD_VERSION_COMMIT) \

Why does it need this information?

> +	-extldflags '-static'
> +
> +define DOCKER_CONTAINERD_CONFIGURE_CMDS
> +	# Put sources at prescribed GOPATH location.
> +	export $(DOCKER_CONTAINERD_MAKE_ENV) && \

Why this export ?

> +		mkdir -p $$GOPATH/src/github.com/docker && \
> +		ln -s $(@D) $$GOPATH/src/github.com/docker/containerd && \
> +		mkdir -p $$GOPATH/src/github.com/opencontainers && \
> +		ln -s $(RUNC_SRCDIR) $$GOPATH/src/github.com/opencontainers/runc

Same remarks as with the other package:

 *) Why is this needed

 *) No need for the &&, these can be independent commands, one after
    the other.

> +endef
> +
> +define DOCKER_CONTAINERD_BUILD_CMDS
> +	cd $(@D) && export $(DOCKER_CONTAINERD_MAKE_ENV) && \

Why is export needed? Just do:

	$(DOCKER_CONTAINERD_MAKE_ENV) $(HOST_DIR)/usr/bin/go ...

> +		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/ctr -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./ctr && \
> +		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd && \
> +		$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" ./containerd-shim

No need for the &&, make these independent commands.

Is the "cd $(@D)" really needed ? Isn't it possible to do:

$(HOST_DIR)/usr/bin/go build -v -o $(@D)/bin/containerd-shim -ldflags "$(DOCKER_CONTAINERD_GLDFLAGS)" $(@D)/containerd-shim

> +endef
> +
> +define DOCKER_CONTAINERD_INSTALL_TARGET_CMDS
> +	$(INSTALL) -D -m 0755 $(TARGET_DIR)/usr/bin/runc $(TARGET_DIR)/usr/bin/docker-runc

Why are you doing this? If it really needs to be called docker-runc,
why not just a symbolic link ?

> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd $(TARGET_DIR)/usr/bin/docker-containerd
> +	$(INSTALL) -D -m 0755 $(@D)/bin/containerd-shim $(TARGET_DIR)/usr/bin/containerd-shim
> +endef
> +
> +$(eval $(generic-package))

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

  reply	other threads:[~2016-05-26 19:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-25 23:31 [Buildroot] [PATCH v3 0/3] Add docker engine support Christian Stewart
2016-05-25 23:31 ` [Buildroot] [PATCH v3 1/3] runc: new package Christian Stewart
2016-05-26 19:12   ` Thomas Petazzoni
2016-05-26 19:51     ` Geoff Levand
2016-05-26 20:01       ` Thomas Petazzoni
2016-05-26 20:21     ` Christian Stewart
2016-05-27  5:23       ` Thomas Petazzoni
2016-05-25 23:31 ` [Buildroot] [PATCH v3 2/3] docker-containerd: " Christian Stewart
2016-05-26 19:29   ` Thomas Petazzoni [this message]
2016-05-26 23:10     ` Christian Stewart
2016-05-25 23:31 ` [Buildroot] [PATCH v3 3/3] docker-engine: " Christian Stewart
2016-05-26 19:34   ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160526212958.36eeac5e@free-electrons.com \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox