Avoid permission errors when trying to lock repo_path. Note that the lock file shoul...
authorZac Medico <zmedico@gentoo.org>
Sat, 19 May 2007 07:56:24 +0000 (07:56 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 19 May 2007 07:56:24 +0000 (07:56 -0000)
svn path=/main/trunk/; revision=6555

pym/portage/news.py

index 0bb12c5edd1902614e9effe420f82b563413677e..327fe15f4d9377e04be50f85dfd42c94f34b4530 100644 (file)
@@ -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):