summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2009-12-10 00:50:04 +0000
committerZac Medico <zmedico@gentoo.org>2009-12-10 00:50:04 +0000
commitc830f062b69919639eaa6b814eca8b52e3a3436b (patch)
tree7dce0d800bdc37e10cd3ed0cab020593fedeb369
parentDetect cases when long(stat_obj.st_mtime) != stat_obj[stat.ST_MTIME] due to (diff)
downloadportage-idfetch-c830f062b69919639eaa6b814eca8b52e3a3436b.tar.gz
portage-idfetch-c830f062b69919639eaa6b814eca8b52e3a3436b.tar.bz2
portage-idfetch-c830f062b69919639eaa6b814eca8b52e3a3436b.zip
Handle permission problems when trying to cache the remote Packages file
from a binhost. Thanks to Jeremy Olexa <darkside@g.o> for reporting. svn path=/main/trunk/; revision=14997
-rw-r--r--pym/portage/dbapi/bintree.py15
1 files changed, 11 insertions, 4 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index cd5d0b6e..d4039e39 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -739,10 +739,17 @@ class binarytree(object):
if pkgindex is rmt_idx:
pkgindex.modified = False # don't update the header
from portage.util import atomic_ofstream, ensure_dirs
- ensure_dirs(os.path.dirname(pkgindex_file))
- f = atomic_ofstream(pkgindex_file)
- pkgindex.write(f)
- f.close()
+ try:
+ ensure_dirs(os.path.dirname(pkgindex_file))
+ f = atomic_ofstream(pkgindex_file)
+ pkgindex.write(f)
+ f.close()
+ except PortageException:
+ if os.access(os.path.join(
+ self.settings["ROOT"], CACHE_PATH), os.W_OK):
+ raise
+ # The current user doesn't have permission to cache the
+ # file, but that's alright.
if pkgindex:
self._remotepkgs = {}
for d in pkgindex.packages: