ignore "permission denied" errors when changing perms of news skipfile that happen...
authorMarius Mauch <genone@gentoo.org>
Sun, 21 Oct 2007 10:34:35 +0000 (10:34 -0000)
committerMarius Mauch <genone@gentoo.org>
Sun, 21 Oct 2007 10:34:35 +0000 (10:34 -0000)
svn path=/main/trunk/; revision=8202

pym/portage/news.py

index 6f2eac2b2afa09d9a6af7d75315f5526fbfe6cfa..b9326c94d55cc65a69c692f10bef3320d50eaca9 100644 (file)
@@ -100,8 +100,17 @@ class NewsManager(object):
                finally:
                        unlockfile(unread_lock)
                        write_atomic(skipfile, "\n".join(skiplist)+"\n")
-               apply_permissions(filename=skipfile, 
+               try:
+                       apply_permissions(filename=skipfile, 
                                uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664)
+               except OSError, e:
+                       import errno
+                       # skip "permission denied" errors as we're likely running in pretend mode
+                       # with reduced priviledges
+                       if e.errno == errno.EPERM:
+                               pass
+                       else:
+                               raise
 
        def getUnreadItems(self, repoid, update=False):
                """