summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice van der Pot <griffon26@gentoo.org>2007-08-06 17:49:04 +0000
committerMaurice van der Pot <griffon26@gentoo.org>2007-08-06 17:49:04 +0000
commit579b464b61ad3abb8f0b90210662d4d0661e1c65 (patch)
tree97799365fedd98b38c436b24a20e609a7a2f48fa /net-proxy/http-replicator
parentFixed initial owner/permission problem reported in bug #187883. (diff)
downloadgentoo-2-579b464b61ad3abb8f0b90210662d4d0661e1c65.tar.gz
gentoo-2-579b464b61ad3abb8f0b90210662d4d0661e1c65.tar.bz2
gentoo-2-579b464b61ad3abb8f0b90210662d4d0661e1c65.zip
Added http-replicator revision with new repcacheman that handles the new Manifest format (bug #186487)
(Portage version: 2.1.3_rc9)
Diffstat (limited to 'net-proxy/http-replicator')
-rw-r--r--net-proxy/http-replicator/ChangeLog13
-rw-r--r--net-proxy/http-replicator/files/digest-http-replicator-3.0-r13
-rwxr-xr-xnet-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44201
-rw-r--r--net-proxy/http-replicator/http-replicator-3.0-r1.ebuild61
4 files changed, 277 insertions, 1 deletions
diff --git a/net-proxy/http-replicator/ChangeLog b/net-proxy/http-replicator/ChangeLog
index a21b7450c026..997ebfa9759c 100644
--- a/net-proxy/http-replicator/ChangeLog
+++ b/net-proxy/http-replicator/ChangeLog
@@ -1,6 +1,17 @@
# ChangeLog for net-proxy/http-replicator
# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/ChangeLog,v 1.15 2007/07/10 18:25:50 griffon26 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/ChangeLog,v 1.16 2007/08/06 17:49:04 griffon26 Exp $
+
+*http-replicator-3.0-r1 (06 Aug 2007)
+
+ 06 Aug 2007; Maurice van der Pot <griffon26@gentoo.org>
+ +files/http-replicator-3.0-repcacheman-0.44,
+ +http-replicator-3.0-r1.ebuild:
+ This new revision includes an updated repcacheman that can work with the new
+ Manifest2 format as specified in GLEP44. Thanks to Jakob Truelsen
+ <antialize@gmail.com> for reporting the problem (bug #186487) and
+ Tom Poplawski <poplawtm@earthlink.net> for releasing a new version
+ of repcacheman.
10 Jul 2007; Maurice van der Pot <griffon26@gentoo.org>
+files/http-replicator-3.0-sighup.patch, files/http-replicator-3.0.init,
diff --git a/net-proxy/http-replicator/files/digest-http-replicator-3.0-r1 b/net-proxy/http-replicator/files/digest-http-replicator-3.0-r1
new file mode 100644
index 000000000000..46d6443e3432
--- /dev/null
+++ b/net-proxy/http-replicator/files/digest-http-replicator-3.0-r1
@@ -0,0 +1,3 @@
+MD5 7d8d69175a5dc3d470273b1e508a27f3 http-replicator_3.0.tar.gz 19481
+RMD160 cb26c8e55df3dfbbf20bb08f62f3d0ac89191e68 http-replicator_3.0.tar.gz 19481
+SHA256 a7499b980531636d349ce2cace14692fed2e747d23ad0c48cbc68b84369e2d98 http-replicator_3.0.tar.gz 19481
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44 b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44
new file mode 100755
index 000000000000..b200a7be48f8
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44
@@ -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','.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 -rf " + distdir +'*'
+
diff --git a/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild
new file mode 100644
index 000000000000..67dcd72616ad
--- /dev/null
+++ b/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild
@@ -0,0 +1,61 @@
+# Copyright 1999-2007 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild,v 1.1 2007/08/06 17:49:04 griffon26 Exp $
+
+inherit eutils
+
+DESCRIPTION="Proxy cache for Gentoo packages"
+HOMEPAGE="http://gertjan.freezope.org/replicator/"
+SRC_URI="http://gertjan.freezope.org/replicator/${PN}_${PV}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86"
+IUSE=""
+
+DEPEND=">=dev-lang/python-2.3"
+
+src_compile() {
+ epatch "${FILESDIR}/http-replicator-3.0-sighup.patch"
+ einfo "No compilation necessary"
+}
+
+src_install(){
+ # Daemon and repcacheman into /usr/bin
+ exeinto /usr/bin
+ doexe http-replicator
+ newexe "${FILESDIR}/http-replicator-3.0-callrepcacheman-0.1" repcacheman
+ if has_version '>=sys-apps/portage-2.0.51'; then
+ newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44" repcacheman.py
+ else
+ newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.21" repcacheman.py
+ fi
+
+ # init.d scripts
+ newinitd "${FILESDIR}/http-replicator-3.0.init" http-replicator
+ newconfd "${FILESDIR}/http-replicator-3.0.conf" http-replicator
+
+ # 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() {
+ einfo
+ einfo "Before starting http-replicator, please follow the next few steps:"
+ einfo "- modify /etc/conf.d/http-replicator if required"
+ einfo "- run /usr/bin/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/make.conf starts with several"
+ einfo " good http mirrors"
+ einfo
+ einfo "For more information please refer to the following forum thread:"
+ einfo " http://forums.gentoo.org/viewtopic-t-173226.html"
+ einfo
+}