From 4f2d7949f03e1c198bc888f2d05f421d35c57e21 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Mon, 9 Oct 2017 18:53:29 +0100 Subject: reinit the tree, so we can have metadata --- app-emulation/docker-registry/Manifest | 9 +++ .../docker-registry-2.6.2-r1.ebuild | 42 ++++++++++++++ ...ocker-registry-2.6.1-notifications-expvar.patch | 64 ++++++++++++++++++++++ app-emulation/docker-registry/files/registry.confd | 2 + app-emulation/docker-registry/files/registry.initd | 19 +++++++ .../docker-registry/files/registry.logrotated | 7 +++ .../docker-registry/files/registry.service | 13 +++++ app-emulation/docker-registry/metadata.xml | 10 ++++ 8 files changed, 166 insertions(+) create mode 100644 app-emulation/docker-registry/Manifest create mode 100644 app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild create mode 100644 app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch create mode 100644 app-emulation/docker-registry/files/registry.confd create mode 100644 app-emulation/docker-registry/files/registry.initd create mode 100644 app-emulation/docker-registry/files/registry.logrotated create mode 100644 app-emulation/docker-registry/files/registry.service create mode 100644 app-emulation/docker-registry/metadata.xml (limited to 'app-emulation/docker-registry') diff --git a/app-emulation/docker-registry/Manifest b/app-emulation/docker-registry/Manifest new file mode 100644 index 000000000000..37f13467202a --- /dev/null +++ b/app-emulation/docker-registry/Manifest @@ -0,0 +1,9 @@ +AUX docker-registry-2.6.1-notifications-expvar.patch 2360 SHA256 0f4a9b072c98664b0966e8ffd6cb0820e1313ead1af19c95bae7d4fd47382351 SHA512 2a1aa8fd0f5df6380c8b0b11bdbc0c8f62c02cdbd87d1b697f691189c04409c71a69cf50e36704cb8b7c3c6040c88c77110076aae439aa9e173f95b4347dbc0a WHIRLPOOL 76cee005fcb669ceeddee9e04e562ab8c0df5b7e6321d4de0f19ff6d35ccb31bea67daf83d7dfc5ba80588e50f20045389165c28e5c069921e20885381ddc381 +AUX registry.confd 85 SHA256 41a927ea50609b20ec6c9ec34935b38c230395c33797790768af2ad8cb3f3713 SHA512 7cbd19f545b659e2d295938b320710ae20b3c2222fcb6668216985c6e55bf51647041dec1c33ab7271e464f13001d8095fef9240d3390cff7e65028d3432c4f4 WHIRLPOOL bf7a566aa3facbf1f40b0a6bec8761e522a4f57f691bf0822eb3d00d9ac4f670481e66902d2563faa9ccd91f910b78fb21585c1dd8511f99a0005e5e9c2181fa +AUX registry.initd 606 SHA256 67a0348c7bf794f1d94ab54dd5f381706f7c3baf05e012b8e84e1e4d2cb657e8 SHA512 af7780264d068adcd0d6a6768b88ab43c26081b71d1ebd591ca6d175e413cdeee935a6f50d9833775690f0b47daadcc33286f86fb5eb98d2e674b225122aabce WHIRLPOOL 64d70823ef1058e0b67f9bef1dac646358ef9ce71d358a3dbd6789644164cff085909824e1b4098893602b0ea0df09fed19795f9b02993a427d022f75165e49f +AUX registry.logrotated 89 SHA256 cf2ab1c85ee085d040eeba3d2ba4a7cfb365d4954846f8f39b89b05813875e6c SHA512 f824b33a1fa38802a8aa79599843b0ea065603799823352e9515c50bfc61c43a03e9eb5327f9c687b8c3864fc633ad1a46bff9e91f4c54a46a09e67d2f6f833b WHIRLPOOL eccdeba38a88fd3f02158dac71351f81f7aac0aa05179b68edbc5b1241b16c45f9f8cf4aa22e5707411845900bc0b73222918bcf22263e89f33193265e191766 +AUX registry.service 323 SHA256 b15b4a4ae356dc6a0a6c4e15803fdf3ac49c4e6cdb40ad33d6c4bf3bd72aebf1 SHA512 67d2b69c1fc497774e3171628fa73b9b9521e19c76414e32721994f2ba614bd3c6896c578c9d9b8af0ad4972b9da0c504ef787a7585a550be4bfe1bd40eafc15 WHIRLPOOL 39cf815d90720029cc36da53e4392fc1c53c9821638608061232004e3c7aea2af76e00969066c367843efcde6d06c7f695d23a3943905dcb97722e4bcad82ace +DIST docker-registry-2.6.2.tar.gz 1579760 SHA256 963e4e98a99f484c903b888e2661a10794e79906ccf9a6a9b17172f9c1705f0d SHA512 a091db2e15d7c1dc8cd39a40de5bb63cc1ead68e95dfaf6b3735a789adb87f146c03eff81f700e0059e5f6ffc43e6c3dd3358503697882cb080b991629f82c60 WHIRLPOOL 55f9e7cc5a643be1d791e6d19610db9a8a4c59f7c73ae105cce11917b12691418fa2d310103788d06d74c6bfc809d20de9f5e1a1ab4b3861062db93c8861158f +EBUILD docker-registry-2.6.2-r1.ebuild 1199 SHA256 ed183aaa319e210f4c982c2d7ea85621902c73eea93df3c1734588e62800b72d SHA512 1405e36c07065c0d6c75fc59548b64f5bc9e69726324e5e6f552be1790cdcf4057a78f6d770e3e1144c36b2edc1e483c1e455550785e263474942b676ac6f643 WHIRLPOOL 2f1d01fa6e9888b306beec7b7502aa24a10199267e4b85a5a6aacd68dd9012e1a9dbd70a6027374cbd8c6fded31b2ec7a283f61a0d5fb81443ee78d891b34106 +MISC ChangeLog 1414 SHA256 e4dbf7db259ff8702bf2dcbc1a87eab602fb2655d18a80195c167d5401fb0cfd SHA512 93166bbdae51629f5e1021a309eb343e21bd73beef2185dd847d1e64baf724e78a730b53e0959c39a066d25157727c2515c84e8e68f774649f6ef73686bc2fae WHIRLPOOL 21e46a678b3ed8569981076d1f2a6a7c18b0cd6ea1a918608d0d73f598400b689cb2268cd41a2ee7c1effbb117f81ac6990f70cadde9781334ee036dd27c6cd3 +MISC metadata.xml 310 SHA256 e13923aade2aab283eac035195dbd0aaebe94cd213df1047c2cb86c3fb2b318f SHA512 bcf043907e7e2ad9ef21a4b02b4aeb0f50bd17b1e5315653b2339036d4775bde661d711d4e84536f657c7bf9247ef446f1c95abdf14699620e44a104c9e1fe0a WHIRLPOOL 187d4035d324a441345e961cdc6e4d2b60dad168377f663893017bf84d9cc1e2ff2d762aa30686c4423286edd65dc58123ea569d37222cc3df169ad5f8824a59 diff --git a/app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild b/app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild new file mode 100644 index 000000000000..6ea2a86bd59b --- /dev/null +++ b/app-emulation/docker-registry/docker-registry-2.6.2-r1.ebuild @@ -0,0 +1,42 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +inherit golang-vcs-snapshot systemd user + +KEYWORDS="~amd64" +EGO_PN="github.com/docker/distribution" +EGIT_COMMIT="v${PV}" +SRC_URI="https://${EGO_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz" +DESCRIPTION="Docker Registry 2.0" +HOMEPAGE="https://github.com/docker/distribution" +LICENSE="Apache-2.0" +SLOT="0" +IUSE="" +SVCNAME=registry + +PATCHES=( "${FILESDIR}/${PN}-2.6.1-notifications-expvar.patch" ) + +pkg_setup() { + enewgroup ${SVCNAME} + enewuser ${SVCNAME} -1 -1 /dev/null ${SVCNAME} +} + +src_compile() { + GOPATH="${S}" \ + go install -v -work -x ${EGO_BUILD_FLAGS} "${EGO_PN}/..." || die +} + +src_install() { + exeinto /usr/libexec/${PN} + doexe bin/* + insinto /etc/docker/registry + newins src/${EGO_PN}/cmd/registry/config-example.yml config.yml.example + newinitd "${FILESDIR}/${SVCNAME}.initd" "${SVCNAME}" + newconfd "${FILESDIR}/${SVCNAME}.confd" "${SVCNAME}" + systemd_dounit "${FILESDIR}/${SVCNAME}.service" + keepdir /var/{lib,log}/${SVCNAME} + fowners ${SVCNAME}:${SVCNAME} /var/{lib,log}/${SVCNAME} + insinto /etc/logrotate.d + newins "${FILESDIR}/${SVCNAME}.logrotated" "${SVCNAME}" +} diff --git a/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch b/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch new file mode 100644 index 000000000000..1d40edf1f0cd --- /dev/null +++ b/app-emulation/docker-registry/files/docker-registry-2.6.1-notifications-expvar.patch @@ -0,0 +1,64 @@ +From 9a58c91051e03b46f1461e371a7bf527c1284612 Mon Sep 17 00:00:00 2001 +From: Noah Treuhaft +Date: Wed, 8 Feb 2017 11:38:44 -0800 +Subject: [PATCH] notifications: fix expvar for Go 1.7 + +Remove EndpointConfig.Transport from the return value of the +registry.notifications.endpoints expvar.Func. It results in an empty +value for that expvar variable under Go 1.7 because it is a non-nil +*http.Transport, which Go 1.7 can no longer encode as JSON. + +Signed-off-by: Noah Treuhaft +--- + notifications/endpoint.go | 2 +- + notifications/metrics_test.go | 28 ++++++++++++++++++++++++++++ + 2 files changed, 29 insertions(+), 1 deletion(-) + create mode 100644 notifications/metrics_test.go + +diff --git a/src/github.com/docker/distribution/notifications/endpoint.go b/src/github.com/docker/distribution/notifications/endpoint.go +index 29a9e27b5..44d0f6d7b 100644 +--- a/src/github.com/docker/distribution/notifications/endpoint.go ++++ b/src/github.com/docker/distribution/notifications/endpoint.go +@@ -13,7 +13,7 @@ type EndpointConfig struct { + Threshold int + Backoff time.Duration + IgnoredMediaTypes []string +- Transport *http.Transport ++ Transport *http.Transport `json:"-"` + } + + // defaults set any zero-valued fields to a reasonable default. +diff --git a/src/github.com/docker/distribution/notifications/metrics_test.go b/src/github.com/docker/distribution/notifications/metrics_test.go +new file mode 100644 +index 000000000..03a08e2c8 +--- /dev/null ++++ b/notifications/metrics_test.go +@@ -0,0 +1,28 @@ ++package notifications ++ ++import ( ++ "encoding/json" ++ "expvar" ++ "testing" ++) ++ ++func TestMetricsExpvar(t *testing.T) { ++ endpointsVar := expvar.Get("registry").(*expvar.Map).Get("notifications").(*expvar.Map).Get("endpoints") ++ ++ var v interface{} ++ if err := json.Unmarshal([]byte(endpointsVar.String()), &v); err != nil { ++ t.Fatalf("unexpected error unmarshaling endpoints: %v", err) ++ } ++ if v != nil { ++ t.Fatalf("expected nil, got %#v", v) ++ } ++ ++ NewEndpoint("x", "y", EndpointConfig{}) ++ ++ if err := json.Unmarshal([]byte(endpointsVar.String()), &v); err != nil { ++ t.Fatalf("unexpected error unmarshaling endpoints: %v", err) ++ } ++ if slice, ok := v.([]interface{}); !ok || len(slice) != 1 { ++ t.Logf("expected one-element []interface{}, got %#v", v) ++ } ++} diff --git a/app-emulation/docker-registry/files/registry.confd b/app-emulation/docker-registry/files/registry.confd new file mode 100644 index 000000000000..bfa97f127ef1 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.confd @@ -0,0 +1,2 @@ +# arguments for docker-registry +command_args="serve /etc/docker/registry/config.yml" diff --git a/app-emulation/docker-registry/files/registry.initd b/app-emulation/docker-registry/files/registry.initd new file mode 100644 index 000000000000..b81303c624d1 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.initd @@ -0,0 +1,19 @@ +#!/sbin/openrc-run +# Copyright 2016-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +description="Docker Registry 2.0" +pidfile=${pidfile:-"/run/${RC_SVCNAME}.pid"} +user=${user:-${RC_SVCNAME}} +group=${group:-${RC_SVCNAME}} + +command="/usr/libexec/docker-${RC_SVCNAME}/${RC_SVCNAME}" +command_args="${command_args:-serve /etc/docker/registry/config.yml}" +command_background="true" +start_stop_daemon_args="--user ${user} --group ${group} \ + --stdout /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log \ + --stderr /var/log/${RC_SVCNAME}/${RC_SVCNAME}.log" + +depend() { + need net +} diff --git a/app-emulation/docker-registry/files/registry.logrotated b/app-emulation/docker-registry/files/registry.logrotated new file mode 100644 index 000000000000..3cb63f949a08 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.logrotated @@ -0,0 +1,7 @@ +/var/log/registry/registry.log { + missingok + size 5M + rotate 3 + compress + copytruncate +} diff --git a/app-emulation/docker-registry/files/registry.service b/app-emulation/docker-registry/files/registry.service new file mode 100644 index 000000000000..14ff5f9c0b77 --- /dev/null +++ b/app-emulation/docker-registry/files/registry.service @@ -0,0 +1,13 @@ +[Unit] +Description=Docker Registry 2.0 +Requires=network-online.target +After=network-online.target + +[Service] +User=registry +PrivateDevices=Yes +Environment="DOCKER_REGISTRY_ARGS=serve /etc/docker/registry/config.yml" +ExecStart=/usr/libexec/docker-registry/registry $DOCKER_REGISTRY_ARGS + +[Install] +WantedBy=multi-user.target diff --git a/app-emulation/docker-registry/metadata.xml b/app-emulation/docker-registry/metadata.xml new file mode 100644 index 000000000000..4f66ba32a890 --- /dev/null +++ b/app-emulation/docker-registry/metadata.xml @@ -0,0 +1,10 @@ + + + + + zmedico@gentoo.org + + + docker/distribution + + -- cgit v1.2.3