summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-09-15 02:07:18 +0000
committerZac Medico <zmedico@gentoo.org>2006-09-15 02:07:18 +0000
commitc838662cf7e4bdbc94e6cbc871df86ba929b1c46 (patch)
tree59da9599c068b321c9ca0f06b37427209ffa4c30
parentb4408eeafe5f78771200079baa454d033e402dc1 (diff)
downloadportage-c838662cf7e4bdbc94e6cbc871df86ba929b1c46.tar.gz
portage-c838662cf7e4bdbc94e6cbc871df86ba929b1c46.tar.bz2
portage-c838662cf7e4bdbc94e6cbc871df86ba929b1c46.zip
Simplify the confmem logic so that it's easier to read.
svn path=/main/trunk/; revision=4450
-rw-r--r--pym/portage.py40
1 files changed, 13 insertions, 27 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 3d8acf3ae..537850699 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -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)