new package: containerd (#222)

This commit is contained in:
Frederico F. de Oliveira 2021-01-18 12:03:53 +00:00 committed by Yaksh Bariya
parent 8c5c657d8f
commit 7c80a761a5
No known key found for this signature in database
GPG Key ID: F7486BA7D3D27581
7 changed files with 190 additions and 0 deletions

View File

@ -0,0 +1,46 @@
diff --git a/data/data/com.termux/files/usr/tmp/docker-build/containerd-1.4.3/Makefile b/Makefile
index c0fecb9..e724e52 100644
--- a/data/data/com.termux/files/usr/tmp/docker-build/containerd-1.4.3/Makefile
+++ b/Makefile
@@ -20,10 +20,10 @@ ROOTDIR=$(dir $(abspath $(lastword $(MAKEFILE_LIST))))
DESTDIR ?= /usr/local
# Used to populate variables in version package.
-VERSION=$(shell git describe --match 'v[0-9]*' --dirty='.m' --always)
-REVISION=$(shell git rev-parse HEAD)$(shell if ! git diff --no-ext-diff --quiet --exit-code; then echo .m; fi)
+VERSION=v1.4.3.m
+REVISION=269548fa27e0089a8b8278fc4fc781d7f65a939b.m
PACKAGE=github.com/containerd/containerd
-SHIM_CGO_ENABLED ?= 0
+SHIM_CGO_ENABLED ?= 1
ifneq "$(strip $(shell command -v go 2>/dev/null))" ""
GOOS ?= $(shell go env GOOS)
@@ -69,7 +69,7 @@ RELEASE=containerd-$(VERSION:v%=%).${GOOS}-${GOARCH}
PKG=github.com/containerd/containerd
# Project binaries.
-COMMANDS=ctr containerd containerd-stress
+COMMANDS=ctr containerd containerd-stress containerd-shim containerd-shim-runc-v1 containerd-shim-runc-v2
MANPAGES=ctr.8 containerd.8 containerd-config.8 containerd-config.toml.5
ifdef BUILDTAGS
@@ -80,7 +80,7 @@ GO_BUILDTAGS ?= apparmor selinux
GO_BUILDTAGS += ${DEBUG_TAGS}
GO_TAGS=$(if $(GO_BUILDTAGS),-tags "$(GO_BUILDTAGS)",)
GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) $(EXTRA_LDFLAGS)'
-SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags "-static" $(EXTRA_LDFLAGS)'
+SHIM_GO_LDFLAGS=-ldflags '-X $(PKG)/version.Version=$(VERSION) -X $(PKG)/version.Revision=$(REVISION) -X $(PKG)/version.Package=$(PACKAGE) -extldflags $(EXTRA_LDFLAGS)'
# Project packages.
PACKAGES=$(shell go list ${GO_TAGS} ./... | grep -v /vendor/)
@@ -226,7 +226,8 @@ man/ctr.8: FORCE
man/%: docs/man/%.md FORCE
@echo "$(WHALE) $@"
- go-md2man -in "$<" -out "$@"
+ go build -o "bin/go-md2man" ./vendor/github.com/cpuguy83/go-md2man/v2
+ bin/go-md2man -in "$<" -out "$@"
define installmanpage
mkdir -p $(DESTDIR)/man/man$(2);

View File

@ -0,0 +1,35 @@
TERMUX_PKG_HOMEPAGE=https://containerd.io/
TERMUX_PKG_DESCRIPTION="An open and reliable container runtime"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=1.4.3
TERMUX_PKG_SRCURL=https://github.com/containerd/containerd/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=bc6d9452c700af0ebc09c0da8ddba55be4c03ac8928e72ca92d98905800c8018
TERMUX_PKG_DEPENDS="runc"
TERMUX_PKG_CONFFILES="etc/containerd/config.toml"
termux_step_make() {
# setup go build environment
termux_setup_golang
export GOPATH="${PWD}/go"
mkdir -p "${GOPATH}/src/github.com/containerd"
ln -sf "${TERMUX_PKG_SRCDIR}" "${GOPATH}/src/github.com/containerd/containerd"
cd "${GOPATH}/src/github.com/containerd/containerd"
# apply some patches in a batch
xargs sed -i "s_\(/etc/containerd\)_${TERMUX_PREFIX}\1_g" < <(grep -R /etc/containerd | cut -d':' -f1 | sort | uniq)
# issue the build command
export BUILDTAGS=no_btrfs
make -j ${TERMUX_MAKE_PROCESSES}
(unset GOOS GOARCH CGO_LDFLAGS CC CXX CFLAGS CXXFLAGS LDFLAGS
make -j ${TERMUX_MAKE_PROCESSES} man)
}
termux_step_make_install() {
cd "${GOPATH}/src/github.com/containerd/containerd"
DESTDIR=${TERMUX_PREFIX} make install
DESTDIR=${TERMUX_PREFIX}/share make install-man
install -Dm 600 ${TERMUX_PKG_BUILDER_DIR}/config.toml ${TERMUX_PREFIX}/etc/containerd/config.toml
}

View File

@ -0,0 +1,13 @@
diff --git a/data/data/com.termux/files/home/test/containerd-1.4.3/runtime/v1/linux/bundle.go b/runtime/v1/linux/bundle.go
index 9d0a6c4..a2063b2 100644
--- a/data/data/com.termux/files/home/test/containerd-1.4.3/runtime/v1/linux/bundle.go
+++ b/runtime/v1/linux/bundle.go
@@ -138,7 +138,7 @@ func (b *bundle) legacyShimAddress(namespace string) string {
return filepath.Join(string(filepath.Separator), "containerd-shim", namespace, b.id, "shim.sock")
}
-const socketRoot = "/run/containerd"
+const socketRoot = "/data/docker/run/containerd"
func (b *bundle) shimAddress(namespace, socketPath string) string {
d := sha256.Sum256([]byte(filepath.Join(socketPath, namespace, b.id)))

View File

@ -0,0 +1,9 @@
root = "/data/docker/var/lib/containerd"
state = "/data/docker/run/containerd"
imports = ["$PREFIX/etc/containerd/runtime_*.toml", "./debug.toml"]
[grpc]
address = "/data/docker/run/containerd/containerd.sock"
[debug]
address = "/data/docker/run/containerd/debug.sock"

View File

@ -0,0 +1,17 @@
diff --git a/data/data/com.termux/files/home/test/containerd-1.4.3/platforms/database.go b/platforms/database.go
index 6ede940..d010005 100644
--- a/data/data/com.termux/files/home/test/containerd-1.4.3/platforms/database.go
+++ b/platforms/database.go
@@ -25,7 +25,11 @@ import (
//
// The OS value should be normalized before calling this function.
func isLinuxOS(os string) bool {
- return os == "linux"
+ switch os {
+ case "linux", "android":
+ return true
+ }
+ return false
}
// These function are generated from https://golang.org/src/go/build/syslist.go.

View File

@ -0,0 +1,57 @@
diff --git a/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go b/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go
new file mode 100644
index 0000000..6078864
--- /dev/null
+++ b/vendor/github.com/cpuguy83/go-md2man/v2/md2man.go
@@ -0,0 +1,51 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "os"
+
+ "github.com/cpuguy83/go-md2man/v2/md2man"
+)
+
+var inFilePath = flag.String("in", "", "Path to file to be processed (default: stdin)")
+var outFilePath = flag.String("out", "", "Path to output processed file (default: stdout)")
+
+func main() {
+ var err error
+ flag.Parse()
+
+ inFile := os.Stdin
+ if *inFilePath != "" {
+ inFile, err = os.Open(*inFilePath)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ }
+ defer inFile.Close() // nolint: errcheck
+
+ doc, err := ioutil.ReadAll(inFile)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+
+ out := md2man.Render(doc)
+
+ outFile := os.Stdout
+ if *outFilePath != "" {
+ outFile, err = os.Create(*outFilePath)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+ defer outFile.Close() // nolint: errcheck
+ }
+ _, err = outFile.Write(out)
+ if err != nil {
+ fmt.Println(err)
+ os.Exit(1)
+ }
+}

View File

@ -0,0 +1,13 @@
diff --git a/data/data/com.termux/files/home/test/containerd-1.4.3/runtime/v2/shim/util_unix.go b/runtime/v2/shim/util_unix.go
index 2b0d0ad..9adb593 100644
--- a/data/data/com.termux/files/home/test/containerd-1.4.3/runtime/v2/shim/util_unix.go
+++ b/runtime/v2/shim/util_unix.go
@@ -66,7 +66,7 @@ func AdjustOOMScore(pid int) error {
return nil
}
-const socketRoot = "/run/containerd"
+const socketRoot = "/data/docker/run/containerd"
// SocketAddress returns a socket address
func SocketAddress(ctx context.Context, socketPath, id string) (string, error) {