summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaurice van der Pot <griffon26@gentoo.org>2008-08-26 18:33:45 +0000
committerMaurice van der Pot <griffon26@gentoo.org>2008-08-26 18:33:45 +0000
commit7d443bb13398ccabb2c9a5fc8c43d6fffbbf0fe3 (patch)
tree42add824a3d328080e84c0d6a7fa509c039a5b85 /net-proxy
parentAdded convenience env file. (diff)
downloadgentoo-2-7d443bb13398ccabb2c9a5fc8c43d6fffbbf0fe3.tar.gz
gentoo-2-7d443bb13398ccabb2c9a5fc8c43d6fffbbf0fe3.tar.bz2
gentoo-2-7d443bb13398ccabb2c9a5fc8c43d6fffbbf0fe3.zip
Fixed deprecation warnings in repcacheman (part of http-replicator).
(Portage version: 2.2_rc8/cvs/Linux 2.6.26.2 x86_64)
Diffstat (limited to 'net-proxy')
-rw-r--r--net-proxy/http-replicator/ChangeLog11
-rwxr-xr-xnet-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.21250
-rwxr-xr-xnet-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r1201
-rw-r--r--net-proxy/http-replicator/http-replicator-3.0-r1.ebuild10
4 files changed, 215 insertions, 257 deletions
diff --git a/net-proxy/http-replicator/ChangeLog b/net-proxy/http-replicator/ChangeLog
index b539245b2141..909fe87ca3e8 100644
--- a/net-proxy/http-replicator/ChangeLog
+++ b/net-proxy/http-replicator/ChangeLog
@@ -1,6 +1,13 @@
# 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.21 2007/12/30 11:45:38 mrness Exp $
+# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/ChangeLog,v 1.22 2008/08/26 18:33:44 griffon26 Exp $
+
+ 26 Aug 2008; Maurice van der Pot <griffon26@gentoo.org>
+ -files/http-replicator-3.0-repcacheman-0.21,
+ +files/http-replicator-3.0-repcacheman-0.44-r1,
+ http-replicator-3.0-r1.ebuild:
+ Removed repcacheman version for old portage and added a new one for portage
+ 2.2_rc6 and up (to prevent deprecation warnings).
30 Dec 2007; Alin Năstac <mrness@gentoo.org>
-files/http-replicator-3.0-repcacheman-0.33, -http-replicator-3.0.ebuild:
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.21 b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.21
deleted file mode 100755
index a5636b39a256..000000000000
--- a/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.21
+++ /dev/null
@@ -1,250 +0,0 @@
-#! /usr/bin/python
-#
-# repcacheman ver 0.21
-#
-# Cache Manager for Http-Replicator
-# deletes duplicate files in PORTDIR.
-# imports authenticated (md5 + listed in portage)
-# files from PORTDIR to replicator's cache directory.
-#
-# MD5, and database routines ripped from Portage
-# All else, Copyright(C)2004 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 os,string,pwd,sys,optparse
-
-if os.getuid():
- print"Must be root"
- sys.exit(1)
-
-# sys.path = ["/usr/lib/portage/pym"]+sys.path
-
-
-# Perform the Checksum on a file
-def perform_checksum(filename):
- import md5
- myfilename=filename
- f = open(myfilename, 'rb')
- blocksize=327680
- data = f.read(blocksize)
- sum = md5.new()
- while data:
- sum.update(data)
- data = f.read(blocksize)
- f.close()
-
- return (sum.hexdigest())
-
-
-# Import http-replicator settings
-
-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
-DIR=options.dir
-USER=options.user
-
-user=USER
-if user:
- try:
- uid=pwd.getpwnam(user)[2]
- gid=pwd.getpwnam(user)[3]
- except:
- print "User \'" + 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=DIR+"/"
-
-if os.path.isdir(dir):
- newdir=0
-else:
- print"\n\nBegin Http-Replicator Setup...."
- try:
- os.makedir(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 " + user
- except:
- print "\tchange owner " + dir + " to " + user + " failed:"
- print '\terror:', sys.exc_info()[1]
-
-print "\n\nReplicator's cache directory: " + dir
-
-# Portage settings
-import portage
-distdir=portage.settings["DISTDIR"]+"/"
-if distdir:
- print "Portage's DISTDIR: " + distdir
-else:
- print"Unable to get Portage's DISTDIR"
- sys.exit(1)
-
-print "\nComparing directories...."
-
-# Create filecmp object with
-import filecmp
-dc=filecmp.dircmp (distdir,dir,['cvs-src'])
-print "Done!"
-
-#def __getattr__(self,common):
-#print dc.left_only
-
-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
-if newfiles:
- print "\nNew files in DISTDIR:"
- for s in newfiles:
- print s
- print"\nChecking authenticity and integrity of new files..."
- print "Searching for ebuilds..."
-
- md5_list = {}
-
- # get all ebuilds?
- ebuildlist = []
- for mycp in portage.db["/"]["porttree"].dbapi.cp_all():
- ebuildlist += portage.db["/"]["porttree"].dbapi.cp_list(mycp)
- ebuildlist.sort()
-
- print "Done!"
- print "\nFound " + str(len(ebuildlist)) + " ebuilds."
-
-# mycpv =app-admin/ulogd-0.89
-# pv = ulogd-0.89
-
- print "\nExtracting the checksums...."
- for mycpv in ebuildlist:
- pv = string.split(mycpv, "/")[-1]
-
-
- # lookup each ebuild digest and md5sums
- digestpath = portage.db["/"]["porttree"].dbapi.findname(mycpv)
- digestpath = os.path.dirname(digestpath)+"/files/digest-"+pv
- md5sums = portage.digestParseFile(digestpath)
-
- if md5sums == None:
- portage.writemsg("Missing digest: %s\n" % mycpv)
- md5sums = {}
-
- for x in md5sums.keys():
- if x[0] == '/':
- del md5sums[x]
-
-
- for k, v in md5sums.iteritems():
- md5_list[k]= v
-
-
-
- del ebuildlist
- print "Done!\n\nVerifying checksum's...."
-
- added=0
- rejected=0
- suspect=0
- missing=0
-
- for file in newfiles:
-
- if not md5_list.has_key (file):
- print "\nWARNING " + file + " is not in portage!!!\n"
- suspect +=1
- continue
- myfile=distdir + file
- if os.path.isdir(myfile):
- print "\nskipping directory:",myfile
- continue
- mymd5=perform_checksum(myfile)
-
- print myfile
-# print "md5 is " + mymd5
-
- t= md5_list[file]
- if t[0]:
- if t[0] == mymd5:
- print "MD5 OK"
- 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]
- continue
- try:
- os.chown(dir+file,uid,gid)
- except:
- print "\tchown " + file + " failed:"
- print '\terror:', sys.exc_info()[1]
- else:
- print "CORRUPT or INCOMPLETE "
- rejected +=1
- else:
- missing +=1
- print "\nEbuild missing digest for " +file
-
-
-print "\nSUMMARY:\nFound " + str(len(dupes)) + " duplicate file(s)."
-print "\tDeleted " + str(deleted) + " dupe(s)."
-if newfiles:
- print "Found " + str(len(newfiles)) + " new file(s)."
- print "\tAdded " + str(added) + " of those file(s) to the cache."
- print "\tRejected " + str(rejected) + " corrupt or incomplete file(s)."
- if missing:
- print "\tCan't check " +str(missing) + " file(s) because of missing digest."
- if suspect:
- print "\t" + str(suspect) + " Unknown file(s) that are not listed in portage\
-\n\tYou may want to delete them yourself...."
-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\nDone!\n\n"
-
diff --git a/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r1 b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r1
new file mode 100755
index 000000000000..9f0069bc7ebb
--- /dev/null
+++ b/net-proxy/http-replicator/files/http-replicator-3.0-repcacheman-0.44-r1
@@ -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
index 0782b301ef4d..1e2e53f59039 100644
--- a/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild
+++ b/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild
@@ -1,6 +1,6 @@
-# Copyright 1999-2007 Gentoo Foundation
+# Copyright 1999-2008 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.5 2007/12/05 16:57:00 armin76 Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-proxy/http-replicator/http-replicator-3.0-r1.ebuild,v 1.6 2008/08/26 18:33:44 griffon26 Exp $
inherit eutils
@@ -25,10 +25,10 @@ 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.0.51'; then
- newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44" repcacheman.py
+ 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.21" repcacheman.py
+ newexe "${FILESDIR}/http-replicator-3.0-repcacheman-0.44" repcacheman.py
fi
# init.d scripts