Gentoo Archives: gentoo-commits

From: "Manuel Rüger" <mrueg@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: app-emulation/reg/files/, app-emulation/reg/
Date: Mon, 06 Aug 2018 17:40:39
Message-Id: 1533577211.50e6b0f5b4bcc233723fb8a24de376dbda7b10cb.mrueg@gentoo
1 commit: 50e6b0f5b4bcc233723fb8a24de376dbda7b10cb
2 Author: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
3 AuthorDate: Mon Aug 6 14:27:22 2018 +0000
4 Commit: Manuel Rüger <mrueg <AT> gentoo <DOT> org>
5 CommitDate: Mon Aug 6 17:40:11 2018 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=50e6b0f5
7
8 app-emulation/reg: Include patch to set listen addr
9
10 Package-Manager: Portage-2.3.44, Repoman-2.3.10
11
12 .../reg/files/reg-0.15.4-listen-addr.patch | 47 ++++++++++++++++++++
13 app-emulation/reg/reg-0.15.4-r2.ebuild | 50 ++++++++++++++++++++++
14 2 files changed, 97 insertions(+)
15
16 diff --git a/app-emulation/reg/files/reg-0.15.4-listen-addr.patch b/app-emulation/reg/files/reg-0.15.4-listen-addr.patch
17 new file mode 100644
18 index 00000000000..21f2759e5b8
19 --- /dev/null
20 +++ b/app-emulation/reg/files/reg-0.15.4-listen-addr.patch
21 @@ -0,0 +1,47 @@
22 +From b3c826e2e48108d832cbe9fc3b630e7ff207915a Mon Sep 17 00:00:00 2001
23 +From: =?UTF-8?q?Manuel=20R=C3=BCger?= <manuel@××××.eu>
24 +Date: Wed, 18 Jul 2018 19:47:12 +0200
25 +Subject: [PATCH] server: Allow to restrict listen address (#115)
26 +
27 +e.g. limit to listen on localhost only
28 +---
29 + server.go | 12 +++++++-----
30 + 2 files changed, 8 insertions(+), 5 deletions(-)
31 +
32 +diff --git a/server.go b/server.go
33 +index 8866efed..a7cc2048 100644
34 +--- a/server.go
35 ++++ b/server.go
36 +@@ -35,6 +35,7 @@ func (cmd *serverCommand) Register(fs *flag.FlagSet) {
37 +
38 + fs.StringVar(&cmd.cert, "cert", "", "path to ssl cert")
39 + fs.StringVar(&cmd.key, "key", "", "path to ssl key")
40 ++ fs.StringVar(&cmd.listenAddress, "listen-address", "", "address to listen on")
41 + fs.StringVar(&cmd.port, "port", "8080", "port for server to run on")
42 + fs.StringVar(&cmd.assetPath, "asset-path", "", "Path to assets and templates")
43 +
44 +@@ -48,10 +49,11 @@ type serverCommand struct {
45 +
46 + generateAndExit bool
47 +
48 +- cert string
49 +- key string
50 +- port string
51 +- assetPath string
52 ++ cert string
53 ++ key string
54 ++ listenAddress string
55 ++ port string
56 ++ assetPath string
57 + }
58 +
59 + func (cmd *serverCommand) Run(ctx context.Context, args []string) error {
60 +@@ -180,7 +182,7 @@ func (cmd *serverCommand) Run(ctx context.Context, args []string) error {
61 +
62 + // Set up the server.
63 + server := &http.Server{
64 +- Addr: ":" + cmd.port,
65 ++ Addr: cmd.listenAddress + ":" + cmd.port,
66 + Handler: mux,
67 + }
68 + logrus.Infof("Starting server on port %q", cmd.port)
69
70 diff --git a/app-emulation/reg/reg-0.15.4-r2.ebuild b/app-emulation/reg/reg-0.15.4-r2.ebuild
71 new file mode 100644
72 index 00000000000..1bebb08c1e9
73 --- /dev/null
74 +++ b/app-emulation/reg/reg-0.15.4-r2.ebuild
75 @@ -0,0 +1,50 @@
76 +# Copyright 1999-2018 Gentoo Foundation
77 +# Distributed under the terms of the GNU General Public License v2
78 +
79 +EAPI=6
80 +inherit golang-build golang-vcs-snapshot user
81 +
82 +EGO_PN="github.com/genuinetools/reg"
83 +GIT_COMMIT="8c930c585418564a4ce472fbbfccb8c5741c2520"
84 +ARCHIVE_URI="https://${EGO_PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
85 +KEYWORDS="~amd64"
86 +
87 +DESCRIPTION="Docker registry v2 command line client"
88 +HOMEPAGE="https://github.com/genuinetools/reg"
89 +SRC_URI="${ARCHIVE_URI}"
90 +LICENSE="MIT"
91 +SLOT="0"
92 +IUSE=""
93 +
94 +RESTRICT="test"
95 +
96 +PATCHES=( "${FILESDIR}"/${P}-listen-addr.patch )
97 +
98 +pkg_setup() {
99 + enewgroup reg
100 + enewuser reg -1 -1 /var/lib/reg reg
101 +}
102 +
103 +src_prepare() {
104 + pushd src/${EGO_PN} || die
105 + default
106 + popd || die
107 +}
108 +
109 +src_compile() {
110 + pushd src/${EGO_PN} || die
111 + GOPATH="${S}" go build -v -ldflags "-X ${EGO_PN}/version.GITCOMMIT=${GIT_COMMIT} -X ${EGO_PN}/version.VERSION=${PV}" -o "${S}"/bin/reg . || die
112 + popd || die
113 +}
114 +
115 +src_install() {
116 + dobin bin/*
117 + dodoc src/${EGO_PN}/README.md
118 + insinto /var/lib/${PN}
119 + doins -r src/${EGO_PN}/server/*
120 + newinitd "${FILESDIR}"/reg.initd reg
121 + newconfd "${FILESDIR}"/reg.confd reg
122 +
123 + keepdir /var/log/reg
124 + fowners -R reg:reg /var/log/reg /var/lib/reg/static
125 +}