summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-02-19 01:13:57 +0000
committerZac Medico <zmedico@gentoo.org>2006-02-19 01:13:57 +0000
commita412cb5e4449524d7b7b27098552a00ae740f8ef (patch)
tree20fc604fea950fe23829ff254d054a02a3e1358a
parent95003ff31090d5a57d92b4aa8229114510f3bed0 (diff)
downloadportage-a412cb5e4449524d7b7b27098552a00ae740f8ef.tar.gz
portage-a412cb5e4449524d7b7b27098552a00ae740f8ef.tar.bz2
portage-a412cb5e4449524d7b7b27098552a00ae740f8ef.zip
Update the mtimedb only after the updates have been processed.
svn path=/main/trunk/; revision=2738
-rw-r--r--pym/portage.py29
1 files changed, 19 insertions, 10 deletions
diff --git a/pym/portage.py b/pym/portage.py
index aa6dcc6fc..624d60909 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -6822,11 +6822,7 @@ def do_upgrade(mykey):
myupd.append(mysplit)
sys.stdout.write(".")
sys.stdout.flush()
-
- if processed:
- #update our internal mtime since we processed all our directives.
- mtimedb["updates"][mykey]=os.stat(mykey)[stat.ST_MTIME]
- return myupd
+ return myupd, processed == 1
def commit_mtimedb():
if mtimedb:
@@ -6932,16 +6928,22 @@ def global_updates():
didupdate = 0
do_upgrade_packagesmessage = 0
myupd = []
+ timestamps = {}
for myfile in mylist:
mykey = os.path.join(updpath, myfile)
- if not os.path.isfile(mykey):
+ mystat = os.stat(mykey)
+ if not stat.S_ISREG(mystat.st_mode):
continue
if mykey not in mtimedb["updates"] or \
- mtimedb["updates"][mykey] != os.stat(mykey)[stat.ST_MTIME] or \
+ mtimedb["updates"][mykey] != mystat.st_mtime or \
settings["PORTAGE_CALLER"] == "fixpackages":
didupdate = 1
- myupd.extend(do_upgrade(mykey))
-
+ valid_updates, no_errors = do_upgrade(mykey)
+ myupd.extend(valid_updates)
+ if no_errors:
+ # Update our internal mtime since we
+ # processed all of our directives.
+ timestamps[mykey] = mystat.st_mtime
update_config_files(myupd)
db["/"]["bintree"] = binarytree("/", settings["PKGDIR"], virts)
@@ -6957,7 +6959,14 @@ def global_updates():
# The above global updates proceed quickly, so they
# are considered a single mtimedb transaction.
- commit_mtimedb()
+ if len(timestamps) > 0:
+ # We do not update the mtime in the mtimedb
+ # until after _all_ of the above updates have
+ # been processed because the mtimedb will
+ # automatically commit when killed by ctrl C.
+ for mykey, mtime in timestamps.iteritems():
+ mtimedb["updates"][mykey] = mtime
+ commit_mtimedb()
# We gotta do the brute force updates for these now.
if settings["PORTAGE_CALLER"] == "fixpackages" or \