From 5eeeb9606416243788f11836acf19e981853cd43 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 12 Nov 2008 18:57:49 +0000 Subject: [PATCH] Inside NewsManager.updateItems(), use a mutable set for skiplist and sort the contents when writing the file. svn path=/main/trunk/; revision=11864 --- pym/portage/news.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pym/portage/news.py b/pym/portage/news.py index 57db9ff41..0363b7197 100644 --- a/pym/portage/news.py +++ b/pym/portage/news.py @@ -77,7 +77,7 @@ class NewsManager(object): news = os.listdir(path) skipfile = os.path.join(self.unread_path, "news-%s.skip" % repoid) - skiplist = frozenset(grabfile(skipfile)) + skiplist = set(grabfile(skipfile)) updates = [] for itemid in news: if itemid in skiplist: @@ -107,12 +107,13 @@ class NewsManager(object): for item in updates: unread_file.write(item.name + "\n") - skiplist.append(item.name) + skiplist.add(item.name) unread_file.close() finally: if unread_lock: unlockfile(unread_lock) - write_atomic(skipfile, "\n".join(skiplist)+"\n") + write_atomic(skipfile, + "".join("%s\n" % x for x in sorted(skiplist))) try: apply_permissions(filename=skipfile, uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664) -- 2.26.2