[Git][security-tracker-team/security-tracker][master] 5 commits: sectracker.parsers: unconditionally import intern

Emilio Pozuelo Monfort pochu at debian.org
Fri Dec 4 11:12:38 GMT 2020



Emilio Pozuelo Monfort pushed to branch master at Debian Security Tracker / security-tracker


Commits:
8e80d866 by Emilio Pozuelo Monfort at 2020-12-04T12:12:09+01:00
sectracker.parsers: unconditionally import intern

We no longer support Python 2.

- - - - -
a804b9e0 by Emilio Pozuelo Monfort at 2020-12-04T12:12:09+01:00
sectracker.parsers: use _sortedtuple

- - - - -
8f844bff by Emilio Pozuelo Monfort at 2020-12-04T12:12:09+01:00
sectracker.parsers: there's no 'bug filed' urgency

That may have been used once upon a time, but it's not used anymore.

- - - - -
e2bbe5fe by Emilio Pozuelo Monfort at 2020-12-04T12:12:09+01:00
sectracker.parsers: fix innerdispatch callback

The signature no longer includes a bugs list.

- - - - -
09cc1a53 by Emilio Pozuelo Monfort at 2020-12-04T12:12:09+01:00
sectracker.parsers: rename version to kind in package_pseudo

The version is tracked in package_version, here we have a <tag>
assigned to the kind variable of the PackageAnnotation, so let's
call it kind to make it less confusing.

- - - - -


1 changed file:

- lib/python/sectracker/parsers.py


Changes:

=====================================
lib/python/sectracker/parsers.py
=====================================
@@ -18,11 +18,7 @@
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
 import re
-
-try:
-    from sys import intern
-except:
-    pass
+from sys import intern
 
 import debian_support
 import sectracker.regexpcase as _regexpcase
@@ -42,9 +38,7 @@ def binarypackages(name, f):
     """Returns a sequence of binary package names"""
     obj = set(v for p in debian_support.PackageFile(name, f)
             for k, v in p if k == "Package")
-    obj = list(obj)
-    obj.sort()
-    return tuple(obj)
+    return _sortedtuple(obj)
 
 SourcePackage = _namedtuple("SourcePackage", "name version binary")
 
@@ -89,8 +83,7 @@ PackageUrgencyAnnotation = _namedtuple("PackageUrgencyAnnotation", "severity")
 
 def _annotationdispatcher():
     # Parser for inner annotations, like (bug #1345; low)
-    urgencies=set("unimportant low medium high".split())
-    @_regexpcase.rule('(bug filed|%s)' % '|'.join(urgencies))
+    @_regexpcase.rule('(unimportant|low|medium|high)')
     def innerflag(groups, diag, flags):
         f = groups[0]
         if PackageUrgencyAnnotation(f) in flags:
@@ -104,7 +97,7 @@ def _annotationdispatcher():
             diag.error("duplicate bug number: " + groups[0])
         else:
             flags.append(PackageBugAnnotation(no))
-    def innerdefault(text, diag, flags, bugs):
+    def innerdefault(text, diag, flags):
         diag.error("invalid inner annotation: " + repr(text))
     innerdispatch = _regexpcase.RegexpCase((innerflag, innerbug),
                                            default=innerdefault)
@@ -149,28 +142,28 @@ def _annotationdispatcher():
     @_regexpcase.rule(r'(?:\[([a-z]+)\]\s)?-\s([A-Za-z0-9:.+-]+)'
                       + r'\s+<([a-z-]+)>\s*(?:\s\((.*)\))?')
     def package_pseudo(groups, diag):
-        release, package, version, inner = groups
-        if version in pseudo_freetext:
+        release, package, kind, inner = groups
+        if kind in pseudo_freetext:
             return PackageAnnotation(
                 line=diag.line(),
                 type="package",
                 release=release,
                 package=package,
-                kind=version,
+                kind=kind,
                 version=None,
                 description=inner,
                 flags=[],
             )
-        elif version in pseudo_struct:
+        elif kind in pseudo_struct:
             flags = parseinner(diag, inner)
-            if version == "itp" and not inner[1]:
+            if kind == "itp" and not inner[1]:
                 diag.error("<itp> needs Debian bug reference")
             return PackageAnnotation(
                 line=diag.line(),
                 type="package",
                 release=release,
                 package=package,
-                kind=version,
+                kind=kind,
                 version=None,
                 description=None,
                 flags=flags,



View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/d8d3de1e365537b63a194eea2d704b43be55a7b2...09cc1a53d00b7f8d4497e66f7d47a64163596577

-- 
View it on GitLab: https://salsa.debian.org/security-tracker-team/security-tracker/-/compare/d8d3de1e365537b63a194eea2d704b43be55a7b2...09cc1a53d00b7f8d4497e66f7d47a64163596577
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-security-tracker-commits/attachments/20201204/e6d0c973/attachment-0001.html>


More information about the debian-security-tracker-commits mailing list