diff options
Diffstat (limited to 'net-proxy/http-replicator/files')
5 files changed, 168 insertions, 0 deletions
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" +} |