summaryrefslogtreecommitdiff
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
parentUse the env's PROMPT_COMMAND for resetting xterm titles when available. (diff)
downloadportage-multirepo-0f6bb75975aeb321480cd66ed7a8c80b4e27694c.tar.gz
portage-multirepo-0f6bb75975aeb321480cd66ed7a8c80b4e27694c.tar.bz2
portage-multirepo-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 0b862379..ab665ce6 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