nets, docker, runc, oci-*tools: go.bbclass compile fixes

Recently in the oe-core the go.bbclass changed and requires the
defition of the GO_IMPORT variable.  This was intended to simplify how
the compilation works with go packages and it is still a work in
progress.

This patch set makes the recipes compatible to generate the same end
result as before using the new go.bbclass from oe-core.

Any patches that were included in the recipes had to have the paths
adjusted because the new go.bbclass manipulates the notion of S to be
S + "src" + "$GO_IMPORT" internally for the purpose of unpack, patch
and compile.

Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
This commit is contained in:
Jason Wessel 2017-09-13 12:39:46 -07:00 committed by Bruce Ashfield
parent 718592922b
commit 01a8d45370
14 changed files with 88 additions and 82 deletions

View File

@ -32,7 +32,9 @@ SRC_URI = "\
# Apache-2.0 for docker
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=9740d093a080530b5c5c6573df9af45a"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=9740d093a080530b5c5c6573df9af45a"
GO_IMPORT = "import"
S = "${WORKDIR}/git"
@ -81,18 +83,17 @@ do_compile() {
# Set GOPATH. See 'PACKAGERS.md'. Don't rely on
# docker to download its dependencies but rather
# use dependencies packaged independently.
cd ${S}
cd ${S}/src/import
rm -rf .gopath
mkdir -p .gopath/src/"$(dirname "${DOCKER_PKG}")"
ln -sf ../../../.. .gopath/src/"${DOCKER_PKG}"
mkdir -p .gopath/src/github.com/docker
ln -sf ../../../../../libnetwork .gopath/src/github.com/docker/libnetwork
ln -sf ../../../../../cli .gopath/src/github.com/docker/cli
ln -sf ${WORKDIR}/libnetwork .gopath/src/github.com/docker/libnetwork
ln -sf ${WORKDIR}/cli .gopath/src/github.com/docker/cli
export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
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"
cd -
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -109,10 +110,10 @@ do_compile() {
./hack/make.sh dynbinary
# build the proxy
go build -o ${S}/docker-proxy github.com/docker/libnetwork/cmd/proxy
go build -o ${S}/src/import/docker-proxy github.com/docker/libnetwork/cmd/proxy
# build the cli
go build -o ${S}/bundles/latest/dynbinary-client/docker github.com/docker/cli/cmd/docker
go build -o ${S}/src/import/bundles/latest/dynbinary-client/docker github.com/docker/cli/cmd/docker
}
SYSTEMD_PACKAGES = "${@bb.utils.contains('DISTRO_FEATURES','systemd','${PN}','',d)}"
@ -126,15 +127,15 @@ INITSCRIPT_PARAMS_${PN} = "defaults"
do_install() {
mkdir -p ${D}/${bindir}
cp ${S}/bundles/latest/dynbinary-client/docker ${D}/${bindir}/docker
cp ${S}/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
cp ${S}/docker-proxy ${D}/${bindir}/docker-proxy
cp ${S}/src/import/bundles/latest/dynbinary-client/docker ${D}/${bindir}/docker
cp ${S}/src/import/bundles/latest/dynbinary-daemon/dockerd ${D}/${bindir}/dockerd
cp ${S}/src/import/docker-proxy ${D}/${bindir}/docker-proxy
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -d ${D}${systemd_unitdir}/system
install -m 644 ${S}/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
install -m 644 ${S}/src/import/contrib/init/systemd/docker.* ${D}/${systemd_unitdir}/system
# replaces one copied from above with one that uses the local registry for a mirror
install -m 644 ${S}/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
install -m 644 ${S}/src/import/contrib/init/systemd/docker.service ${D}/${systemd_unitdir}/system
else
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/docker.init ${D}${sysconfdir}/init.d/docker.init
@ -142,7 +143,7 @@ do_install() {
mkdir -p ${D}${datadir}/docker/
cp ${WORKDIR}/hi.Dockerfile ${D}${datadir}/docker/
install -m 0755 ${S}/contrib/check-config.sh ${D}${datadir}/docker/
install -m 0755 ${S}/src/import/contrib/check-config.sh ${D}${datadir}/docker/
}
inherit useradd

View File

@ -18,8 +18,8 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
integration-cli/docker_cli_save_load_unix_test.go | 2 +-
5 files changed, 5 insertions(+), 5 deletions(-)
--- a/client/README.md
+++ b/client/README.md
--- a/src/import/client/README.md
+++ b/src/import/client/README.md
@@ -8,7 +8,7 @@ For example, to list running containers
package main
@ -29,8 +29,8 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
"fmt"
"github.com/docker/docker/api/types"
--- a/client/client.go
+++ b/client/client.go
--- a/src/import/client/client.go
+++ b/src/import/client/client.go
@@ -19,7 +19,7 @@ For example, to list running containers
package main
@ -40,8 +40,8 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
"fmt"
"github.com/docker/docker/api/types"
--- a/daemon/info_unix.go
+++ b/daemon/info_unix.go
--- a/src/import/daemon/info_unix.go
+++ b/src/import/daemon/info_unix.go
@@ -3,7 +3,7 @@
package daemon
@ -51,8 +51,8 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
"os/exec"
"strings"
--- a/integration-cli/docker_api_attach_test.go
+++ b/integration-cli/docker_api_attach_test.go
--- a/src/import/integration-cli/docker_api_attach_test.go
+++ b/src/import/integration-cli/docker_api_attach_test.go
@@ -3,7 +3,7 @@ package main
import (
"bufio"
@ -62,8 +62,8 @@ Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
"io"
"net"
"net/http"
--- a/integration-cli/docker_cli_save_load_unix_test.go
+++ b/integration-cli/docker_cli_save_load_unix_test.go
--- a/src/import/integration-cli/docker_cli_save_load_unix_test.go
+++ b/src/import/integration-cli/docker_cli_save_load_unix_test.go
@@ -3,7 +3,7 @@
package main

View File

@ -40,8 +40,8 @@ Signed-off-by: W. Trevor King <wking@tremily.us>
diff --git a/image/manifest.go b/image/manifest.go
index 8834c1e5f2f0..144bd4f62219 100644
--- a/image/manifest.go
+++ b/image/manifest.go
--- a/src/import/image/manifest.go
+++ b/src/import/image/manifest.go
@@ -253,11 +253,27 @@ loop:
continue loop
}

View File

@ -18,8 +18,8 @@ Signed-off-by: W. Trevor King <wking@tremily.us>
diff --git a/image/manifest.go b/image/manifest.go
index 144bd4f62219..dfd5a83f70e4 100644
--- a/image/manifest.go
+++ b/image/manifest.go
--- a/src/import/image/manifest.go
+++ b/src/import/image/manifest.go
@@ -218,116 +218,131 @@ loop:
return errors.Wrapf(err, "error advancing tar stream")
}

View File

@ -18,8 +18,7 @@ SRC_URI = "git://github.com/opencontainers/image-tools.git \
SRCREV = "4abe1a166f9be97e8e71b1bb4d7599cc29323011"
PV = "0.2.0-dev+git${SRCPV}"
S = "${WORKDIR}/git"
GO_IMPORT = "import"
inherit goarch
inherit go
@ -38,11 +37,11 @@ do_compile() {
#
# We also need to link in the ipallocator directory as that is not under
# a src directory.
ln -sfn . "${S}/vendor/src"
mkdir -p "${S}/vendor/src/github.com/opencontainers/image-tools/"
ln -sfn "${S}/image" "${S}/vendor/src/github.com/opencontainers/image-tools/image"
ln -sfn "${S}/version" "${S}/vendor/src/github.com/opencontainers/image-tools/version"
export GOPATH="${S}/vendor"
ln -sfn . "${S}/src/import/vendor/src"
mkdir -p "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/"
ln -sfn "${S}/src/import/image" "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/image"
ln -sfn "${S}/src/import/version" "${S}/src/import/vendor/src/github.com/opencontainers/image-tools/version"
export GOPATH="${S}/src/import/vendor"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -51,13 +50,14 @@ do_compile() {
export LDFLAGS=""
export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
cd ${S}/src/import
oe_runmake tool
}
do_install() {
install -d ${D}/${sbindir}
install ${S}/oci-image-tool ${D}/${sbindir}/
install ${S}/src/import/oci-image-tool ${D}/${sbindir}/
}
INSANE_SKIP_${PN} += "ldflags"

View File

@ -1,14 +1,13 @@
HOMEPAGE = "https://github.com/opencontainers/runtime-tools"
SUMMARY = "oci-runtime-tool is a collection of tools for working with the OCI runtime specification"
LICENSE = "GPLv2"
LIC_FILES_CHKSUM = "file://LICENSE;md5=b355a61a394a504dacde901c958f662c"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=b355a61a394a504dacde901c958f662c"
SRC_URI = "git://github.com/opencontainers/runtime-tools.git"
SRCREV = "15ec1df3f6607f4223ab3915547c184cf60a30dd"
PV = "0.0.1+git${SRCPV}"
S = "${WORKDIR}/git"
GO_IMPORT = "import"
INSANE_SKIP_${PN} += "ldflags"
@ -18,7 +17,7 @@ inherit go
do_compile() {
export GOARCH="${TARGET_GOARCH}"
export GOROOT="${STAGING_LIBDIR_NATIVE}/${TARGET_SYS}/go"
export GOPATH="${S}:${S}/vendor"
export GOPATH="${S}/src/import:${S}/src/import/vendor"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -29,17 +28,18 @@ do_compile() {
export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
# link fixups for compilation
rm -f ${S}/vendor/src
ln -sf ./ ${S}/vendor/src
mkdir -p ${S}/vendor/github.com/opencontainers/runtime-tools
ln -sf ../../../../generate ${S}/vendor/github.com/opencontainers/runtime-tools/generate
ln -sf ../../../../validate ${S}/vendor/github.com/opencontainers/runtime-tools/validate
ln -sf ../../../../cmd ${S}/vendor/github.com/opencontainers/runtime-tools/cmd
rm -f ${S}/src/import/vendor/src
ln -sf ./ ${S}/src/import/vendor/src
mkdir -p ${S}/src/import/vendor/github.com/opencontainers/runtime-tools
ln -sf ../../../../generate ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/generate
ln -sf ../../../../validate ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/validate
ln -sf ../../../../cmd ${S}/src/import/vendor/github.com/opencontainers/runtime-tools/cmd
cd ${S}/src/import
oe_runmake
}
do_install() {
install -d ${D}/${sbindir}
install ${S}/oci-runtime-tool ${D}/${sbindir}/oci-runtime-tool
install ${S}/src/import/oci-runtime-tool ${D}/${sbindir}/oci-runtime-tool
}

View File

@ -1,11 +1,12 @@
HOMEPAGE = "https://github.com/jfrazelle/riddler"
SUMMARY = "Convert `docker inspect` to opencontainers (OCI compatible) runc spec."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
SRC_URI = "git://github.com/jfrazelle/riddler;branch=master"
SRCREV = "23befa0b232877b5b502b828e24161d801bd67f6"
PV = "0.1.0+git${SRCPV}"
GO_IMPORT = "import"
S = "${WORKDIR}/git"
@ -26,10 +27,10 @@ do_compile() {
#
# We also need to link in the ipallocator directory as that is not under
# a src directory.
ln -sfn . "${S}/vendor/src"
mkdir -p "${S}/vendor/src/github.com/jessfraz/riddler"
ln -sfn "${S}/parse" "${S}/vendor/src/github.com/jessfraz/riddler/parse"
export GOPATH="${S}/vendor"
ln -sfn . "${S}/src/import/vendor/src"
mkdir -p "${S}/src/import/vendor/src/github.com/jessfraz/riddler"
ln -sfn "${S}/src/import/parse" "${S}/src/import/vendor/src/github.com/jessfraz/riddler/parse"
export GOPATH="${S}/src/import/vendor"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -38,11 +39,12 @@ do_compile() {
export LDFLAGS=""
export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
cd ${S}/src/import
oe_runmake static
}
do_install() {
install -d ${D}/${sbindir}
install ${S}/riddler ${D}/${sbindir}/riddler
install ${S}/src/import/riddler ${D}/${sbindir}/riddler
}

View File

@ -14,8 +14,8 @@ Signed-off-by: Justin Cormack <justin.cormack@docker.com>
diff --git a/vendor.conf b/vendor.conf
index e23e7ea7..09a8a924 100644
--- a/vendor.conf
+++ b/vendor.conf
--- a/src/import/vendor.conf
+++ b/src/import/vendor.conf
@@ -1,7 +1,7 @@
# OCI runtime-spec. When updating this, make sure you use a version tag rather
# than a commit ID so it's much more obvious what version of the spec we are
@ -27,8 +27,8 @@ index e23e7ea7..09a8a924 100644
github.com/opencontainers/selinux v1.0.0-rc1
diff --git a/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go b/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
index 8bf8d924..68ab112e 100644
--- a/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
+++ b/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
--- a/src/import/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
+++ b/src/import/vendor/github.com/opencontainers/runtime-spec/specs-go/config.go
@@ -6,8 +6,6 @@ import "os"
type Spec struct {
// Version of the Open Container Runtime Specification with which the bundle complies.

View File

@ -14,8 +14,8 @@ Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
diff --git a/utils_linux.go b/utils_linux.go
index 8085f7fe..e6d31b35 100644
--- a/utils_linux.go
+++ b/utils_linux.go
--- a/src/import/utils_linux.go
+++ b/src/import/utils_linux.go
@@ -227,6 +227,11 @@ type runner struct {
}

View File

@ -13,8 +13,8 @@ Signed-off-by: Justin Cormack <justin.cormack@docker.com>
diff --git a/libcontainer/specconv/example.go b/libcontainer/specconv/example.go
index 33134116..d6621194 100644
--- a/libcontainer/specconv/example.go
+++ b/libcontainer/specconv/example.go
--- a/src/import/libcontainer/specconv/example.go
+++ b/src/import/libcontainer/specconv/example.go
@@ -2,7 +2,6 @@ package specconv
import (
@ -36,8 +36,8 @@ index 33134116..d6621194 100644
Readonly: true,
diff --git a/spec.go b/spec.go
index 92d38f57..876937d2 100644
--- a/spec.go
+++ b/spec.go
--- a/src/import/spec.go
+++ b/src/import/spec.go
@@ -7,7 +7,6 @@ import (
"fmt"
"io/ioutil"

View File

@ -20,8 +20,8 @@ Signed-off-by: Justin Cormack <justin.cormack@docker.com>
diff --git a/libcontainer/cgroups/fs/memory.go b/libcontainer/cgroups/fs/memory.go
index da2cc9f8..b739c631 100644
--- a/libcontainer/cgroups/fs/memory.go
+++ b/libcontainer/cgroups/fs/memory.go
--- a/src/import/libcontainer/cgroups/fs/memory.go
+++ b/src/import/libcontainer/cgroups/fs/memory.go
@@ -73,14 +73,14 @@ func EnableKernelMemoryAccounting(path string) error {
// until a limit is set on the cgroup and limit cannot be set once the
// cgroup has children, or if there are already tasks in the cgroup.
@ -123,8 +123,8 @@ index da2cc9f8..b739c631 100644
}
diff --git a/libcontainer/configs/cgroup_linux.go b/libcontainer/configs/cgroup_linux.go
index 3e0509de..e15a662f 100644
--- a/libcontainer/configs/cgroup_linux.go
+++ b/libcontainer/configs/cgroup_linux.go
--- a/src/import/libcontainer/configs/cgroup_linux.go
+++ b/src/import/libcontainer/configs/cgroup_linux.go
@@ -43,19 +43,19 @@ type Resources struct {
Devices []*Device `json:"devices"`
@ -152,8 +152,8 @@ index 3e0509de..e15a662f 100644
CpuShares uint64 `json:"cpu_shares"`
diff --git a/update.go b/update.go
index 0ea90d60..133be999 100644
--- a/update.go
+++ b/update.go
--- a/src/import/update.go
+++ b/src/import/update.go
@@ -124,11 +124,11 @@ other options are ignored.
r := specs.LinuxResources{

View File

@ -10,6 +10,8 @@ SRC_URI = "git://github.com/docker/runc.git;nobranch=1;name=runc-docker \
file://0001-runc-Add-console-socket-dev-null.patch \
"
GO_IMPORT = "import"
RUNC_VERSION = "1.0.0-rc3"
PROVIDES += "virtual/runc"
RPROVIDES_${PN} = "virtual/runc"

View File

@ -4,7 +4,7 @@ DESCRIPTION = "runc is a CLI tool for spawning and running containers according
# Apache-2.0 for containerd
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=435b266b3899aa8a959f17d41c56def8"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=435b266b3899aa8a959f17d41c56def8"
S = "${WORKDIR}/git"
@ -26,20 +26,19 @@ do_compile() {
# Set GOPATH. See 'PACKAGERS.md'. Don't rely on
# docker to download its dependencies but rather
# use dependencies packaged independently.
cd ${S}
cd ${S}/src/import
rm -rf .gopath
dname=`dirname "${LIBCONTAINER_PACKAGE}"`
bname=`basename "${LIBCONTAINER_PACKAGE}"`
mkdir -p .gopath/src/${dname}
(cd .gopath/src/${dname}; ln -sf ../../../../../${bname} ${bname})
export GOPATH="${S}/.gopath:${S}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
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"
cd -
# Fix up symlink for go-cross compiler
rm -f ${S}/vendor/src
ln -sf ./ ${S}/vendor/src
rm -f ${S}/src/import/vendor/src
ln -sf ./ ${S}/src/import/vendor/src
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -55,7 +54,7 @@ do_compile() {
do_install() {
mkdir -p ${D}/${bindir}
cp ${S}/runc ${D}/${bindir}/runc
cp ${S}/src/import/runc ${D}/${bindir}/runc
ln -sf runc ${D}/${bindir}/docker-runc
}

View File

@ -1,11 +1,12 @@
HOMEPAGE = "https://github.com/jfrazelle/netns"
SUMMARY = "Runc hook for setting up default bridge networking."
LICENSE = "MIT"
LIC_FILES_CHKSUM = "file://LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
LIC_FILES_CHKSUM = "file://src/import/LICENSE;md5=20ce4c6a4f32d6ee4a68e3a7506db3f1"
SRC_URI = "git://github.com/jessfraz/netns;branch=master"
SRCREV = "85b1ab9fcccbaa404a2636b52a48bbde02437cf7"
PV = "0.1.0+git${SRCPV}"
GO_IMPORT = "import"
S = "${WORKDIR}/git"
@ -22,10 +23,10 @@ do_compile() {
#
# We also need to link in the ipallocator directory as that is not under
# a src directory.
ln -sfn . "${S}/vendor/src"
mkdir -p "${S}/vendor/src/github.com/jessfraz/netns"
ln -sfn "${S}/ipallocator" "${S}/vendor/src/github.com/jessfraz/netns/ipallocator"
export GOPATH="${S}/vendor"
ln -sfn . "${S}/src/import/vendor/src"
mkdir -p "${S}/src/import/vendor/src/github.com/jessfraz/netns"
ln -sfn "${S}/src/import/ipallocator" "${S}/src/import/vendor/src/github.com/jessfraz/netns/ipallocator"
export GOPATH="${S}/src/import/vendor"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
@ -35,10 +36,11 @@ do_compile() {
export CGO_CFLAGS="${BUILDSDK_CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${BUILDSDK_LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
cd ${S}/src/import
oe_runmake static
}
do_install() {
install -d ${D}/${sbindir}
install ${S}/netns ${D}/${sbindir}/netns
install ${S}/src/import/netns ${D}/${sbindir}/netns
}