summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-12-20 05:48:39 -0800
committerZac Medico <zmedico@gentoo.org>2010-12-20 06:03:05 -0800
commit468d96a199bb39cf0d7dd5b36e21798e50f7b70e (patch)
tree222ad34fc4ec33b8e27856ec6f1c3bcf715e5ad3
parent70f53f46aba6e0193f61a6e3bf9dbbaa3b9908e0 (diff)
downloadportage-468d96a199bb39cf0d7dd5b36e21798e50f7b70e.tar.gz
portage-468d96a199bb39cf0d7dd5b36e21798e50f7b70e.tar.bz2
portage-468d96a199bb39cf0d7dd5b36e21798e50f7b70e.zip
Use write_atomic to rewrite lafiles.
This should succeed even in some cases in which a normal write might fail due to file permission settings on some operating systems such as HP-UX.
-rw-r--r--pym/portage/package/ebuild/doebuild.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 5bba19ff8..3071cf8d4 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1453,11 +1453,12 @@ def _post_src_install_uid_fix(mysettings, out):
fixlafiles_announced = True
writemsg("Fixing .la files\n", fd=out)
writemsg(" %s\n" % fpath[len(destdir):], fd=out)
- f = open(_unicode_encode(fpath,
+ # write_atomic succeeds even in some cases in which
+ # a normal write might fail due to file permission
+ # settings on some operating systems such as HP-UX
+ write_atomic(_unicode_encode(fpath,
encoding=_encodings['merge'], errors='strict'),
- mode='wb')
- f.write(new_contents)
- f.close()
+ new_contents, mode='wb')
mystat = os.lstat(fpath)
if stat.S_ISREG(mystat.st_mode) and \