commit:     0c626c6625208d815bb9c86256424bec1b10b842
Author:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
AuthorDate: Sun Nov  4 12:00:16 2018 +0000
Commit:     Pacho Ramos <pacho <AT> gentoo <DOT> org>
CommitDate: Sun Nov  4 12:33:51 2018 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0c626c66

net-proxy/http-replicator: Fix ipv6 support

Thanks-to: spock128 <AT> gmail.com
Closes: https://bugs.gentoo.org/669078
Signed-off-by: Pacho Ramos <pacho <AT> gentoo.org>
Package-Manager: Portage-2.3.51, Repoman-2.3.11

 .../files/http-replicator-4.0_alpha2-ipv6.patch    | 68 +++++++++++++++++++
 .../http-replicator-4.0_alpha2-r7.ebuild           | 78 ++++++++++++++++++++++
 2 files changed, 146 insertions(+)

diff --git 
a/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-ipv6.patch 
b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-ipv6.patch
new file mode 100644
index 00000000000..906844fd958
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-ipv6.patch
@@ -0,0 +1,68 @@
+diff -ur a/fiber.py b/fiber.py
+--- a/fiber.py 2018-10-27 12:52:10.536264605 -0400
++++ b/fiber.py 2018-10-27 12:57:26.688730570 -0400
+@@ -180,10 +180,10 @@
+   os.dup2( nul.fileno(), sys.stdin.fileno()  )
+ 
+ 
+-def spawn( generator, port, debug, log, pidfile ):
++def spawn( generator, port, debug, log, pidfile, listenfamily ):
+ 
+   try:
+-    listener = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
++    listener = socket.socket( listenfamily, socket.SOCK_STREAM )
+     listener.setblocking( 0 )
+     listener.setsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR, 
listener.getsockopt( socket.SOL_SOCKET, socket.SO_REUSEADDR ) | 1 )
+     listener.bind( ( '', port ) )
+diff -ur a/http-replicator b/http-replicator
+--- a/http-replicator  2018-10-27 12:52:10.542931816 -0400
++++ b/http-replicator  2018-10-27 12:59:36.345978943 -0400
+@@ -9,7 +9,7 @@
+ 
+ def Replicator( client, address ):
+ 
+-  print 'Accepted request from %s:%i' % address
++  print 'Accepted request from [%s]:%i' % address[0:2]
+ 
+   request = Request.HttpRequest()
+   while not request.Protocol:
+@@ -60,4 +60,4 @@
+   print 'Transaction successfully completed'
+ 
+ 
+-fiber.spawn( Replicator, Params.PORT, Params.DEBUG, Params.LOG, 
Params.PIDFILE )
++fiber.spawn( Replicator, Params.PORT, Params.DEBUG, Params.LOG, 
Params.PIDFILE, Params.LISTENFAMILY )
+diff -ur a/Params.py b/Params.py
+--- a/Params.py        2018-10-27 12:52:10.549599026 -0400
++++ b/Params.py        2018-10-27 12:55:31.772685822 -0400
+@@ -9,6 +9,7 @@
+ TIMEOUT = 15
+ PIDFILE = False
+ FAMILY = socket.AF_INET
++LISTENFAMILY = socket.AF_INET
+ FLAT = False
+ STATIC = False
+ ONLINE = True
+@@ -63,6 +64,7 @@
+       sys.exit( 'Error: %s requires a positive numerical argument' % _arg )
+   elif _arg in ( '-6', '--ipv6' ):
+     FAMILY = socket.AF_UNSPEC
++    LISTENFAMILY = socket.AF_INET6
+   elif _arg == '--flat':
+     FLAT = True
+   elif _arg == '--static':
+diff --git a/Protocol.py b/Protocol.py
+--- a/Protocol.py
++++ b/Protocol.py
+@@ -13,7 +13,7 @@ def connect( addr ):
+ 
+   family, socktype, proto, canonname, sockaddr = DNSCache[ addr ][ 0 ]
+ 
+-  print 'Connecting to %s:%i' % sockaddr
++  print 'Connecting to [%s]:%i' % sockaddr[0:2]
+   sock = socket.socket( family, socktype, proto )
+   sock.setblocking( 0 )
+   sock.connect_ex( sockaddr )
+-- 
+2.18.1
+

diff --git a/net-proxy/http-replicator/http-replicator-4.0_alpha2-r7.ebuild 
b/net-proxy/http-replicator/http-replicator-4.0_alpha2-r7.ebuild
new file mode 100644
index 00000000000..d1b5659c554
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-4.0_alpha2-r7.ebuild
@@ -0,0 +1,78 @@
+# Copyright 1999-2018 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+PYTHON_COMPAT=( python2_7 )
+
+inherit python-r1 readme.gentoo-r1 systemd
+
+MY_P="${PN}_${PV/_/}"
+
+DESCRIPTION="Proxy cache for Gentoo packages"
+HOMEPAGE="https://sourceforge.net/projects/http-replicator";
+SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tgz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
+IUSE=""
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}
+       sys-apps/portage[${PYTHON_USEDEP}]
+"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+# Tests downloads files as well as breaks, should be turned into local tests.
+RESTRICT="test"
+
+DISABLE_AUTOFORMATTING="yes"
+DOC_CONTENTS="
+Before starting ${PN}, please follow the next few steps:
+
+- Modify /etc/conf.d/${PN} if required.
+- Run \`repcacheman\` to set up the cache.
+- Add HTTP_PROXY=\"http://serveraddress:8080\"; to make.conf on
+the server as well as on the client machines.
+- Make sure GENTOO_MIRRORS in /etc/portage/make.conf
+starts with several good HTTP mirrors.
+
+For more information please refer to the following forum thread:
+https://forums.gentoo.org/viewtopic-t-173226.html
+
+Starting with 4.x releases, the conf.d parameters have changed.
+"
+
+PATCHES=(
+       "${FILESDIR}"/${PN}-4.0_alpha2-r3-pid.patch
+       "${FILESDIR}"/${PN}-4.0_alpha2-ipv6.patch #669078
+)
+
+src_test() {
+       ./unit-test && die
+}
+
+src_install() {
+       python_foreach_impl python_doscript http-replicator
+
+       newbin "${FILESDIR}"/${PN}-3.0-callrepcacheman-0.1 repcacheman
+
+       python_foreach_impl python_domodule *.py
+
+       python_foreach_impl python_newscript 
"${FILESDIR}"/${PN}-3.0-repcacheman-0.44-r2 repcacheman.py
+
+       newinitd "${FILESDIR}"/${PN}-4.0_alpha2-r3.init http-replicator
+       newconfd "${FILESDIR}"/${PN}-4.0_alpha2-r2.conf http-replicator
+
+       systemd_dounit "${FILESDIR}"/http-replicator.service
+       systemd_install_serviced "${FILESDIR}"/http-replicator.service.conf
+
+       dodoc README.user README.devel RELNOTES
+       readme.gentoo_create_doc
+}
+
+pkg_postinst() {
+       readme.gentoo_print_elog
+}

Reply via email to