diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-02-12 21:09:49 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-02-12 21:09:49 +0000 |
commit | 0c2f641f7f9e67b9a86e5e8688bb0fb7aa3beda3 (patch) | |
tree | a30f8fd9d28295d458093e25c63eca2a42f9665d | |
parent | d164a10e2d5a3aece91b9e05d7c26842de3b4f93 (diff) | |
download | portage-0c2f641f7f9e67b9a86e5e8688bb0fb7aa3beda3.tar.gz portage-0c2f641f7f9e67b9a86e5e8688bb0fb7aa3beda3.tar.bz2 portage-0c2f641f7f9e67b9a86e5e8688bb0fb7aa3beda3.zip |
use write_atomic for fixdbentries
svn path=/main/trunk/; revision=2698
-rw-r--r-- | pym/portage.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pym/portage.py b/pym/portage.py index 4c574b3f0..2b9868aca 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -3654,7 +3654,8 @@ def fixdbentries(old_value, new_value, dbdir): """python replacement for the fixdbentries script, replaces old_value with new_value for package names in files in dbdir.""" for myfile in [f for f in os.listdir(dbdir) if not f == "CONTENTS"]: - f = open(dbdir+"/"+myfile, "r") + file_path = os.path.join(dbdir, myfile) + f = open(file_path, "r") mycontent = f.read() f.close() if not mycontent.count(old_value): @@ -3664,9 +3665,7 @@ def fixdbentries(old_value, new_value, dbdir): mycontent = re.sub(old_value+"(\\s)", new_value+"\\1", mycontent) mycontent = re.sub(old_value+"(-[^a-zA-Z])", new_value+"\\1", mycontent) mycontent = re.sub(old_value+"([^a-zA-Z0-9-])", new_value+"\\1", mycontent) - f = open(dbdir+"/"+myfile, "w") - f.write(mycontent) - f.close() + write_atomic(file_path, mycontent) class packagetree: def __init__(self,virtual,clone=None): |