summaryrefslogtreecommitdiff
path: root/net-proxy/http-replicator
diff options
context:
space:
mode:
Diffstat (limited to 'net-proxy/http-replicator')
-rw-r--r--net-proxy/http-replicator/Manifest7
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch51
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch31
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch20
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3.0.conf46
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3.0.init20
-rw-r--r--net-proxy/http-replicator/http-replicator-3.0-r8.ebuild93
7 files changed, 268 insertions, 0 deletions
diff --git a/net-proxy/http-replicator/Manifest b/net-proxy/http-replicator/Manifest
index 4dc74aabb5cd..e9d7d1636578 100644
--- a/net-proxy/http-replicator/Manifest
+++ b/net-proxy/http-replicator/Manifest
@@ -1,11 +1,18 @@
+AUX http-replicator-3-missing-directory.patch 1776 BLAKE2B 66b3b0190512b77a62487f8a2828a46de8af27bce4393d14152de3542a4e9eac61855d2d9e5da196f7f4271a9432cc2b8bb599215d7fdc2012ce0c498dcca346 SHA512 8c4d9f563bb73ee2b237fadc7c062c8cfbc1510c9f7fc597974fbc727f61fffc9b3d79285904fcac755dc12c7603d7d4efd1d25978df6ddfc797b44c6c17570b
+AUX http-replicator-3-unique-cache-name.patch 1195 BLAKE2B c988c7f5f2beaa480ca01a46bc6f28a8158d975b8951c8373be23b64d12a3c141c0d87bd603439ae21788c64f315c64b1b313f36907ddfa890cf54540e294445 SHA512 c1fd6d4c5e7dee1e58b6289dee5b7aa97c577ccf0099b02dc99b6a80a64b25f5e2f5321563fac9fa86beeb51b77edce321b9997144a0bf23104560577b857291
AUX http-replicator-3.0-callrepcacheman-0.1 86 BLAKE2B 70095254d21cdbf403cc81998c879b80fa6df52c8a4e8be677dfa1960d0faa044eadfc44948c699d5dcec1a481275a8c5527f600e322a8b06dcd63531654a2a2 SHA512 144490fd854e22fce95e6a6891a3e65e8af001b5e421bec39b20ee4cf39709424a922f7852bf48ecf43b5b9755213e7149a2a3784bbc3a3e5542072d8d3bda3d
AUX http-replicator-3.0-repcacheman-0.44-r2 5337 BLAKE2B 3b6c8b16b34cb3ef9b98408cb0272aa2fec51b87d011dc9de7014e6d7fc5e995343a7447ca79a8b951544a642e38d685ec0ac7f0137a1975780686a6e4a62791 SHA512 c917d47327a55699deb346e53aef1ba9a5eda81f6947ac4efe8422422a2cba668a3ed12c0f89bf840e4ad94dd6272b3d6eb705d1e78e58ddef90b21307ff8d15
+AUX http-replicator-3.0-sighup.patch 993 BLAKE2B 82709484ea1f5e63ae5eb883339f4561f7ed05625453c18c8d74207c8ea33b5a6bcc6aab69b9e1e8fd86e2d49e4b4d94fe0a438f1939cc34e6ec60543894e43c SHA512 25da23acd8c235f2b0dbe2f424a92a161d3f4e96e5bea67973004c7bb0642640b73d528b1675174a611bef35f34cc18de08d78c3464cb6080f4f44f833173aee
+AUX http-replicator-3.0.conf 1704 BLAKE2B d496ff21d492ca89fdfb64467de902481fe2c7bbec96227cac6ade3dd05850c74875062058dba491778fb06409b396cad7e4876106cc521bc642268976129479 SHA512 c56031c303f79a44a006781b3796abaae24f1b8ea368eb0436a7ada8defe0f92382649098aef7c41372bfbf1889a17468af201669756912e0c55985c5981fb4c
+AUX http-replicator-3.0.init 620 BLAKE2B 48e44e912233e58e598d9c041e6f1ad4bea48fb67cceb41ae13c008067e28bef2b4a6c35205b0f274c5124a54d48fb32f3334e12716b33c0bf2a29c1c5bc84f8 SHA512 e69143963155cdc03874b51dc0eef8a46bee3d7828bf20bdb50b4ea9ea6bb2e4fd705e1d9ee4864e53488e4035aa91ebd47f02a597bfa1ee6d5b7121ac5fd68d
AUX http-replicator-4.0_alpha2-ipv6.patch 2266 BLAKE2B c5f7f87346adc5c237eb34a7cb1497eac2de58388c296eaf00d80a02f0d0bd34619e0044fb4674065e43489461d506c76dc52b04b80c1be2ea92a52b21eed4eb SHA512 70793ee864630156cd25453c2bae4c1bde40b7378d938f45e39b94e8ac8fa1e7a779d6535fbe3a5a5f1b44a4297c6910ac51ce4cb80321f96d26a08559b1f22e
AUX http-replicator-4.0_alpha2-r2.conf 1440 BLAKE2B 1ab4c03ff638ec90c6c29884713522c4b7f2092618752309e66ae93d4e7955e09bb9f9941e87d6b14223f7b27edb0cb8c29510ce259437719099d3ad11cb1e29 SHA512 e6237c8b7eeb319615d45abdef4feaca6bbeb741bc75e80173e42328e4eb5f4192edfbf42c7e6e307c14d258e7ec67a0ae6451ff7daef631b2d1e39fe17a48fb
AUX http-replicator-4.0_alpha2-r3-pid.patch 2681 BLAKE2B 4ae5e263c5476f402dde1bcb2f1b668e648611c46a785bbdeb58dfc75abab4ddabf95783848eb20c3d447448b1c9c5aa210601669de2a4926aba9ff08ee04103 SHA512 9ceb6ede3ec31fd7f702ac77a51897301fd7b16baee869a82180f388949ff7388f0917d667786b45643603c0e9d655cd8686948d5e34896c1fe5932fd76e42b5
AUX http-replicator-4.0_alpha2-r3.init 644 BLAKE2B cf017fcd078532960e16e4c9735ab4df62d65794ac961798ffd39760fb860199d87322e0792ec759f48d2e9ddaa3134bbc52d9ed39c6d4f564b981d6873cdb72 SHA512 b1a8bd956d35cc536b835aac6cb82202f0b6b775d7eae81ac30f501d1c72877d093711e0f00a28eb7645a383e211d3196379b37da1e0421773c1b91ed6d3837b
AUX http-replicator.service 258 BLAKE2B 15b50f430e58794115060e37350c5e6cc18225a0fbe27b07fc71a12979e3420cf5029554ee031bed8762af883a165d2b27f3f1c661124410569231fe16437102 SHA512 0da767205c21c226563eb2210a12d92d7933431245fad9bf8766eda59b1f4a16905cadcfb796b3aef86978eb06b153eb976b12f4f7e19d468654c1722e266352
AUX http-replicator.service.conf 164 BLAKE2B 28006ec4c4b27eb1f75276432e30c0f9b33cb432ea0123794db0b25c5f36d4fd9f771c23d6852b8e061a9d30ab0ed2b86b42b0cdf3d8b2f29be0ac6cf4276c35 SHA512 0a1854ddb9f5b8631bdf6a837f1c91b895652803b3e1b6b98fba8f67dba0488a61f8864ddd4128d8072353a38349d9848e91a5109b317c37e1ca2598d0ac2333
+DIST http-replicator_3.0.tar.gz 39291 BLAKE2B a97d8b6b32f5d4ca4feefa9abaa7da7cb6570f76566c79d7371134c0edd74b2333a02480deff02fa1bf5b6cd6f2bfbfe4aaa649633d70bd2efbdd22701422651 SHA512 d98a608c38201db6f2d8ba809a4777ab5588f5ed395882bdf542c2788df1770c61a2de160604c09297d847f2c73463ba0530d7f2c2e482467f8e8f35be068d57
DIST http-replicator_4.0alpha2.tgz 27575 BLAKE2B 48138bc8fa9695ddb31ce89c4638adda4a1d1b58c904cd98d0ee1dbab006f79ef7d19495db8eb4de0113f8e45da425950524c48ec9e3e864d8595ccdef9f7cfa SHA512 437e0cc881af0cb8f84bfd1366bb6edeee4f76112c4b2ac2af4bcb8809462852b96e9c99e04c8f370492c9e1eb33ddc68a85c4f09b073694242cd6c05b4d3a6c
+EBUILD http-replicator-3.0-r8.ebuild 3440 BLAKE2B b248cb96be039e50c74700c71432255868e909947f3b574181e0f60bc504d390e25492aee3b6b6b3ec8c893a12b67e66102aa9e3eaec1c54f093919852aac177 SHA512 566f524981543de73a1b9f878b49a547b41b618130a950ba7b92b12590eb191fc79468d23fd659f414dd0fdabf1f1b0aff9b873b88a0686cb1fef231f463acb4
EBUILD http-replicator-4.0_alpha2-r7.ebuild 2043 BLAKE2B cbd3074454afce3164e8ee2fc81a8af29c9b991ea8c3098a2f2fa482165e3dac4bcc9745e07fd6c55361c8c0294d00d0f0f1f1d91516b4cdad29a0db0c6fa705 SHA512 16231c53131e94f63fe401acfb155354e83313895dc0596ab5d945f8f6fac6fbbb57bd257db0763e9a285afb5cc5ca8149e4c10f6a570f9e3688862b2f95f385
MISC metadata.xml 252 BLAKE2B 5386635b038f2498cadf1730fa7ae823427900b961296f4acca678ea12eb7c66ed7ad6cbca15afd26042c7af8d687958c702a9c48fc00856b460e2b49e55b2ac SHA512 ffd7c4cd77545f753618c9e9cfeba05b557044879ce332c01deaad820e184329cf383c8488ba777e9653029d3f75e5c99936ca225ebc4a5fb9b4d4e257ba8e7d
diff --git a/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch b/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch
new file mode 100644
index 000000000000..37c2ce2361f3
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3-missing-directory.patch
@@ -0,0 +1,51 @@
+Author: Matthew Ogilvie
+Date: Sat Jan 17 09:24:34 2015 -0700
+
+ add some suggestions to the missing-directory error message
+
+ Also wait until directory confirmed before forking.
+
+ See gentoo bug 502574 and bug 442874
+
+diff --git a/http-replicator b/http-replicator
+index bbc163c..81e254d 100755
+--- a/http-replicator
++++ b/http-replicator
+@@ -636,13 +636,6 @@ def main ():
+ parser.error('user %r does not exist' % options.user)
+ except OSError:
+ parser.error('no permission for changing to user %r' % options.user)
+- pid = os.fork() # fork process
+- if pid: # parent process
+- pidfile.write(str(pid)) # store child's pid
+- pidfile.close()
+- return
+- else:
+- signal.signal(signal.SIGHUP, signal.SIG_IGN)
+ else:
+ handler = logging.StreamHandler(sys.stdout) # log to stdout
+ handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s'))
+@@ -651,10 +644,22 @@ def main ():
+ try:
+ os.chdir(options.dir) # change to cache directory
+ except OSError:
+- parser.error('invalid directory %r' % options.dir)
++ parser.error('invalid directory %r\n' \
++ 'Try running repcacheman, and/or see\n' \
++ 'http://forums.gentoo.org/viewtopic-t-173226.html' \
++ % options.dir)
+ if not os.access(os.curdir, os.R_OK | os.W_OK): # check permissions for cache directory
+ parser.error('no read/write permission for directory %r' % options.dir)
+
++ if options.daemon:
++ pid = os.fork() # fork process
++ if pid: # parent process
++ pidfile.write(str(pid)) # store child's pid
++ pidfile.close()
++ return
++ else:
++ signal.signal(signal.SIGHUP, signal.SIG_IGN)
++
+ sys.stdout = sys.stderr = open('/dev/null', 'w') # redirect all output to bit bucket
+ logging.root.name = 'HttpReplicator'
+ try:
diff --git a/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch b/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch
new file mode 100644
index 000000000000..3ad0529ed16a
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3-unique-cache-name.patch
@@ -0,0 +1,31 @@
+Author: Matthew Ogilvie
+Date: Sun Dec 28 20:14:15 2014 -0700
+
+ honor x-unique-cache-name header in flat mode, if present
+
+ This allows things like different versions of the adobe-flash
+ downloader that are given different names in a flat download
+ directory (like in gentoo) to work in an http-replicator cache
+ as well. As long as the fetcher passes the custom name through
+ the experimental header...
+
+ See gentoo bug # 442874
+
+diff --git a/http-replicator b/http-replicator
+index 19ae427..befe9f2 100755
+--- a/http-replicator
++++ b/http-replicator
+@@ -311,7 +311,12 @@ class HttpClient (Http):
+ self.log.info('requested range: bytes %s to %s' % self.range) # log request
+
+ head = ''
+- for tail in self.path.split('/'): # iterate over items in path
++ adjUrlPath = self.path
++ if not self.direct and self.flat:
++ uniqueCacheName = body.get('x-unique-cache-name')
++ if uniqueCacheName:
++ adjUrlPath = uniqueCacheName
++ for tail in adjUrlPath.split('/'): # iterate over items in path
+ head = os.path.join(head, tail) # build target path
+ if head in self.alias: # path up till now hos an alias
+ head = self.alias[head] # replace by alias
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch b/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch
new file mode 100644
index 000000000000..969bbc91f9da
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-sighup.patch
@@ -0,0 +1,20 @@
+--- a/http-replicator 2007-07-09 20:09:44.000000000 +0200
++++ b/http-replicator 2007-07-09 20:11:48.433913445 +0200
+@@ -5,7 +5,7 @@
+ # Because of this the server runs as a single process, multiplexing I/O with its various client and server connections within a single process/thread.
+ # According to the readme <http://www.nightmare.com/medusa/README.html> this means it is capable of smoother and higher performance than most other servers, while placing a dramatically reduced load on the server machine.
+
+-import asyncore, socket, os, time, calendar, sys, re, optparse, logging
++import asyncore, socket, os, time, calendar, sys, re, optparse, logging, signal
+
+ # LISTENER
+ #
+@@ -636,6 +636,8 @@
+ pidfile.write(str(pid)) # store child's pid
+ pidfile.close()
+ return
++ else:
++ signal.signal(signal.SIGHUP, signal.SIG_IGN)
+ else:
+ handler = logging.StreamHandler(sys.stdout) # log to stdout
+ handler.setFormatter(logging.Formatter('%(levelname)s: %(name)s %(message)s'))
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0.conf b/net-proxy/http-replicator/files/http-replicator-3.0.conf
new file mode 100644
index 000000000000..35671fd262c0
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0.conf
@@ -0,0 +1,46 @@
+## Config file for http-replicator
+## sourced by init scripts automatically
+## GENERAL_OPTS used by repcacheman
+## DAEMON_OPTS used by http-replicator
+
+
+## Set the cache dir
+GENERAL_OPTS="--dir /var/cache/http-replicator"
+
+## Change UID/GID to user after opening the log and pid file.
+## 'user' must have read/write access to cache dir:
+GENERAL_OPTS="$GENERAL_OPTS --user portage"
+
+## Don't change or comment this out:
+DAEMON_OPTS="$GENERAL_OPTS"
+
+## Do you need a proxy to reach the internet?
+## This will forward requests to an external proxy server:
+## Use one of the following, not both:
+#DAEMON_OPTS="$DAEMON_OPTS --external somehost:1234"
+#DAEMON_OPTS="$DAEMON_OPTS --external username:password@host:port"
+
+## Local dir to serve clients. Great for serving binary packages
+## See PKDIR and PORTAGE_BINHOST settings in 'man make.conf'
+## --alias /path/to/serve:location will make /path/to/serve
+## browsable at http://http-replicator.com:port/location
+DAEMON_OPTS="$DAEMON_OPTS --alias /usr/portage/packages:packages"
+
+## Dir to hold the log file:
+DAEMON_OPTS="$DAEMON_OPTS --log /var/log/http-replicator.log"
+
+## Make the log messages less and less verbose.
+## Up to four times to make it extremely quiet.
+#DAEMON_OPTS="$DAEMON_OPTS --quiet"
+#DAEMON_OPTS="$DAEMON_OPTS --quiet"
+
+## Make the log messages extra verbose for debugging.
+#DAEMON_OPTS="$DAEMON_OPTS --debug"
+
+## The ip addresses from which access is allowed. Can be used as many times
+## as necessary. Access from localhost is allowed by default.
+DAEMON_OPTS="$DAEMON_OPTS --ip 192.168.*.*"
+DAEMON_OPTS="$DAEMON_OPTS --ip 10.*.*.*"
+
+## The proxy port on which the server listens for http requests:
+DAEMON_OPTS="$DAEMON_OPTS --port 8080"
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0.init b/net-proxy/http-replicator/files/http-replicator-3.0.init
new file mode 100644
index 000000000000..7fc3d5e108da
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0.init
@@ -0,0 +1,20 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+depend() {
+ need net
+}
+
+start() {
+ ebegin "Starting Http-Replicator"
+ start-stop-daemon --start --pidfile /var/run/http-replicator.pid --name http-replicator \
+ --exec /usr/bin/http-replicator -- -s -f --pid /var/run/http-replicator.pid --daemon $DAEMON_OPTS
+ eend $? "Failed to start Http-Replicator"
+}
+
+stop() {
+ ebegin "Stopping Http-Replicator"
+ start-stop-daemon --stop --pidfile /var/run/http-replicator.pid --name http-replicator --signal 2
+ eend $? "Failed to stop Http-Replicator"
+}
diff --git a/net-proxy/http-replicator/http-replicator-3.0-r8.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r8.ebuild
new file mode 100644
index 000000000000..28f535c83dca
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-3.0-r8.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python2_7 ) # not 2.6 bug #33907, not 3.0 bug #411083
+
+inherit eutils python-single-r1 systemd
+
+MY_P="${PN}_${PV}"
+
+DESCRIPTION="Proxy cache for Gentoo packages"
+HOMEPAGE="https://sourceforge.net/projects/http-replicator"
+SRC_URI="mirror://sourceforge/http-replicator/${MY_P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 hppa ppc ~sparc x86"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=(
+ "${FILESDIR}/http-replicator-3.0-sighup.patch"
+ "${FILESDIR}/http-replicator-3-unique-cache-name.patch"
+ "${FILESDIR}/http-replicator-3-missing-directory.patch"
+)
+
+pkg_setup() {
+ python-single-r1_pkg_setup
+}
+
+src_install() {
+ # Daemon and repcacheman into /usr/bin
+ python_scriptinto /usr/bin
+ python_doscript http-replicator
+ python_newscript "${FILESDIR}/http-replicator-3.0-repcacheman-0.44-r2" repcacheman.py
+
+ exeinto /usr/bin
+ newexe "${FILESDIR}/http-replicator-3.0-callrepcacheman-0.1" repcacheman
+
+ # init.d scripts
+ newinitd "${FILESDIR}/http-replicator-3.0.init" http-replicator
+ newconfd "${FILESDIR}/http-replicator-3.0.conf" http-replicator
+
+ systemd_dounit "${FILESDIR}"/http-replicator.service
+ systemd_install_serviced "${FILESDIR}"/http-replicator.service.conf
+
+ # Docs
+ dodoc README debian/changelog
+
+ # Man Page - Not Gentooified yet
+ doman http-replicator.1
+
+ insinto /etc/logrotate.d
+ newins debian/logrotate http-replicator
+}
+
+pkg_postinst() {
+ elog
+ ewarn "Before starting http-replicator, please follow the next few steps:"
+ elog "- Modify /etc/conf.d/http-replicator if required."
+ ewarn "- Run /usr/bin/repcacheman to set up the cache."
+ elog "- Add http_proxy=\"http://serveraddress:8080\" to make.conf on"
+ elog " the server as well as on the client machines."
+ elog "- Make sure FETCHCOMMAND adds the X-unique-cache-name header to"
+ elog " HTTP requests in make.conf (or maybe portage will add it to"
+ elog " the default make.globals someday). Example:"
+ elog ' FETCHCOMMAND="wget -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" --header=\"X-unique-cache-name: \${FILE}\" \"\${URI}\""'
+ elog ' RESUMECOMMAND="wget -c -t 3 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" --header=\"X-unique-cache-name: \${FILE}\" \"\${URI}\""'
+ elog "- Arrange to periodically run repcacheman on this server,"
+ elog " to clean up the local /usr/portage/distfiles directory."
+ elog "- Arrange to periodically run something like the following"
+ elog " on this server. 'eclean' is in app-portage/gentoolkit."
+ elog " ( export DISTDIR=/var/cache/http-replicator/"
+ elog " eclean -i distfiles )"
+ elog "- Even with FETCHCOMMAND fixing most cases, occasionally"
+ elog " an older invalid version of a file may end up in the cache,"
+ elog " causing checksum failures when portage tries to fetch"
+ elog " it. To recover, either use eclean (above), manually delete"
+ elog " the relevant file from the cache, or temporarily comment"
+ elog " out the http_proxy setting. Commenting only requires"
+ elog " access to client config, not server cache."
+ elog "- Make sure GENTOO_MIRRORS in /etc/portage/make.conf starts"
+ elog " with several good http mirrors."
+ elog
+ elog "For more information please refer to the following forum thread:"
+ elog " http://forums.gentoo.org/viewtopic-t-173226.html"
+ elog
+}