summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Jorna <wraeth@gentoo.org>2016-03-23 21:58:13 +1100
committerSam Jorna <wraeth@gentoo.org>2016-03-23 21:58:36 +1100
commit91d6d053b55f3c230fa90dc257d0bc994c3bc5e5 (patch)
treed882ba340834f9e9e8480a2030964efbd004b436 /net-proxy
parentapp-text/sigil: version bump to 0.9.4 (diff)
downloadgentoo-91d6d053b55f3c230fa90dc257d0bc994c3bc5e5.tar.gz
gentoo-91d6d053b55f3c230fa90dc257d0bc994c3bc5e5.tar.bz2
gentoo-91d6d053b55f3c230fa90dc257d0bc994c3bc5e5.zip
net-proxy/http-replicator: revbump, bug 442874
Adds X-Unique-Cache-Name header to try and catch files based on their saved name in DISTFILES. Additionally bumps ebuild to EAPI6 and elogs information for required setup. Ebuild supplied by Matthew Ogilvie. Gentoo-bug: 442874 Package-Manager: portage-2.2.28 Signed-off-by: Sam Jorna <wraeth@gentoo.org>
Diffstat (limited to 'net-proxy')
-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/http-replicator-3.0-r5.ebuild85
3 files changed, 167 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/http-replicator-3.0-r5.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r5.ebuild
new file mode 100644
index 000000000000..70b763efdccf
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-3.0-r5.ebuild
@@ -0,0 +1,85 @@
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+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="http://sourceforge.net/projects/http-replicator"
+SRC_URI="mirror://sourceforge/http-replicator/${MY_P}.tar.gz"
+S="${WORKDIR}/${MY_P}"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
+
+PATCHES=(
+ "${FILESDIR}/http-replicator-3.0-sighup.patch"
+ "${FILESDIR}/http-replicator-3-unique-cache-name.patch"
+ "${FILESDIR}/http-replicator-3-missing-directory.patch"
+)
+
+src_install(){
+ python-single-r1_pkg_setup
+
+ # Daemon and repcacheman into /usr/bin
+ python_scriptinto /usr/bin
+ python_doexe http-replicator
+ python_newexe "${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
+}