Fix profile and config arguments to NewsItem.isRelevant() inside NewsManager.updateIt...
authorZac Medico <zmedico@gentoo.org>
Sat, 16 Jun 2007 21:19:11 +0000 (21:19 -0000)
committerZac Medico <zmedico@gentoo.org>
Sat, 16 Jun 2007 21:19:11 +0000 (21:19 -0000)
svn path=/main/trunk/; revision=6862

pym/portage/news.py

index 0288058760c68758d0442678cd1b9bc7250b9cc7..d8df8c294257b5c0c670a3f548bbec84e5c72864 100644 (file)
@@ -36,6 +36,15 @@ class NewsManager(object):
                self.vdb = vardb
                self.portdb = portdb
 
+               portdir = portdb.porttree_root
+               profiles_base = os.path.join(portdir, "profiles") + os.path.sep
+               from portage.util import normalize_path
+               profile_path = normalize_path(
+                       os.path.realpath(portdb.mysettings.profile_path))
+               if profile_path.startswith(profiles_base):
+                       profile_path = profile_path[len(profiles_base):]
+               self._profile_path = profile_path
+
                # Ensure that the unread path exists and is writable.
                dirmode  = 02070
                modemask =    02
@@ -76,7 +85,8 @@ class NewsManager(object):
                                item = NewsItem(filename, itemid, timestamp)
                        except (TypeError, ValueError), e:
                                continue
-                       if item.isRelevant(profile=os.readlink(PROFILE_PATH), config=config, vardb=self.vdb):
+                       if item.isRelevant(profile=self._profile_path,
+                               config=self.config, vardb=self.vdb):
                                updates.append(item)
                del path