From 6cf95c2447ad2748dc9e8eab721e721f5dd22fd3 Mon Sep 17 00:00:00 2001 From: fuzzyray Date: Wed, 20 May 2009 21:12:34 +0000 Subject: [PATCH] Some python tweaks to speed glsa-check svn path=/branches/gentoolkit-0.2.4/; revision=644 --- src/glsa-check/glsa-check | 2 +- src/glsa-check/glsa.py | 37 ++++++++++++------------------------- 2 files changed, 13 insertions(+), 26 deletions(-) diff --git a/src/glsa-check/glsa-check b/src/glsa-check/glsa-check index 24e2dcf..b5982cf 100755 --- a/src/glsa-check/glsa-check +++ b/src/glsa-check/glsa-check @@ -132,7 +132,7 @@ if mode == "help" or mode == "HELP": sys.stderr.write("\n" + msg) sys.exit(1) -# we need root priviledges for write access +# we need root privileges for write access if mode in ["fix", "inject"] and os.geteuid() != 0: sys.stderr.write(__program__ + ": root access is needed for \""+mode+"\" mode\n") sys.exit(2) diff --git a/src/glsa-check/glsa.py b/src/glsa-check/glsa.py index ec2a679..7c0dee2 100644 --- a/src/glsa-check/glsa.py +++ b/src/glsa-check/glsa.py @@ -18,6 +18,7 @@ import sys import urllib import codecs import re +import operator import xml.dom.minidom from StringIO import StringIO @@ -153,7 +154,7 @@ def get_glsa_list(repository, myconfig): for f in dirlist: try: - if f[:len(prefix)] == prefix: + if f[:len(prefix)] == prefix and f[-1*len(suffix):] == suffix: rValue.append(f[len(prefix):-1*len(suffix)]) except IndexError: pass @@ -168,13 +169,11 @@ def getListElements(listnode): @rtype: List of Strings @return: a list that contains the value of the
  • elements """ - rValue = [] if not listnode.nodeName in ["ul", "ol"]: raise GlsaFormatException("Invalid function call: listnode is not