diff options
-rw-r--r-- | net-proxy/http-replicator/ChangeLog | 12 | ||||
-rwxr-xr-x | net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r2 | 201 | ||||
-rw-r--r-- | net-proxy/http-replicator/files/http-replicator-3.0.conf | 2 | ||||
-rw-r--r-- | net-proxy/http-replicator/http-replicator-3.0-r3.ebuild (renamed from net-proxy/http-replicator/http-replicator-3.0-r1.ebuild) | 22 |
4 files changed, 224 insertions, 13 deletions
diff --git a/net-proxy/http-replicator/ChangeLog b/net-proxy/http-replicator/ChangeLog index ca6a802cae37..a969a8b8e1df 100644 --- a/net-proxy/http-replicator/ChangeLog +++ b/net-proxy/http-replicator/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for net-proxy/http-replicator -# Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/ChangeLog,v 1.30 2009/06/09 20:30:18 jer Exp $ +# Copyright 1999-2012 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/ChangeLog,v 1.31 2012/05/04 01:35:08 ottxor Exp $ + +*http-replicator-3.0-r3 (04 May 2012) + + 04 May 2012; Christoph Junghans <ottxor@gentoo.org> + -http-replicator-3.0-r1.ebuild, +http-replicator-3.0-r3.ebuild, + +files/http-replicator-3.0-repcacheman-0.44-r2, + files/http-replicator-3.0.conf: + version bump 09 Jun 2009; Jeroen Roovers <jer@gentoo.org> http-replicator-3.0-r2.ebuild: 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 100755 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.conf b/net-proxy/http-replicator/files/http-replicator-3.0.conf index 6dcc076ad9fd..35671fd262c0 100644 --- a/net-proxy/http-replicator/files/http-replicator-3.0.conf +++ b/net-proxy/http-replicator/files/http-replicator-3.0.conf @@ -24,7 +24,7 @@ DAEMON_OPTS="$GENERAL_OPTS" ## 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/All:All" +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" diff --git a/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild b/net-proxy/http-replicator/http-replicator-3.0-r3.ebuild index 0c62717a17b2..87fc39ee9fac 100644 --- a/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild +++ b/net-proxy/http-replicator/http-replicator-3.0-r3.ebuild @@ -1,8 +1,10 @@ -# Copyright 1999-2009 Gentoo Foundation +# Copyright 1999-2012 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.8 2009/01/20 22:44:42 mr_bones_ Exp $ +# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/http-replicator-3.0-r3.ebuild,v 1.1 2012/05/04 01:35:08 ottxor Exp $ -inherit eutils +EAPI=4 +PYTHON_DEPEND="2:2.7:2.7" # not 2.6 bug #33907, not 3.0 bug #411083 +inherit eutils python MY_P="${PN}_${PV}" @@ -13,10 +15,11 @@ S="${WORKDIR}/${MY_P}" LICENSE="GPL-2" SLOT="0" -KEYWORDS="alpha amd64 ~hppa ppc ~sparc x86" +KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~sparc ~x86" IUSE="" -DEPEND=">=dev-lang/python-2.3" +DEPEND="" +RDEPEND="${DEPEND}" src_compile() { epatch "${FILESDIR}/http-replicator-3.0-sighup.patch" @@ -28,16 +31,15 @@ src_install(){ exeinto /usr/bin doexe http-replicator newexe "${FILESDIR}/http-replicator-3.0-callrepcacheman-0.1" repcacheman - if has_version '>=sys-apps/portage-2.2_rc6'; then - newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44-r1" repcacheman.py - else - newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44" repcacheman.py - fi + newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44-r2" repcacheman.py # init.d scripts newinitd "${FILESDIR}/http-replicator-3.0.init" http-replicator newconfd "${FILESDIR}/http-replicator-3.0.conf" http-replicator + # not 2.6 bug #33907, not 3.0 bug #411083 + python_convert_shebangs -r 2.7 "${ED}" + # Docs dodoc README debian/changelog |