# Jeremy Wohl's dispatch-conf script and the portage chkcontents script.
#
-import os, sys, string
+import os, sys
try:
import portage
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')
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
# 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:
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,
# 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)
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:
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'])
#
import os
-import string
import sys
import types
print " [-r] [-V] <file> [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
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":
# Distributed under the terms of the GNU General Public License v2
# $Id$
-import os,sys,string
+import os,sys
os.environ["FEATURES"]="mirror cvs"
try:
import portage
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
(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))
import os
-import types,string
-
+import types
#-----------------------------------------------------------------------------
#
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 ValueError, e:
# Multiple matches thrown from cpv_expand
pkgs = e.args[0]
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 <command> [<option> ...]"
print ""
print ""
continue
- lines = string.split(doc, '\n')
- print " "+name+" "+string.strip(lines[0])
+ lines = doc.split("\n")
+ print " "+name+" "+lines[0].strip()
if (len(sys.argv) > 1):
if ("--help" not in sys.argv):
lines = lines[:-1]
for line in lines[1:]:
- print " "+string.strip(line)
+ print " "+line.strip()
if (len(sys.argv) == 1):
print "\nRun portageq with --help for info"
except ImportError:
sys.path.insert(0, "/usr/lib/portage/pym")
import portage
-import string, re
+import re
__candidatematcher__ = re.compile("^[0-9]+: \\*\\*\\* emerge ")
__noncandidatematcher__ = re.compile(" sync( |$)| clean( |$)| search( |$)|--oneshot|--fetchonly| unmerge( |$)")