summaryrefslogtreecommitdiff
path: root/net-proxy/http-replicator
diff options
context:
space:
mode:
authorV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
committerV3n3RiX <venerix@redcorelinux.org>2017-10-09 18:53:29 +0100
commit4f2d7949f03e1c198bc888f2d05f421d35c57e21 (patch)
treeba5f07bf3f9d22d82e54a462313f5d244036c768 /net-proxy/http-replicator
reinit the tree, so we can have metadata
Diffstat (limited to 'net-proxy/http-replicator')
-rw-r--r--net-proxy/http-replicator/Manifest19
-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-callrepcacheman-0.13
-rw-r--r--net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r2201
-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/files/http-replicator-4.0_alpha2-r2.conf46
-rw-r--r--net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3-pid.patch101
-rw-r--r--net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3.init21
-rw-r--r--net-proxy/http-replicator/files/http-replicator.service11
-rw-r--r--net-proxy/http-replicator/files/http-replicator.service.conf3
-rw-r--r--net-proxy/http-replicator/http-replicator-3.0-r7.ebuild93
-rw-r--r--net-proxy/http-replicator/http-replicator-4.0_alpha2-r5.ebuild72
-rw-r--r--net-proxy/http-replicator/metadata.xml8
16 files changed, 746 insertions, 0 deletions
diff --git a/net-proxy/http-replicator/Manifest b/net-proxy/http-replicator/Manifest
new file mode 100644
index 000000000000..07a92b4610be
--- /dev/null
+++ b/net-proxy/http-replicator/Manifest
@@ -0,0 +1,19 @@
+AUX http-replicator-3-missing-directory.patch 1776 SHA256 dcdc81cb7d74c5c3c7a7c0e2f3b82d9bd1fd38898c24b8f4a4e2928b1b65cf43 SHA512 8c4d9f563bb73ee2b237fadc7c062c8cfbc1510c9f7fc597974fbc727f61fffc9b3d79285904fcac755dc12c7603d7d4efd1d25978df6ddfc797b44c6c17570b WHIRLPOOL 5d4fe55d3a7d0e866717e8c73173a0f1865aa0316577cda97026c7b3459ca7d733bca10dff9a644f603fa030a8012ba74e8d15f1f280c04ae1c18d54fc0dda95
+AUX http-replicator-3-unique-cache-name.patch 1195 SHA256 645dd17eb3b912fc25cf0e35bc3ef8210e867141097d758a0b781b701ffdfa26 SHA512 c1fd6d4c5e7dee1e58b6289dee5b7aa97c577ccf0099b02dc99b6a80a64b25f5e2f5321563fac9fa86beeb51b77edce321b9997144a0bf23104560577b857291 WHIRLPOOL 8693410836440daf98342ded73b304a01c42ca230b5b494b67639c0e334b5ea0c2dc91301cedf683ab55b5eeb470922222ad61b23e5d007561241c37f7cd38f7
+AUX http-replicator-3.0-callrepcacheman-0.1 86 SHA256 9f7cff787b49eb8cb6ca4581c77167b305a766785a0897ee663ca94cf3aa97fd SHA512 144490fd854e22fce95e6a6891a3e65e8af001b5e421bec39b20ee4cf39709424a922f7852bf48ecf43b5b9755213e7149a2a3784bbc3a3e5542072d8d3bda3d WHIRLPOOL e458e78e85add1410ebb17900cadebff03fc5f641f628d070920bd4ecb6e361ec73964ea47ad71bbe017a2a4cea0324b63ec25f54d360250fab01b9b8c44f99c
+AUX http-replicator-3.0-repcacheman-0.44-r2 5337 SHA256 173c59c14f3a7c3a143e33b98a408e46f27cbc361ccd9f28bd47187b7ff55a04 SHA512 c917d47327a55699deb346e53aef1ba9a5eda81f6947ac4efe8422422a2cba668a3ed12c0f89bf840e4ad94dd6272b3d6eb705d1e78e58ddef90b21307ff8d15 WHIRLPOOL 940771cb19da1bf7fb6c1e6e175a338a0454d939407e89c14be1e8b72550582cf4e55fcf2b7787bf8e4ebac38f1665d7ae209e8270946f25df6c66d69bb35a16
+AUX http-replicator-3.0-sighup.patch 993 SHA256 eccf5e7b0e77906624a83214c5e652bc8cce463ddf7365ab9b13302dfb2ff352 SHA512 25da23acd8c235f2b0dbe2f424a92a161d3f4e96e5bea67973004c7bb0642640b73d528b1675174a611bef35f34cc18de08d78c3464cb6080f4f44f833173aee WHIRLPOOL 38156ba01bace9dc0279e3888c917b474b59132e1c0525ed6be7eae68baeca3c558ff861265de1899fc65718e0628697a2718560ea076580ad5c229dcd6ee11f
+AUX http-replicator-3.0.conf 1704 SHA256 8b6acbf87ffbda0cdb51167ab2bd6a665374c553fe52fe2717d8be03e0e7cb65 SHA512 c56031c303f79a44a006781b3796abaae24f1b8ea368eb0436a7ada8defe0f92382649098aef7c41372bfbf1889a17468af201669756912e0c55985c5981fb4c WHIRLPOOL fda8e01350b9849e37a11a9fc973750682d194aa267fb7e7ea2fb28c9533643f4d2c57f15560e03f4a2698b7d2db7edaf1d99dd66bb38ce2494c3b32c26729a5
+AUX http-replicator-3.0.init 620 SHA256 d6c3c661cb60c85f3b3867da1b35173f5de18e1c3595a995ce04e8fe8b91784a SHA512 e69143963155cdc03874b51dc0eef8a46bee3d7828bf20bdb50b4ea9ea6bb2e4fd705e1d9ee4864e53488e4035aa91ebd47f02a597bfa1ee6d5b7121ac5fd68d WHIRLPOOL 4b986f373dbd24d4d14d6f5803178e6fc5d3eba4bf9681a9919b811b6396f8524f302074f49f5291b49160985769dfee6c873468801cfeff6b54e0af3f641db9
+AUX http-replicator-4.0_alpha2-r2.conf 1440 SHA256 ebe9c43263d805265759768b8aab6272c31be1756367115bccfc2760be15f165 SHA512 e6237c8b7eeb319615d45abdef4feaca6bbeb741bc75e80173e42328e4eb5f4192edfbf42c7e6e307c14d258e7ec67a0ae6451ff7daef631b2d1e39fe17a48fb WHIRLPOOL 82180cfecab96751a27b3166e58a858fb5fd49fa72e73de23709665504a99de9151c2d8a6cdf437270b49ea7e32499881b909aa901e8b09ba302c555ef1c121f
+AUX http-replicator-4.0_alpha2-r3-pid.patch 2681 SHA256 e2119798eda31b010067adfccd7aab5c415785b8b2ec79f28e5ca43d204a7ce6 SHA512 9ceb6ede3ec31fd7f702ac77a51897301fd7b16baee869a82180f388949ff7388f0917d667786b45643603c0e9d655cd8686948d5e34896c1fe5932fd76e42b5 WHIRLPOOL f0b7a0918190de2ced9e2d0880a837d696a44e79825175db13aef5b74dc5e9e26595e2de201797bf3d99c33645ff0a3012e6c3c13f28fa632589fbc66b973139
+AUX http-replicator-4.0_alpha2-r3.init 644 SHA256 4228da9fb0c607595f8d9d2270e3263ebf1c6736bcd2e267b6c5221157761603 SHA512 b1a8bd956d35cc536b835aac6cb82202f0b6b775d7eae81ac30f501d1c72877d093711e0f00a28eb7645a383e211d3196379b37da1e0421773c1b91ed6d3837b WHIRLPOOL a87735fc635e1764b1249852b5edaf9b65dafae615883ac7a407528978e287c94bef1fc1cce68592d524c66347b40b95a26bee67ae055b75b2fb1d1b7be5de4f
+AUX http-replicator.service 258 SHA256 15727e6d3de285a5b02e508cc7cfe9295c9cb0830f7ecd2dd33b594050e17b7c SHA512 0da767205c21c226563eb2210a12d92d7933431245fad9bf8766eda59b1f4a16905cadcfb796b3aef86978eb06b153eb976b12f4f7e19d468654c1722e266352 WHIRLPOOL 63184f4fd4f80ceb281524f19219543c2f26458f0e68845dcce6124cdabf344d5689b068d4ca7f8d2bcc363967d0e5c46838cc8ae8d54aa1a76666d32a95bfcd
+AUX http-replicator.service.conf 164 SHA256 a551cec799cb26f1ab3162feb3b09ea755390e8c80809981c0ff951bfd802e60 SHA512 0a1854ddb9f5b8631bdf6a837f1c91b895652803b3e1b6b98fba8f67dba0488a61f8864ddd4128d8072353a38349d9848e91a5109b317c37e1ca2598d0ac2333 WHIRLPOOL 04a2fd478bebb9dbec03b633e9812eadd945a05f65198e66a38cf6f686e0bb02d875a369bf29926c038448c784bac8c72c14467ac3a38c627ba066ab823df4e3
+DIST http-replicator_3.0.tar.gz 39291 SHA256 cd5b2c8b4b6da4fd5a9313cd5e7d4179805002f2de5fd25a42301df4f5bd161e SHA512 d98a608c38201db6f2d8ba809a4777ab5588f5ed395882bdf542c2788df1770c61a2de160604c09297d847f2c73463ba0530d7f2c2e482467f8e8f35be068d57 WHIRLPOOL 965524243895a6a00df3b4be3bae391bc532f3ccef87383a487c87efbcd858aa1a2d15598be752b7640e57aef47ab7cbaad8430033925935f16a527aa50db36a
+DIST http-replicator_4.0alpha2.tgz 27575 SHA256 43f466b691244104caba96fd16df75978731ea248ad1681beaf88342a708875a SHA512 437e0cc881af0cb8f84bfd1366bb6edeee4f76112c4b2ac2af4bcb8809462852b96e9c99e04c8f370492c9e1eb33ddc68a85c4f09b073694242cd6c05b4d3a6c WHIRLPOOL 599d2ee6bab4ffb4792913763b303da3a473dee2aa15510ceee32d042e54abdb49a902eee3346c4c735c97169e11fcd2340e7c741e160500c4a6bbd064a57561
+EBUILD http-replicator-3.0-r7.ebuild 3443 SHA256 7f977fa17ebfb957ed67d2b91daa8c94562e3d54286668226e0f8776b05a321d SHA512 f2fca6973f801d66755cc5f79d19e44cab08d70211739d5cf0e8f4d25c66893afe79ca9126a8091477dbca75cfa797b334b6e11d236396c4505060ddbcf8a538 WHIRLPOOL 5a31f078a36abc6fd24465e5f05c060afdea97380121bb4a17440725740af6c29fbd14182ed2f46d6e39ed0c17d560c252efafffad21c5e580645987593e6ab4
+EBUILD http-replicator-4.0_alpha2-r5.ebuild 1992 SHA256 a464ec1298f210d683dc714c89865b753dd6041d14f912c8f06b2cf8012b3bac SHA512 2ced4476b701ddb536ec732f7623d22bd921510828706f25872411e26371ed9382836b24e49664bfff95725d9419228c25cccd28149dfcccb4c216db0d45faa5 WHIRLPOOL 44154225c5e7f7aec4108b16f4e471f7938dc829afe43b84fae567bfedf94b85966149869d55348e857976c41a639b64a7a4134086e9429594d49b7f8d4c65f0
+MISC ChangeLog 6335 SHA256 6c18e4342546eca9b89fa3d9e72a0824b5ec063822d5e6cb473fa0170285eec2 SHA512 f13422cb14471353b0f7343652bf8aba0a73fc1e24e40ba654d9773ec0af00f717dc56274204ed9d77afb7c2f5a4ddc3315b84949de8a43197aff6ff53b9f730 WHIRLPOOL 8ae1c8f72ad74c8b8f76293ed946746eb70470664d919da301e24c266d6adfe3b6cdc067158fac74fa711a7fe218a34479b6290f0a3d8a47c09451cb953acf54
+MISC ChangeLog-2015 8960 SHA256 41cc5036eaad8ca6dfaee2ca33d2f29b43a601e7bcda806abca3e9f5b9daa78c SHA512 873a92329da5dd7323f7ab3cf2bc99624b204b99c6e78dff782d085d46e54bab16ef774d3a5d6176f1145a89d8bec251138e1751b817b69ca691800fefcca323 WHIRLPOOL c3e087bc31fffafcd3fd70f2278f07eea5eb4e7e9c65dc4526b0f3b30b54cbe852632864da4f7f0205cef68ec6e947e8277971c47f270134d4abe805b9aa1acc
+MISC metadata.xml 252 SHA256 af2fcb49553ecf1eb6475b09a5f4c4739d6a2a8f80225e8e0569406ae8bd8db9 SHA512 ffd7c4cd77545f753618c9e9cfeba05b557044879ce332c01deaad820e184329cf383c8488ba777e9653029d3f75e5c99936ca225ebc4a5fb9b4d4e257ba8e7d WHIRLPOOL de2d8abdfe58955e89f9824fadbe89751ec5c6ba4fd2796054f3746904fb565369e9f1e5deb0228f0c0ea816848367ba54f7a7d4e552253fbc3267729b76e0a3
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-callrepcacheman-0.1 b/net-proxy/http-replicator/files/http-replicator-3.0-callrepcacheman-0.1
new file mode 100644
index 000000000000..14cd0a70a53b
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-callrepcacheman-0.1
@@ -0,0 +1,3 @@
+#! /bin/bash
+source /etc/conf.d/http-replicator
+/usr/bin/repcacheman.py $GENERAL_OPTS
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r2 b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r2
new file mode 100644
index 000000000000..35d0a9e39fa2
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r2
@@ -0,0 +1,201 @@
+#! /usr/bin/python
+#
+# repcacheman ver 0.44
+#
+# Cache Manager for Http-Replicator
+# deletes duplicate files in PORTDIR.
+# imports authenticated (checksum + listed in portage)
+# files from PORTDIR to replicator's cache directory.
+#
+# Uses portage to perform checksum and database functions.
+# All else, Copyright(C)2004-2007 Tom Poplawski (poplawtm@earthlink.net)
+# Distributed under the terms of the GNU General Public License v2
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+import portage.manifest
+import portage.checksum
+import portage.exception
+import portage
+import string
+import os
+import pwd,sys,optparse
+
+if os.getuid():
+ print"Must be root"
+ sys.exit(1)
+
+# Parse Options
+
+parser = optparse.OptionParser()
+parser.add_option('-d', '--dir', type='string', default="/var/cache/http-replicator", help='http-replicators cache DIR')
+parser.add_option('-u','--user', type='string', default="portage", help='http-replicator USER')
+options, args = parser.parse_args() # parse command line
+
+if options.user:
+ try:
+ uid=pwd.getpwnam(options.user)[2]
+ gid=pwd.getpwnam(options.user)[3]
+ except:
+ print "User \'" + options.user + "\' Doesn't exist on system - edit config or add user to system."
+ sys.exit(1)
+else:
+ print "Error\n\tunable to get USER from /etc/http-replicator.conf"
+ sys.exit(1)
+
+# dir is replicator's cache directory
+dir=options.dir+"/"
+
+if os.path.isdir(dir) :
+ newdir=0
+else :
+ print"\n\nBegin Http-Replicator Setup...."
+ try:
+ os.makedirs(dir)
+ print "\tcreated " + dir
+ newdir=1
+ except:
+ print "\tcreate " + dir + " failed"
+ print '\terror:', sys.exc_info()[1]
+ sys.exit(1)
+ try:
+ os.chown(dir,uid,gid)
+ print "\tchanged owner of " + dir + " to " + options.user
+ except:
+ print "\tchange owner " + dir + " to " + options.user + " failed:"
+ print '\terror:', sys.exc_info()[1]
+
+print "\n\nReplicator's cache directory: " + dir
+
+# Import Portage settings
+
+distdir=portage.settings["DISTDIR"]+"/"
+if distdir:
+ print "Portage's DISTDIR: " + distdir
+else:
+ print"Unable to get Portage's DISTDIR"
+ sys.exit(1)
+
+# Start Work
+
+print "\nComparing directories...."
+
+# Create filecmp object
+import filecmp
+dc=filecmp.dircmp (distdir,dir,['cvs-src','git-src','hg-src','egit-src','.locks'])
+print "Done!"
+
+dupes=dc.common
+deleted=0
+
+if dupes:
+ print "\nDeleting duplicate file(s) in " + distdir
+
+ for s in dupes:
+ print s
+ try:
+ os.remove(distdir + s )
+ deleted +=1
+ except:
+ print "\tdelete " + distdir + s + " failed:"
+ print '\terror:', sys.exc_info()[1]
+
+ print "Done!"
+
+
+newfiles=dc.left_only
+nf=len(dc.left_only)
+
+if nf:
+ print "\nNew files in DISTDIR:"
+ for s in newfiles:
+ print s
+ print"\nChecking authenticity and integrity of new files..."
+ added=0
+ errors=0
+ badsum=0
+
+# search all packages
+
+ for mycp in portage.db["/"]["porttree"].dbapi.cp_all():
+ manifest = portage.manifest.Manifest("/usr/portage/" + mycp , distdir)
+ if manifest == None:
+ portage.writemsg("Missing manifest: %s\n" % mycpv)
+
+ remove=[]
+ for file in newfiles:
+ if manifest.hasFile("DIST",file):
+ try:
+ myok, myreason = manifest.checkFileHashes("DIST",file)
+
+ try:
+ os.rename(distdir+file,dir+file)
+ added += 1
+ except:
+ try:
+ import shutil
+ shutil.copyfile(distdir+file,dir+file)
+ added += 1
+ os.remove(distdir+file)
+ except:
+ print "\tmove/copy " + file + " failed:"
+ print '\terror:', sys.exc_info()[1]
+ errors+=1
+
+ try:
+ os.chown(dir+file,uid,gid)
+ except:
+ print "\tchown " + file + " failed:"
+ print '\terror:', sys.exc_info()[1]
+ errors +=1
+
+ remove.append( file )
+
+ except portage.exception.DigestException, e:
+ print("\n!!! Digest verification failed:")
+ print("!!! %s" % e.value[0])
+ print("!!! Reason: %s" % e.value[1])
+ print("!!! Got: %s" % e.value[2])
+ print("!!! Expected: %s" % e.value[3])
+ badsum+=1
+ if remove:
+ for rf in remove:
+ newfiles.remove ( rf )
+
+
+print "\nSUMMARY:"
+print "Found " + str(len(dupes)) + " duplicate file(s)"
+if deleted:
+ print "\tDeleted " + str(deleted) + " dupe(s)"
+
+if nf:
+ print "Found " + str(nf) + " new file(s)"
+ print "\tAdded " + str(added) + " of those file(s) to the cache"
+
+ print "Rejected " +str(len(newfiles)) + " File(s) - ",
+ print str(badsum) + " failed checksum(s)"
+ for s in newfiles:
+ print "\t%s" %s
+ if errors:
+ print "Encountered " +str(errors) + " errors"
+# if badsum:
+# print str(badsum) + " partial/corrupted file(s)"
+
+if newdir:
+ print"\n\nexecute:\n/etc/init.d/http-replicator start"
+ print"to run http-replicator.\n\nexecute:\nrc-update add http-replicator default"
+ print"to make http-replicator start at boot"
+ print"\n\nexecute:\n/usr/bin/repcacheman\nafter emerge's on the server to delete"
+ print"dup files and add new files to the cache"
+
+print "\n\nHTTP-Replicator requires you delete any partial downloads in " + distdir
+print "run rm -f " + distdir +'*'
+
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/files/http-replicator-4.0_alpha2-r2.conf b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r2.conf
new file mode 100644
index 000000000000..cea7c9632a34
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r2.conf
@@ -0,0 +1,46 @@
+## Configuration file for HTTP Replicator automatically sourced by init script.
+
+#################
+## REPCACHEMAN ##
+#################
+
+## 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"
+
+#####################
+## HTTP-REPLICATOR ##
+#####################
+
+## Specify which file to log too, use /dev/null to disable.
+LOG_FILE="/var/log/http-replicator.log"
+
+# Set cache root directory.
+DAEMON_OPTS="--root /var/cache/http-replicator/"
+
+## Try IPv6 addresses if available.
+# DAEMON_OPTS="$DAEMON_OPTS --ipv6"
+
+## The proxy port on which the server listens for http requests, default 8080.
+# DAEMON_OPTS="$DAEMON_OPTS --port 8080"
+
+## Break connection after so many seconds of inactivity, default 15.
+# DAEMON_OPTS="$DAEMON_OPTS --timeout 15"
+
+## Limit download rate at a fixed K/s.
+# DAEMON_OPTS="$DAEMON_OPTS --limit RATE"
+
+## Do you need the proxy to work offline, never connecting to a server?
+# DAEMON_OPTS="$DAEMON_OPTS --offline"
+
+## Show http headers and other info in log messages.
+# DAEMON_OPTS="$DAEMON_OPTS --verbose"
+
+## Switch from gather to debug output module.
+# DAEMON_OPTS="$DAEMON_OPTS --debug"
+
+## More options (eg --flat and --static) are listed in `http-replicator --help`,
+## the --daemon parameter is automatically passed by the init script. \ No newline at end of file
diff --git a/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3-pid.patch b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3-pid.patch
new file mode 100644
index 000000000000..a1cf5eddbfcb
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3-pid.patch
@@ -0,0 +1,101 @@
+Bring back the --pid functionality of 3.x, needed for our init script.
+
+Patch contributed by Nikita Kozlov (klnikita / klnikita_ on IRC).
+
+Slight adjustments made to use --pid instead of --pidfile and reordered --help.
+
+URL: https://dpaste.org/Menvq/
+BUG: https://bugs.gentoo.org/show_bug.cgi?id=472422
+
+--- a/fiber.py
++++ b/fiber.py
+@@ -136,11 +136,13 @@
+ self.__stdout.flush()
+ self.__newline = string.endswith( '\n' )
+
+
+-def fork( output ):
++def fork( output, pidfile ):
+
+ try:
++ if pidfile:
++ pidout = open(pidfile, 'w') # open pid file for writing
+ log = open( output, 'w' )
+ nul = open( '/dev/null', 'r' )
+ pid = os.fork()
+ except IOError, e:
+@@ -166,17 +168,20 @@
+ print 'error:', e
+ sys.exit( 1 )
+
+ if pid:
++ if pidfile:
++ pidout.write(str(pid))
++ pidout.close()
+ print pid
+ sys.exit( 0 )
+
+ os.dup2( log.fileno(), sys.stdout.fileno() )
+ os.dup2( log.fileno(), sys.stderr.fileno() )
+ os.dup2( nul.fileno(), sys.stdin.fileno() )
+
+
+-def spawn( generator, port, debug, log ):
++def spawn( generator, port, debug, log, pidfile ):
+
+ try:
+ listener = socket.socket( socket.AF_INET, socket.SOCK_STREAM )
+ listener.setblocking( 0 )
+@@ -187,9 +192,9 @@
+ print 'error: failed to create socket:', e
+ sys.exit( 1 )
+
+ if log:
+- fork( log )
++ fork( log, pidfile )
+
+ if debug:
+ myFiber = DebugFiber
+ else:
+--- a/http-replicator
++++ b/http-replicator
+@@ -59,5 +59,5 @@
+
+ print 'Transaction successfully completed'
+
+
+-fiber.spawn( Replicator, Params.PORT, Params.DEBUG, Params.LOG )
++fiber.spawn( Replicator, Params.PORT, Params.DEBUG, Params.LOG, Params.PIDFILE )
+--- a/Params.py
++++ b/Params.py
+@@ -6,8 +6,9 @@
+ PORT = 8080
+ ROOT = os.getcwd() + os.sep
+ VERBOSE = 0
+ TIMEOUT = 15
++PIDFILE = False
+ FAMILY = socket.AF_INET
+ FLAT = False
+ STATIC = False
+ ONLINE = True
+@@ -21,8 +22,9 @@
+
+ options:
++ --pid FILE write process ID to FILE
+ -h --help show this help message and exit
+ -p --port PORT listen on this port for incoming connections, default %(PORT)i
+ -r --root DIR set cache root directory, default current: %(ROOT)s
+ -v --verbose show http headers and other info
+ -t --timeout SEC break connection after so many seconds of inactivity, default %(TIMEOUT)i
+ -6 --ipv6 try ipv6 addresses if available
+@@ -74,8 +76,10 @@
+ except:
+ sys.exit( 'Error: %s requires a numerical argument' % _arg )
+ elif _arg == '--daemon':
+ LOG = _args.next()
++ elif _arg == '--pid':
++ PIDFILE = _args.next()
+ elif _arg == '--debug':
+ DEBUG = True
+ else:
+ sys.exit( 'Error: invalid option %r' % _arg ) \ No newline at end of file
diff --git a/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3.init b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3.init
new file mode 100644
index 000000000000..3dc4297855c2
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-4.0_alpha2-r3.init
@@ -0,0 +1,21 @@
+#!/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 -- --static \
+ --flat --daemon $LOG_FILE $DAEMON_OPTS --pid /var/run/http-replicator.pid
+ 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/files/http-replicator.service b/net-proxy/http-replicator/files/http-replicator.service
new file mode 100644
index 000000000000..6a2a7e5f5dff
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=http-replicator daemon
+After=network.target
+
+[Service]
+ExecStart=/usr/bin/http-replicator -s -f \
+ --dir /var/cache/http-replicator --user portage --log /var/log/http-replicator.log \
+ $DAEMON_OPTS
+
+[Install]
+WantedBy=multi-user.target
diff --git a/net-proxy/http-replicator/files/http-replicator.service.conf b/net-proxy/http-replicator/files/http-replicator.service.conf
new file mode 100644
index 000000000000..da7445d080c4
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator.service.conf
@@ -0,0 +1,3 @@
+# Set various parameters for http-replicator
+[Service]
+Environment="DAEMON_OPTS= --alias /usr/portage/packages:packages --ip 192.168.*.* --ip 10.*.*.* --port 8080"
diff --git a/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild
new file mode 100644
index 000000000000..68405a1f8c1b
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-3.0-r7.ebuild
@@ -0,0 +1,93 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+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="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
+}
diff --git a/net-proxy/http-replicator/http-replicator-4.0_alpha2-r5.ebuild b/net-proxy/http-replicator/http-replicator-4.0_alpha2-r5.ebuild
new file mode 100644
index 000000000000..6810108b67b9
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-4.0_alpha2-r5.ebuild
@@ -0,0 +1,72 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=5
+
+PYTHON_COMPAT=( python2_7 )
+
+inherit eutils python-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"
+REQUIRED_USE="${PYTHON_REQUIRED_USE}"
+
+RDEPEND="${PYTHON_DEPS}"
+DEPEND="${RDEPEND}"
+
+S="${WORKDIR}/${MY_P}"
+
+# Tests downloads files as well as breaks, should be turned into local tests.
+RESTRICT="test"
+
+src_prepare() {
+ epatch "${FILESDIR}"/${PN}-4.0_alpha2-r3-pid.patch
+}
+
+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
+}
+
+pkg_postinst() {
+ echo
+ einfo "Before starting ${PN}, please follow the next few steps:"
+ einfo
+ einfo "- Modify /etc/conf.d/${PN} if required."
+ einfo "- Run \`repcacheman\` to set up the cache."
+ einfo "- Add HTTP_PROXY=\"http://serveraddress:8080\" to make.conf on"
+ einfo " the server as well as on the client machines."
+ einfo "- Make sure GENTOO_MIRRORS in /etc/portage/make.conf"
+ einfo " starts with several good HTTP mirrors."
+ einfo
+ einfo "For more information please refer to the following forum thread:"
+ einfo
+ einfo " https://forums.gentoo.org/viewtopic-t-173226.html"
+ einfo
+ einfo "Starting with 4.x releases, the conf.d parameters have changed."
+ echo
+}
diff --git a/net-proxy/http-replicator/metadata.xml b/net-proxy/http-replicator/metadata.xml
new file mode 100644
index 000000000000..2700375c94e8
--- /dev/null
+++ b/net-proxy/http-replicator/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <!-- maintainer-needed -->
+ <upstream>
+ <remote-id type="sourceforge">http-replicator</remote-id>
+ </upstream>
+</pkgmetadata>