public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Manuel Rüger" <mrueg@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/
Date: Fri, 19 May 2017 14:48:24 +0000 (UTC)	[thread overview]
Message-ID: <1495205279.21eba0700591adc9435adc2b75bbdddddbf98915.mrueg@gentoo> (raw)

commit:     21eba0700591adc9435adc2b75bbdddddbf98915
Author:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
AuthorDate: Fri May 19 14:47:59 2017 +0000
Commit:     Manuel Rüger <mrueg <AT> gentoo <DOT> org>
CommitDate: Fri May 19 14:47:59 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21eba070

app-emulation/docker-registry: Include patch to fix json in notifications endpoint

Package-Manager: Portage-2.3.5, Repoman-2.3.2

 .../docker-registry-2.6.1-r1.ebuild                | 42 ++++++++++++++
 ...ocker-registry-2.6.1-notifications-expvar.patch | 64 ++++++++++++++++++++++
 2 files changed, 106 insertions(+)

diff --git a/app-emulation/docker-registry/docker-registry-2.6.1-r1.ebuild b/app-emulation/docker-registry/docker-registry-2.6.1-r1.ebuild
new file mode 100644
index 00000000000..45aac739ef0
--- /dev/null
+++ b/app-emulation/docker-registry/docker-registry-2.6.1-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}/${P}-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 00000000000..1d40edf1f0c
--- /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 <noah.treuhaft@docker.com>
+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 <noah.treuhaft@docker.com>
+---
+ 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)
++	}
++}


             reply	other threads:[~2017-05-19 14:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-19 14:48 Manuel Rüger [this message]
  -- strict thread matches above, loose matches on Subject: below --
2018-12-14 16:49 [gentoo-commits] repo/gentoo:master commit in: app-emulation/docker-registry/, app-emulation/docker-registry/files/ Manuel Rüger
2017-09-01 22:13 Zac Medico
2016-04-25  9:07 Zac Medico

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495205279.21eba0700591adc9435adc2b75bbdddddbf98915.mrueg@gentoo \
    --to=mrueg@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox