summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Stubbs <jstubbs@gentoo.org>2005-12-25 08:04:56 +0000
committerJason Stubbs <jstubbs@gentoo.org>2005-12-25 08:04:56 +0000
commit0f6bb75975aeb321480cd66ed7a8c80b4e27694c (patch)
treec3ce6b0e123eec2159d6d8cdff258cb7a1ffd64d
parentb3131da61a07d55f06938378a6be38f9cbd69381 (diff)
downloadportage-0f6bb75975aeb321480cd66ed7a8c80b4e27694c.tar.gz
portage-0f6bb75975aeb321480cd66ed7a8c80b4e27694c.tar.bz2
portage-0f6bb75975aeb321480cd66ed7a8c80b4e27694c.zip
Factor out mtimedb saving code from portageexit() into a new commit_mtimedb
function and call that rather than portageexit() after package updates. svn path=/main/trunk/; revision=2455
-rw-r--r--pym/portage.py42
1 files changed, 22 insertions, 20 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 0b8623796..ab665ce64 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -6830,29 +6830,31 @@ def do_upgrade(mykey):
myworld.close()
print ""
+def commit_mtimedb():
+ if mtimedb:
+ # Store mtimedb
+ mymfn=mtimedbfile
+ try:
+ mtimedb["version"]=VERSION
+ cPickle.dump(mtimedb, open(mymfn,"w"), -1)
+ except SystemExit, e:
+ raise
+ except Exception, e:
+ pass
+
+ try:
+ os.chown(mymfn,uid,portage_gid)
+ os.chmod(mymfn,0664)
+ except SystemExit, e:
+ raise
+ except Exception, e:
+ pass
+
def portageexit():
global uid,portage_gid,portdb,db
if secpass and not os.environ.has_key("SANDBOX_ACTIVE"):
close_portdbapi_caches()
-
- if mtimedb:
- # Store mtimedb
- mymfn=mtimedbfile
- try:
- mtimedb["version"]=VERSION
- cPickle.dump(mtimedb, open(mymfn,"w"), -1)
- except SystemExit, e:
- raise
- except Exception, e:
- pass
-
- try:
- os.chown(mymfn,uid,portage_gid)
- os.chmod(mymfn,0664)
- except SystemExit, e:
- raise
- except Exception, e:
- pass
+ commit_mtimedb()
atexit.register(portageexit)
@@ -6878,7 +6880,7 @@ if (secpass==2) and (not os.environ.has_key("SANDBOX_ACTIVE")):
(settings["PORTAGE_CALLER"] == "fixpackages"):
didupdate=1
do_upgrade(mykey)
- portageexit() # This lets us save state for C-c.
+ commit_mtimedb() # This lets us save state for C-c.
except OSError:
#directory doesn't exist
pass