Simplify the confmem logic so that it's easier to read.
authorZac Medico <zmedico@gentoo.org>
Fri, 15 Sep 2006 02:07:18 +0000 (02:07 -0000)
committerZac Medico <zmedico@gentoo.org>
Fri, 15 Sep 2006 02:07:18 +0000 (02:07 -0000)
svn path=/main/trunk/; revision=4450

pym/portage.py

index 3d8acf3ae47f06af1e40beffb98e049a3a946c97..537850699a3da09be56acc327eba8aba857fea86 100644 (file)
@@ -6316,39 +6316,25 @@ class dblink:
                                                if myppath:
                                                        # we have a protection path; enable config file management.
                                                        destmd5=portage_checksum.perform_md5(mydest,calc_prelink=1)
-                                                       cycled=0
-                                                       if cfgfiledict.has_key(myrealdest):
-                                                               if destmd5 in cfgfiledict[myrealdest]:
-                                                                       #cycle
-                                                                       print "cycle"
-                                                                       del cfgfiledict[myrealdest]
-                                                                       cycled=1
                                                        if mymd5==destmd5:
                                                                #file already in place; simply update mtimes of destination
                                                                os.utime(mydest,(thismtime,thismtime))
                                                                zing="---"
                                                                moveme=0
-                                                       elif cycled:
-                                                               #mymd5!=destmd5 and we've cycled; move mysrc into place as a ._cfg file
-                                                               moveme=1
-                                                               cfgfiledict[myrealdest]=[mymd5]
-                                                               cfgprot=1
-                                                       elif cfgfiledict.has_key(myrealdest) and (mymd5 in cfgfiledict[myrealdest]):
-                                                               #myd5!=destmd5, we haven't cycled, and the file we're merging has been already merged previously
-                                                               zing="-o-"
-                                                               moveme=cfgfiledict["IGNORE"]
-                                                               cfgprot=cfgfiledict["IGNORE"]
                                                        else:
-                                                               #mymd5!=destmd5, we haven't cycled, and the file we're merging hasn't been merged before
-                                                               moveme=1
-                                                               cfgprot=1
-                                                               if not cfgfiledict.has_key(myrealdest):
-                                                                       cfgfiledict[myrealdest]=[]
-                                                               if mymd5 not in cfgfiledict[myrealdest]:
-                                                                       cfgfiledict[myrealdest].append(mymd5)
-                                                               # only record the last md5
-                                                               if len(cfgfiledict[myrealdest])>1:
-                                                                       del cfgfiledict[myrealdest][0]
+                                                               if mymd5 == cfgfiledict.get(myrealdest, [None])[0]:
+                                                                       """ An identical update has previously been
+                                                                       merged.  Skip it unless the user has chosen
+                                                                       --noconfmem."""
+                                                                       zing = "-o-"
+                                                                       moveme = cfgfiledict["IGNORE"]
+                                                                       cfgprot = cfgfiledict["IGNORE"]
+                                                               else:
+                                                                       moveme = 1
+                                                                       cfgprot = 1
+                                                       if moveme:
+                                                               # Merging a new file, so update confmem.
+                                                               cfgfiledict[myrealdest] = [mymd5]
                                                if cfgprot:
                                                        mydest = new_protect_filename(mydest, newmd5=mymd5)