summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2008-11-12 18:57:49 +0000
committerZac Medico <zmedico@gentoo.org>2008-11-12 18:57:49 +0000
commit5eeeb9606416243788f11836acf19e981853cd43 (patch)
treec6473db759d8af2250d05ae8abc446e61f0eca77
parent3c12e1cd64bfa8ace390f1a42d8e9b5ed3adca55 (diff)
downloadportage-5eeeb9606416243788f11836acf19e981853cd43.tar.gz
portage-5eeeb9606416243788f11836acf19e981853cd43.tar.bz2
portage-5eeeb9606416243788f11836acf19e981853cd43.zip
Inside NewsManager.updateItems(), use a mutable set for skiplist and sort the
contents when writing the file. svn path=/main/trunk/; revision=11864
-rw-r--r--pym/portage/news.py7
1 files 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)