From 2e844291c578eef271a06fa31191b4ca25160dfa Mon Sep 17 00:00:00 2001 From: aliriza Date: Fri, 1 Dec 2023 13:02:47 +0000 Subject: [PATCH] docker go --- app/containers/docker/docker.confd | 29 ++++++++++ app/containers/docker/docker.initd | 33 ++++++++++++ app/containers/docker/ympbuild | 82 ++++++++++++++++++++++++++++ dev/lang/go/ympbuild | 86 ++++++++++++++++++++++++++++++ 4 files changed, 230 insertions(+) create mode 100644 app/containers/docker/docker.confd create mode 100644 app/containers/docker/docker.initd create mode 100755 app/containers/docker/ympbuild create mode 100644 dev/lang/go/ympbuild diff --git a/app/containers/docker/docker.confd b/app/containers/docker/docker.confd new file mode 100644 index 00000000..cc599e6d --- /dev/null +++ b/app/containers/docker/docker.confd @@ -0,0 +1,29 @@ +# /etc/conf.d/docker: config file for /etc/init.d/docker + +# where the docker daemon output gets piped +# this contains both stdout and stderr. If you need to separate them, +# see the settings below +#DOCKER_LOGFILE="/var/log/docker.log" + +# where the docker daemon stdout gets piped +# if this is not set, DOCKER_LOGFILE is used +#DOCKER_OUTFILE="/var/log/docker-out.log" + +# where the docker daemon stderr gets piped +# if this is not set, DOCKER_LOGFILE is used +#DOCKER_ERRFILE="/var/log/docker-err.log" + +# where docker's pid get stored +#DOCKER_PIDFILE="/run/docker.pid" + +# Settings for process limits (ulimit) +#DOCKER_ULIMIT="-c unlimited -n 1048576 -u unlimited" + +# seconds to wait for sending SIGTERM and SIGKILL signals when stopping docker +#DOCKER_RETRY="TERM/60/KILL/10" + +# where the docker daemon itself is run from +#DOCKERD_BINARY="/usr/bin/dockerd" + +# any other random options you want to pass to docker +DOCKER_OPTS="" diff --git a/app/containers/docker/docker.initd b/app/containers/docker/docker.initd new file mode 100644 index 00000000..dde8b7a3 --- /dev/null +++ b/app/containers/docker/docker.initd @@ -0,0 +1,33 @@ +#!/sbin/openrc-run +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +command="${DOCKERD_BINARY:-/usr/bin/dockerd}" +pidfile="${DOCKER_PIDFILE:-/run/${RC_SVCNAME}.pid}" +command_args="-p \"${pidfile}\" ${DOCKER_OPTS}" +DOCKER_LOGFILE="${DOCKER_LOGFILE:-/var/log/${RC_SVCNAME}.log}" +DOCKER_ERRFILE="${DOCKER_ERRFILE:-${DOCKER_LOGFILE}}" +DOCKER_OUTFILE="${DOCKER_OUTFILE:-${DOCKER_LOGFILE}}" +start_stop_daemon_args="--background \ + --stderr \"${DOCKER_ERRFILE}\" --stdout \"${DOCKER_OUTFILE}\"" + +extra_started_commands="reload" + +rc_ulimit="${DOCKER_ULIMIT:--c unlimited -n 1048576 -u unlimited}" + +retry="${DOCKER_RETRY:-TERM/60/KILL/10}" + +depend() { + need sysfs cgroups net containerd + after firewall +} + +start_pre() { + checkpath -f -m 0644 -o root:docker "$DOCKER_LOGFILE" +} + +reload() { + ebegin "Reloading ${RC_SVCNAME}" + start-stop-daemon --signal HUP --pidfile "${pidfile}" + eend $? "Failed to stop ${RC_SVCNAME}" +} diff --git a/app/containers/docker/ympbuild b/app/containers/docker/ympbuild new file mode 100755 index 00000000..a633a2bd --- /dev/null +++ b/app/containers/docker/ympbuild @@ -0,0 +1,82 @@ +#!/usr/bin/env bash +name='docker' +release='1' +version='24.0.7' +url='https://docker.io' +description='Pack, ship and run any application as a lightweight container' +email='aliriza.keskin@pardus.org.tr' +maintainer='aliriza' +license=('GPLv3') +source=("cli.tar.gz::https://github.com/docker/cli/archive/v$version.tar.gz" + "moby.tar.gz::https://github.com/moby/moby/archive/v$version.tar.gz" + 'docker.initd' + 'docker.confd') +#depends=(ca-certificates containerd iptables tini) +makedepends=(go) +md5sums=('6e264f0471a7e924962dbab92268fb09' + '059ed51462797354f39e630d3d2257ef' + 'SKIP' + 'SKIP') +group=(app.containers) +uses=() +arch=('x86_64') + +# Thx alpine linux +# https://git.alpinelinux.org/aports/tree/community/docker/APKBUILD + +_cli_commit=afdd53b4e341be38d2056a42113b938559bb1d94 # https://github.com/docker/cli/commits/v$pkgver +_moby_commit=311b9ff0aa93aa55880e1e5f8871c4fb69583426 # https://github.com/moby/moby/commits/v$pkgver + +export AUTO_GOPATH=1 +export GITCOMMIT=$_cli_commit # for cli +export DOCKER_GITCOMMIT=$_moby_commit # for moby +export DOCKER_BUILDTAGS=$_buildtags +export DISABLE_WARN_OUTSIDE_CONTAINER=1 +unset CC # prevent possible ccache issues + +_cli_builddir="$HOME/cli-$version" +_moby_builddir="$HOME/moby-$version" + +build () { + # engine (moby) + cd moby-$version + mkdir -p src/github.com/docker/ + ln -sf "$HOME/moby-$version" src/github.com/docker/dockerd + GOPATH="$PWD" VERSION="$pkgver" hack/make.sh dynbinary + + # Required for building man-pages + export GOPATH="$_cli_builddir" + export GOBIN="$GOPATH/bin" + export PATH="$GOBIN:$PATH" + + # cli + cd ../cli-$version + mkdir -p "$_cli_builddir"/src/github.com/docker/ + ln -sf "$_cli_builddir" "$_cli_builddir"/src/github.com/docker/cli + LDFLAGS="" make VERSION="$pkgver" dynbinary + +} + +package () { + install -Dm644 "$_cli_builddir"/contrib/completion/fish/$name.fish \ + "$DESTDIR"/usr/share/fish/vendor_completions.d/$name.fish + + install -Dm644 "$_cli_builddir"/contrib/completion/zsh/_$name \ + "$DESTDIR"/usr/share/zsh/site-functions/_$name + + install -Dm644 "$_cli_builddir"/contrib/completion/bash/$name \ + "$DESTDIR"/usr/share/bash-completion/completions/$name + + # 'build/docker' is a symlink to 'docker-linux-$arch' e.g. 'docker-linux-amd64' + install -Dm755 "$_cli_builddir"/build/docker \ + "$DESTDIR"/usr/bin/docker + + install -Dm755 -t "$DESTDIR"/usr/bin \ + "$_moby_builddir"/bundles/dynbinary-daemon/dockerd \ + "$_moby_builddir"/bundles/dynbinary-daemon/docker-proxy + + # service files from gentoo + install -Dm755 docker.initd "$DESTDIR"/etc/init.d/docker + install -Dm644 docker.confd "$DESTDIR"/etc/conf.d/docker +} + diff --git a/dev/lang/go/ympbuild b/dev/lang/go/ympbuild new file mode 100644 index 00000000..34a409d5 --- /dev/null +++ b/dev/lang/go/ympbuild @@ -0,0 +1,86 @@ +#!/usr/bin/env bash +name='go' +release='1' +version='1.21.4' +url='https://go.dev' +description='Go programming language compiler' +email='aliriza.keskin@pardus.org.tr' +maintainer='aliriza' +license=('GPLv3') +depends=() +makedepends=() +source=("https://go.dev/dl/go$version.linux-$DEBARCH.tar.gz") +if [[ "$DEBARCH" == "amd64" ]] ; then + md5sums=('b5ead0fdcb32540df8376389ee6c34a4') +fi +group=(dev.lang) +uses=() +arch=('x86_64') + +cd go/src + +export PATH=$HOME/go-prebuilt/bin:$PATH +export GOROOT_BOOTSRTRAP=$HOME/go-prebuilt +export GOARCH=$DEBARCH +export GOOS=linux +export GOPATH="$HOME/go" +export GOROOT="$HOME/go-prebuilt" +export GOBIN="$GOROOT"/bin +export GOROOT_FINAL=/usr/lib64/go + +prepare(){ + # copy directory + cd ../.. + cp -prvf go go-prebuilt + # remove binary from source + cd go/src + rm -rfv bin pkg/tool +} + +build () { + ./make.bash -v +} + +package () { + cd .. + mkdir -p "$DESTDIR"/usr/bin "$DESTDIR"/usr/lib64/go/bin "$DESTDIR"/usr/share/doc/go + + for binary in go gofmt; do + install -Dm755 bin/"$binary" "$DESTDIR"/usr/lib64/go/bin/"$binary" + ln -s ../lib64/go/bin/"$binary" "$DESTDIR"/usr/bin/ + done + + cp -a pkg lib "$DESTDIR"/usr/lib64/go + cp -r doc misc "$DESTDIR"/usr/share/doc/go + rm -rf "$DESTDIR"/usr/lib64/go/pkg/obj + rm -rf "$DESTDIR"/usr/lib64/go/pkg/bootstrap + rm -f "$DESTDIR"/usr/lib64/go/pkg/tool/*/api + + mkdir -p "$DESTDIR"/usr/lib64/go/ + cp -a "$HOME/go"/src "$DESTDIR"/usr/lib64/go + + # Install go.env, see https://go.dev/doc/toolchain#GOTOOLCHAIN. + install -Dm644 "$HOME/go"/go.env "$DESTDIR"/usr/lib64/go/go.env + install -Dm644 VERSION "$DESTDIR/usr/lib64/go/VERSION" + + # Remove tests from /usr/lib64/go/src to reduce package size, + # these should not be needed at run-time by any program. + find "$DESTDIR"/usr/lib64/go/src \( -type f -a -name "*_test.go" \) \ + -exec rm -rf \{\} \+ + find "$DESTDIR"/usr/lib64/go/src \( -type d -a -name "testdata" \) \ + -exec rm -rf \{\} \+ + + # Remove rc (plan 9) and bat scripts (windows) to reduce package + # size further. The bash scripts are actually needed at run-time. + # + # See: https://gitlab.alpinelinux.org/alpine/aports/issues/11091 + find "$DESTDIR"/usr/lib64/go/src -type f -a \( -name "*.rc" -o -name "*.bat" \) \ + -exec rm -rf \{\} \+ + + # cgo test files will be removed from misc/ in Go 1.21. + # Removing them from now decreases the size of -doc below 2 MiB. + # + # See https://github.com/golang/go/issues/37486#issuecomment-1321364279 + rm -r "$DESTDIR"/usr/share/doc/go/misc/cgo +} +