From 5226ff6b385473bb60a1cab2acc0dd028d41e767 Mon Sep 17 00:00:00 2001 From: Fabian Groffen Date: Fri, 12 Jan 2007 23:05:07 +0000 Subject: [PATCH] Merged from trunk 5581:5597 portage_versions.py, more string.atoi -> int, fix another except: that should be ValueError (WarnerBro) (Prefix: string.atof -> float) Fix broad except statement, should only be KeyError (WarnerBro) comment the excepts in a few places (WarnerBro) getbinpkg.py fix except: open can be IOERror or OSError and cPickle can throw an unpicklingError (WarnerBro) EOFError is also important according to Zac (WarnerBro) os.cwd can return OSError (maybe IOError with wrong perms for ./, will test actually), load_mod should be IMportError, nuke a stupid try except around shuffle which used to break years ago with old glibcs, remove try except around what appears to be a regex? and make the try except around the unlink a bit cleaner (WarnerBro) FIx a bunch of random Except: statements in portage.py, most of them are IO/OS related (WarnerBro) Return early from finddigest if findname2 found nothing. For bug #88485, show the location of the build log whenever a build fails. Prevent an InvalidData exception during global updates due to the new stricter catpkgsplit behavior. Fix incremental virtuals code for the new stricter catpkgsplit behavior. Remove a duplicate % character. Begin the deprecation of the string module (WarnerBro) more string deprecation (WarnerBro) set Id on tests (WarnerBro) More String deprecation (WarnerBro) svn path=/main/branches/prefix/; revision=5619 --- bin/archive-conf | 10 +-- bin/chkcontents | 8 +-- bin/dispatch-conf | 4 +- bin/dohtml | 7 +- bin/ebuild.sh | 1 + bin/md5check.py | 10 +-- bin/portageq | 13 ++-- bin/regenworld | 2 +- pym/cvstree.py | 6 +- pym/eclass_cache.py | 2 +- pym/emergehelp.py | 2 +- pym/getbinpkg.py | 29 ++++---- pym/portage.py | 85 +++++++---------------- pym/portage_dep.py | 6 +- pym/portage_exec.py | 2 +- pym/portage_locks.py | 7 +- pym/portage_update.py | 8 ++- pym/portage_util.py | 10 +-- pym/portage_versions.py | 38 +++++----- pym/xpak.py | 4 +- tests/portage/__init__.py | 2 +- tests/portage_dep/__init__.py | 2 +- tests/portage_dep/test_dep_getcpv.py | 2 +- tests/portage_dep/test_dep_getslot.py | 2 +- tests/portage_dep/test_get_operator.py | 2 +- tests/portage_dep/test_isjustname.py | 2 +- tests/portage_dep/test_isvalidatom.py | 2 +- tests/portage_dep/test_match_from_list.py | 2 +- tests/portage_util/__init__.py | 2 +- tests/portage_util/test_grabdict.py | 2 +- tests/portage_util/test_normalizedPath.py | 2 +- tests/portage_util/test_stackDictList.py | 2 +- tests/portage_util/test_stackDicts.py | 2 +- tests/portage_util/test_stackLists.py | 2 +- tests/portage_util/test_uniqueArray.py | 2 +- tests/portage_util/test_varExpand.py | 2 +- tests/portage_versions/__init__.py | 2 +- 37 files changed, 129 insertions(+), 159 deletions(-) diff --git a/bin/archive-conf b/bin/archive-conf index 6c8f007d1..0adb2508b 100755 --- a/bin/archive-conf +++ b/bin/archive-conf @@ -10,7 +10,7 @@ # Jeremy Wohl's dispatch-conf script and the portage chkcontents script. # -import os, sys, string +import os, sys try: import portage except ImportError: @@ -32,7 +32,7 @@ except ImportError: hexform = "" for ix in xrange(len(md5sum)): hexform = hexform + "%02x" % ord(md5sum[ix]) - return string.lower(hexform) + return hexform.lower() def perform_checksum(filename): f = open(filename, 'rb') @@ -75,12 +75,12 @@ def archive_conf(): sys.exit(1) lines = contents.readlines() for line in lines: - items = string.split(line) + items = line.split() if items[0] == 'obj': for conf in args: if items[1] == conf: - stored = string.lower(items[2]) - real = string.lower(perform_checksum(conf)[0]) + stored = items[2].lower() + real = perform_checksum(conf)[0].lower() if stored == real: md5_match_hash[conf] = conf todo_cnt -= 1 diff --git a/bin/chkcontents b/bin/chkcontents index eecb55762..90a586337 100755 --- a/bin/chkcontents +++ b/bin/chkcontents @@ -8,7 +8,7 @@ # actual programs on the system (and makes sure that symlinks point to # the right files). -import string, os.path, os, sys +import os.path, os, sys try: import portage except ImportError: @@ -23,7 +23,7 @@ def CONTENTScheck(path): sys.exit(1) lines = contents.readlines() for line in lines: - items = string.split(line) + items = line.split() # items is a list w/ size depending on the type of item listed in item[0] # if items[0] = 'dir' then items[1] is the path of a directory # if items[0] = 'obj' then items[1] is the path of a file, @@ -34,9 +34,9 @@ def CONTENTScheck(path): # items[3] is the file the symlink should point to # items[4] is the symlink mtime if (items[0] == 'obj'): - md5stored = string.lower(items[2]) + md5stored = items[2].lower() # fchksum.fmdft(file) returns the file's md5sum and the file's size - md5real = string.lower(portage.perform_checksum(items[1])[0]) + md5real = portage.perform_checksum(items[1])[0].lower() if (md5stored != md5real): if md5real: print "%s has md5sum of %s instead of %s" % (items[1], md5real, md5stored) diff --git a/bin/dispatch-conf b/bin/dispatch-conf index c5b27b728..eee066442 100755 --- a/bin/dispatch-conf +++ b/bin/dispatch-conf @@ -17,7 +17,7 @@ if not hasattr(__builtins__, "set"): from stat import * from random import * -import atexit, commands, os, re, shutil, stat, string, sys +import atexit, commands, os, re, shutil, stat, sys try: import portage except ImportError: @@ -362,6 +362,6 @@ d = dispatch () if len(sys.argv) > 1: # for testing - d.grind (string.join (sys.argv [1:])) + d.grind ("".join( (sys.argv [1:])) else: d.grind (portage.settings ['CONFIG_PROTECT']) diff --git a/bin/dohtml b/bin/dohtml index f9c6e33ac..bb4789d64 100755 --- a/bin/dohtml +++ b/bin/dohtml @@ -30,7 +30,6 @@ # import os -import string import sys import types @@ -95,11 +94,11 @@ def print_help(): print " [-r] [-V] [file ...]" print print " -a Set the list of allowed to those that are specified." - print " Default:", string.join(opts.allowed_exts, ",") + print " Default:", ",".join(opts.allowed_exts) print " -A Extend the list of allowed file types." print " -f Set list of allowed extensionless file names." print " -x Set directories to be excluded from recursion." - print " Default:", string.join(opts.disallowed_dirs, ",") + print " Default:", ",".join(opts.disallowed_dirs) print " -r Install files and directories recursively." print " -V Be verbose." print @@ -127,7 +126,7 @@ def parse_args(): elif arg == "-p": options.doc_prefix = sys.argv[x] else: - values = string.split(sys.argv[x], ",") + values = sys.argv[x].split(",") if arg == "-A": options.allowed_exts.extend(values) elif arg == "-a": diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 5e77aa602..f4d0b5bef 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -431,6 +431,7 @@ diefunc() { echo >&2 echo "!!! ${*:-(no error message)}" >&2 echo "!!! If you need support, post the topmost build error, and the call stack if relevant." >&2 + echo "!!! A complete build log is located at '${PORTAGE_LOG_FILE}'." >&2 echo >&2 if [ -n "${EBUILD_OVERLAY_ECLASSES}" ] ; then echo "This ebuild used the following eclasses from overlays:" >&2 diff --git a/bin/md5check.py b/bin/md5check.py index e9c36cf7f..220ef8308 100755 --- a/bin/md5check.py +++ b/bin/md5check.py @@ -3,7 +3,7 @@ # Distributed under the terms of the GNU General Public License v2 # $Id: /var/cvsroot/gentoo-src/portage/bin/md5check.py,v 1.4 2004/10/10 10:07:20 carpaski Exp $ -import os,sys,string +import os,sys os.environ["FEATURES"]="mirror cvs" try: import portage @@ -33,10 +33,10 @@ for mycp in portage.db["/"]["porttree"].dbapi.cp_all(): hugelist.sort() for mycpv in hugelist: - pv = string.split(mycpv, "/")[-1] + pv = mycpv.split("/")[-1] newuri = portage.db["/"]["porttree"].dbapi.aux_get(mycpv,["SRC_URI"])[0] - newuri = string.split(newuri) + newuri = newuri.split() digestpath = portage.db["/"]["porttree"].dbapi.findname(mycpv) digestpath = os.path.dirname(digestpath)+"/files/digest-"+pv @@ -79,8 +79,8 @@ for mycpv in hugelist: (md5_list[mybn]["size"] != md5sums[mybn]["size"]): # This associates teh md5 with each file. [md5/size] - md5joins = string.split(md5_list[mybn][2],",") - md5joins = string.join(md5joins," ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"],") + md5joins = md5_list[mybn][2].split(",") + md5joins = " ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"],".join(md5joins)) md5joins += " ["+md5_list[mybn][0]+"/"+md5_list[mybn][1]+"]" portage.writemsg("Colliding md5: %s of %s [%s/%s] and %s\n" % (mybn,mycpv,md5sums[mybn][0],md5sums[mybn][1],md5joins)) diff --git a/bin/portageq b/bin/portageq index 8f067181b..55723e10a 100755 --- a/bin/portageq +++ b/bin/portageq @@ -21,8 +21,7 @@ except KeyboardInterrupt: import os -import types,string - +import types #----------------------------------------------------------------------------- # @@ -179,7 +178,7 @@ def match(argv): print "ERROR: insufficient parameters!" sys.exit(2) try: - print string.join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1]),"\n") + print "\n".join(portage.db[argv[0]]["vartree"].dbapi.match(argv[1])) except KeyError: sys.exit(1) match.uses_root = True @@ -269,7 +268,7 @@ def envvar(argv): def usage(argv): rev="$Revision: 1.13.2.1 $" - ver=string.split(rev, ' ')[1] + ver= rev.split(' ')[1] print ">>> Portage information query tool -- version "+ver print ">>> Usage: portageq [