containerd-opencontainers: uprev to 1.3.3 for stx 5.0

* add bbappend to uprev to 1.3.3

* inherit stx-metadata to help apply patches and install
  updated files from stx 'integ' and 'config-files' repo.

* override the do_compile since the one in meta-virtualization
  doesn't work for the new version.

* append do_install to install extra binaries and config files

Story: 2008952
Task: 42576

Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
Change-Id: Ie52b798f844c88e7d79ef84293fc140c9784a0fb
This commit is contained in:
Jackie Huang 2021-06-23 14:55:10 +08:00
parent 505a48d573
commit d9e8fd3c96
2 changed files with 149 additions and 0 deletions

View File

@ -0,0 +1,100 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
inherit stx-metadata
STX_REPO = "integ"
STX_SUBPATH = "kubernetes/containerd/centos/files"
STX_EXTRA_REPO = "config-files"
STX_EXTRA_SUBPATH = "containerd-config/files"
STX_METADATA_EXTRA_PATH = "${TMPDIR}/work-shared/stx-${STX_EXTRA_REPO}-source/git/${STX_EXTRA_SUBPATH}"
FILESEXTRAPATHS_prepend = "${STX_METADATA_EXTRA_PATH}:"
do_patch[depends] += "stx-${STX_EXTRA_REPO}-source:do_patch"
SRCREV = "d76c121f76a5fc8a462dc64594aea72fe18e1178"
SRC_URI = "\
git://github.com/containerd/containerd;branch=release/1.3 \
file://0001-build-use-oe-provided-GO-and-flags.patch;patchdir=src/${GO_IMPORT} \
file://containerd.service \
"
SRC_URI_STX = "\
file://0001-customize-containerd-for-StarlingX.patch;patchdir=src/${GO_IMPORT};striplevel=2 \
file://0002-archive-skip-chmod-IsNotExist-error.patch;patchdir=src/${GO_IMPORT};striplevel=2 \
"
CONTAINERD_VERSION = "v1.3.3"
VENDOR_SRCDIR = "${S}/src/${GO_IMPORT}/vendor/src"
CONTAINERD_DIR = "${VENDOR_SRCDIR}/github.com/containerd/containerd"
CONTAINERD_SUBDIR = "\
api archive cio cmd containers content defaults diff errdefs events filters \
gc identifiers images labels leases log metadata metrics mount namespaces \
oci platforms plugin protobuf reference remotes rootfs runtime services \
snapshots sys version \
"
CONTAINERD_PKG_SUBDIR = "dialer oom process progress seed stdio testutil timeout ttrpcutil"
CONTAINERD_CONTRIB_SUBDIR = "apparmor aws nvidia seccomp snapshotservice"
do_compile() {
export GOARCH="${TARGET_GOARCH}"
# link fixups for compilation
rm -f ${VENDOR_SRCDIR}
ln -sf ./ ${VENDOR_SRCDIR}
mkdir -p ${CONTAINERD_DIR}/
mkdir -p ${CONTAINERD_DIR}/pkg/
mkdir -p ${CONTAINERD_DIR}/contrib/
# without this, the stress test parts of the build fail
cp ${S}/src/${GO_IMPORT}/*.go ${CONTAINERD_DIR}
for c in ${CONTAINERD_SUBDIR}; do
if [ -d ${S}/src/${GO_IMPORT}/${c} ]; then
ln -sfn ${S}/src/${GO_IMPORT}/${c} ${CONTAINERD_DIR}/${c}
fi
done
for c in ${CONTAINERD_PKG_SUBDIR}; do
if [ -d ${S}/src/${GO_IMPORT}/pkg/${c} ]; then
ln -sfn ${S}/src/${GO_IMPORT}/pkg/${c} ${CONTAINERD_DIR}/pkg/${c}
fi
done
for c in ${CONTAINERD_CONTRIB_SUBDIR}; do
if [ -d ${S}/src/${GO_IMPORT}/contrib/${c} ]; then
ln -sfn ${S}/src/${GO_IMPORT}/contrib/${c} ${CONTAINERD_DIR}/contrib/${c}
fi
done
export GOPATH="${S}/src/${GO_IMPORT}/.gopath:${S}/src/${GO_IMPORT}/vendor:${STAGING_DIR_TARGET}/${prefix}/local/go"
export GOROOT="${STAGING_DIR_NATIVE}/${nonarch_libdir}/${HOST_SYS}/go"
# Pass the needed cflags/ldflags so that cgo
# can find the needed headers files and libraries
export CGO_ENABLED="1"
export CGO_CFLAGS="${CFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export CGO_LDFLAGS="${LDFLAGS} --sysroot=${STAGING_DIR_TARGET}"
export BUILDTAGS="no_btrfs static_build netgo"
export CFLAGS="${CFLAGS}"
export LDFLAGS="${LDFLAGS}"
cd ${S}/src/${GO_IMPORT}
oe_runmake binaries
}
do_install_append() {
install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-shim-runc-v1 ${D}/${bindir}
install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-shim-runc-v2 ${D}/${bindir}
install -p -m 755 ${S}/src/${GO_IMPORT}/bin/containerd-stress ${D}/${bindir}
install -p -m 755 ${S}/src/${GO_IMPORT}/bin/ctr ${D}/${bindir}
# from containerd-config.spec in stx config-files repo
install -d -m 755 ${D}/${sysconfdir}/pmon.d/
install -p -m 644 ${STX_METADATA_EXTRA_PATH}/containerd-pmon.conf ${D}/${sysconfdir}/pmon.d/containerd.conf
install -d -m 755 ${D}/${sysconfdir}/systemd/system/containerd.service.d/
install -p -m 644 ${STX_METADATA_EXTRA_PATH}/containerd-stx-override.conf ${D}/${sysconfdir}/systemd/system/containerd.service.d/
}
RDEPENDS_${PN} += "cri-tools"

View File

@ -0,0 +1,49 @@
From a0a8d223df20b473e7e25d32bdeda2e031bcfaed Mon Sep 17 00:00:00 2001
From: Jackie Huang <jackie.huang@windriver.com>
Date: Thu, 1 Jul 2021 19:20:20 +0800
Subject: [PATCH] build: use oe provided GO and flags
We want to use the go compiler as defined in the oe-enviroment, not the
generic call to 'go'. Without changing this, we'll get things like cgo
errors and invalid flag combos.
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Rebased for v1.3.3
Signed-off-by: Jackie Huang <jackie.huang@windriver.com>
---
Makefile | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Makefile b/Makefile
index 37012e8..0af2543 100644
--- a/Makefile
+++ b/Makefile
@@ -185,19 +185,19 @@ FORCE:
# Build a binary from a cmd.
bin/%: cmd/% FORCE
@echo "$(WHALE) $@${BINARY_SUFFIX}"
- @go build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@${BINARY_SUFFIX} ${GO_LDFLAGS} ${GO_TAGS} ./$<
+ @$(GO) build ${DEBUG_GO_GCFLAGS} ${GO_GCFLAGS} ${GO_BUILD_FLAGS} -o $@${BINARY_SUFFIX} ${GO_LDFLAGS} ${GO_TAGS} ./$<
bin/containerd-shim: cmd/containerd-shim FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
@echo "$(WHALE) bin/containerd-shim"
- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
+ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim
bin/containerd-shim-runc-v1: cmd/containerd-shim-runc-v1 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
@echo "$(WHALE) bin/containerd-shim-runc-v1"
- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
+ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v1 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v1
bin/containerd-shim-runc-v2: cmd/containerd-shim-runc-v2 FORCE # set !cgo and omit pie for a static shim build: https://github.com/golang/go/issues/17789#issuecomment-258542220
@echo "$(WHALE) bin/containerd-shim-runc-v2"
- @CGO_ENABLED=0 go build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
+ @$(GO) build ${GO_BUILD_FLAGS} -o bin/containerd-shim-runc-v2 ${SHIM_GO_LDFLAGS} ${GO_TAGS} ./cmd/containerd-shim-runc-v2
binaries: $(BINARIES) ## build binaries
@echo "$(WHALE) $@"
--
2.7.4