diff -urN portage-orig/pym/portage.py portage/pym/portage.py --- portage-orig/pym/portage.py 2004-06-19 18:18:49.000000000 -0500 +++ portage/pym/portage.py 2004-06-20 17:31:16.078233768 -0500 @@ -5743,39 +5743,29 @@ myc.close() pos=1 for line in mylines: - mydat = string.split(line) + if line[-1] == "\n": + mydat = line[:-1].split("\t") + else: + mydat = line.split("\t") + # we do this so we can remove from non-root filesystems # (use the ROOT var to allow maintenance on other partitions) try: - mydat[1]=os.path.normpath(root+mydat[1][1:]) + #for whatever goofy reason, this can return //blah/tmp + #hence this fix + mydat[1]=os.path.normpath(root + mydat[1]).replace('//','/') if mydat[0]=="obj": - #format: type, mtime, md5sum - pkgfiles[string.join(mydat[1:-2]," ")]=[mydat[0], mydat[-1], mydat[-2]] + #format: type, md5sum, mtime + pkgfiles[str(mydat[1])]=[mydat[0], mydat[3], mydat[2]] elif mydat[0]=="dir": #format: type - pkgfiles[string.join(mydat[1:])]=[mydat[0] ] - elif mydat[0]=="sym": + pkgfiles[str(mydat[1])]=[mydat[0]] + elif mydat[0] == "sym": #format: type, mtime, dest - x=len(mydat)-1 - if (x >= 13) and (mydat[-1][-1]==')'): # Old/Broken symlink entry - mydat = mydat[:-10]+[mydat[-10:][ST_MTIME][:-1]] - writemsg("FIXED SYMLINK LINE: %s\n" % mydat, 1) - x=len(mydat)-1 - splitter=-1 - while(x>=0): - if mydat[x]=="->": - splitter=x - break - x=x-1 - if splitter==-1: - return None - pkgfiles[string.join(mydat[1:splitter]," ")]=[mydat[0], mydat[-1], string.join(mydat[(splitter+1):-1]," ")] - elif mydat[0]=="dev": + pkgfiles[mydat[1]] = [mydat[0], mydat[3], mydat[2]] + elif mydat[0] in ["dev", "fif"]: #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0] ] - elif mydat[0]=="fif": - #format: type - pkgfiles[string.join(mydat[1:]," ")]=[mydat[0]] + pkgfiles[mydat[1]]=[mydat[0]] else: return None except (KeyError,IndexError): @@ -5871,7 +5861,7 @@ #we skip this if we're dealing with a symlink #because os.path.exists() will operate on the #link target rather than the link itself. - print "--- !found "+str(pkgfiles[obj][0]), obj + print "--- !found %s '%s'" % (str(pkgfiles[obj][0]), str(obj)) continue # next line includes a tweak to protect modules from being unmerged, # but we don't protect modules from being overwritten if they are @@ -5879,52 +5869,53 @@ # functionality for /lib/modules. For portage-ng both capabilities # should be able to be independently specified. if self.isprotected(obj) or ((len(obj) > len(modprotect)) and (obj[0:len(modprotect)]==modprotect)): - print "--- cfgpro "+str(pkgfiles[obj][0]), obj + print "--- cfgpro %s '%s'" % (str(pkgfiles[obj][0]), str(obj)) continue lstatobj=os.lstat(obj) lmtime=str(lstatobj[ST_MTIME]) + if (pkgfiles[obj][0] not in ("dir","fif","dev","sym")) and (lmtime != pkgfiles[obj][1]): - print "--- !mtime", pkgfiles[obj][0], obj + print "--- !mtime %s '%s'" % (str(pkgfiles[obj][0]), str(obj)) continue if pkgfiles[obj][0]=="dir": if not os.path.isdir(obj): - print "--- !dir ","dir", obj + print "--- !dir dir '%s'" % str(obj) continue mydirs.append(obj) elif pkgfiles[obj][0]=="sym": if not os.path.islink(obj): - print "--- !sym ","sym", obj + print "--- !sym sym '%s'" % str(obj) continue mysyms.append(obj) elif pkgfiles[obj][0]=="obj": if not os.path.isfile(obj): - print "--- !obj ","obj", obj + print "--- !obj obj '%s'" % str(obj) continue mymd5=perform_md5(obj, calc_prelink=1) # string.lower is needed because db entries used to be in upper-case. The # string.lower allows for backwards compatibility. if mymd5 != string.lower(pkgfiles[obj][2]): - print "--- !md5 ","obj", obj + print "--- !md5 obj '%s'" % str(obj) continue try: os.unlink(obj) except (OSError,IOError),e: pass - print "<<< ","obj",obj + print "<<< obj '%s'" % str(obj) elif pkgfiles[obj][0]=="fif": if not S_ISFIFO(lstatobj[ST_MODE]): - print "--- !fif ","fif", obj + print "--- !fif fif '%s'" % str(obj) continue try: os.unlink(obj) except (OSError,IOError),e: pass - print "<<< ","fif",obj + print "<<< fif '%s'" % str(obj) elif pkgfiles[obj][0]=="dev": - print "--- ","dev",obj + print "--- dev '%s'" % str(obj) #Now, we need to remove symlinks and directories. We'll repeatedly #remove dead symlinks, then directories until we stop making progress. @@ -5954,9 +5945,9 @@ progress = 1 try: os.unlink(obj) - print "<<< ","sym",obj + print "<<< sym '%s'" % str(obj) except (OSError,IOError),e: - print "!!! ","sym",obj + print "!!! sym '%s'" %str(obj) #immutable? pass @@ -5984,12 +5975,12 @@ progress = 1 try: os.rmdir(obj) - print "<<< ","dir",obj + print "<<< dir '%s'" % str(obj) except (OSError,IOError),e: #immutable? pass #else: - # print "--- !empty","dir", obj + # print "--- !empty dir '%s'" % str(obj) # continue #step 3: if we've made progress, we'll give this another go... @@ -5998,11 +5989,11 @@ #directories that aren't empty: for x in mydirs: - print "--- !empty dir", x + print "--- !empty dir '%s'" % str(x) #symlinks whose target still exists: for x in mysyms: - print "--- !targe sym", x + print "--- !targe sym '%s'" % str(x) #step 5: well, removal of package objects is complete, now for package *meta*-objects.... @@ -6041,7 +6032,7 @@ a=doebuild(myebuildpath,"postrm",self.myroot,self.settings,use_cache=0) # XXX: Decide how to handle failures here. if a != 0: - writemsg("!!! FAILED postrm: "+str(a)+"\n") + writemsg("!!! FAILED postrm: '%s'\n" % str(a)) sys.exit(123) self.unlockdb() @@ -6407,11 +6398,11 @@ # unlinking no longer necessary; "movefile" will overwrite symlinks atomically and correctly mymtime=movefile(mysrc,mydest,thismtime,mystat, mysettings=self.settings) if mymtime!=None: - print ">>>",mydest,"->",myto - outfile.write("sym "+myrealdest+" -> "+myto+" "+str(mymtime)+"\n") + print ">>> '%s' -> '%s'" % (str(mydest), str(myto)) + outfile.write("sym\t"+myrealdest+"\t->\t "+myto+"\t"+str(mymtime)+"\n") else: print "!!! Failed to move file." - print "!!!",mydest,"->",myto + print "!!! '%s' -> '%s'" (str(mydest), str(myto)) sys.exit(1) elif S_ISDIR(mymode): # we are merging a directory @@ -6428,7 +6419,7 @@ if S_ISLNK(mydmode) or S_ISDIR(mydmode): # a symlink to an existing directory will work for us; keep it: - print "---",mydest+"/" + print "--- '%s/'" % mydest else: # a non-directory and non-symlink-to-directory. Won't work for us. Move out of the way. if movefile(mydest,mydest+".backup", mysettings=self.settings) == None: @@ -6438,14 +6429,14 @@ os.mkdir(mydest) os.chmod(mydest,mystat[0]) os.chown(mydest,mystat[4],mystat[5]) - print ">>>",mydest+"/" + print ">>> '%s/'" % mydest else: #destination doesn't exist os.mkdir(mydest) os.chmod(mydest,mystat[0]) os.chown(mydest,mystat[4],mystat[5]) - print ">>>",mydest+"/" - outfile.write("dir "+myrealdest+"\n") + print ">>> '%s/'" % mydest + outfile.write("dir\t"+myrealdest+"\n") # recurse and merge this directory if self.mergeme(srcroot,destroot,outfile,secondhand,offset+x+"/",cfgfiledict,thismtime): return 1 @@ -6461,7 +6452,7 @@ if S_ISDIR(mydmode): # install of destination is blocked by an existing directory with the same name moveme=0 - print "!!!",mydest + print "!!! '%s'" % mydest elif S_ISREG(mydmode): cfgprot=0 # install of destination is blocked by an existing regular file; @@ -6522,8 +6513,8 @@ zing="---" if mymtime!=None: zing=">>>" - outfile.write("obj "+myrealdest+" "+mymd5+" "+str(mymtime)+"\n") - print zing,mydest + outfile.write("obj\t"+myrealdest+"\t"+mymd5+"\t"+str(mymtime)+"\n") + print "%s '%s'" % (zing,mydest) else: # we are merging a fifo or device node zing="!!!" @@ -6534,10 +6525,10 @@ if S_ISFIFO(mymode): # we don't record device nodes in CONTENTS, # although we do merge them. - outfile.write("fif "+myrealdest+"\n") + outfile.write("fif\t"+myrealdest+"\n") else: sys.exit(1) - print zing+" "+mydest + print "%s '%s'" % (zing, mydest) def merge(self,mergeroot,inforoot,myroot,myebuild=None,cleanup=0): return self.treewalk(mergeroot,myroot,inforoot,myebuild,cleanup=cleanup)