From d042fff18f2b7621dc0ec11c57e9c5b1936c8ca2 Mon Sep 17 00:00:00 2001 From: Marius Mauch Date: Fri, 9 Nov 2007 15:38:48 +0000 Subject: move checkfile parsing into its own function svn path=/main/trunk/; revision=8479 --- pym/portage/glsa.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'pym/portage/glsa.py') diff --git a/pym/portage/glsa.py b/pym/portage/glsa.py index 91f719c8f..2d2f27b30 100644 --- a/pym/portage/glsa.py +++ b/pym/portage/glsa.py @@ -19,6 +19,18 @@ opMapping = {"le": "<=", "lt": "<", "eq": "=", "gt": ">", "ge": ">=", NEWLINE_ESCAPE = "!;\\n" # some random string to mark newlines that should be preserved SPACE_ESCAPE = "!;_" # some random string to mark spaces that should be preserved +def get_applied_glsas(settings): + """ + Return a list of applied or injected GLSA IDs + + @type settings: portage.config + @param settings: portage config instance + @rtype: list + @return: list of glsa IDs + """ + return grabfile(os.path.join(os.sep, settings["ROOT"], CACHE_PATH.lstrip(os.sep), "glsa")) + + # TODO: use the textwrap module instead def wrap(text, width, caption=""): """ @@ -553,8 +565,7 @@ class Glsa: @rtype: Boolean @returns: True if the GLSA was applied, False if not """ - aList = grabfile(os.path.join(os.sep, self.config["ROOT"], CACHE_PATH.lstrip(os.sep), "glsa")) - return (self.nr in aList) + return (self.nr in get_applied_glsas()) def inject(self): """ -- cgit v1.2.3-1-g7c22