summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-19 07:56:24 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-19 07:56:24 +0000
commite4510e633c9bcf26f6c82606f852927728cf8386 (patch)
treec48ab307317c81d51e0103a20651e4a6f8debe06
parent9386e474d578576f0b49b5c8e7f5dc047e0236c4 (diff)
downloadportage-e4510e633c9bcf26f6c82606f852927728cf8386.tar.gz
portage-e4510e633c9bcf26f6c82606f852927728cf8386.tar.bz2
portage-e4510e633c9bcf26f6c82606f852927728cf8386.zip
Avoid permission errors when trying to lock repo_path. Note that the lock file should be mapped into /var somewhere.
svn path=/main/trunk/; revision=6555
-rw-r--r--pym/portage/news.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/pym/portage/news.py b/pym/portage/news.py
index 0bb12c5ed..327fe15f4 100644
--- a/pym/portage/news.py
+++ b/pym/portage/news.py
@@ -66,7 +66,12 @@ class NewsManager(object):
path = os.path.join(self.portdb.getRepositoryPath(repoid), self.NEWS_PATH)
newsdir_lock = None
try:
- newsdir_lock = lockdir(self.portdb.getRepositoryPath(repoid))
+ repo_path = self.portdb.getRepositoryPath(repoid)
+ if os.access(os.path.dirname(repo_path), os.W_OK):
+ # This lock file should really be mapped into /var somewhere
+ # since the repo_path or it's parent directory may not even be
+ # writable.
+ newsdir_lock = lockdir(repo_path)
# Skip reading news for repoid if the news dir does not exist. Requested by
# NightMorph :)
if not os.path.exists(path):