Re: [cip-kernel-sec] report_affected: report cip branches


Ben Hutchings <ben.hutchings@...>
 

On Thu, 2019-06-20 at 20:51 +0100, Ben Hutchings wrote:
On Thu, 2019-06-20 at 15:13 +0900, Daniel Sangorrin wrote:
Allow reporting on cip branches, instead of returning an
error like this one:
[...]
 def get_stable_branch(branch_name):
-    match = _STABLE_BRANCH_RE.match(branch_name)
-    return match and get_base_ver_stable_branch(match.group(1))
+    if 'cip' in branch_name:
+        match = _CIP_BRANCH_RE.match(branch_name)
+        return match and get_base_ver_cip_branch(match.group(1))
+    else:
+        match = _STABLE_BRANCH_RE.match(branch_name)
+        return match and get_base_ver_stable_branch(match.group(1))
[...]

Does this function actually need to know anything about specific branch
names?  It seems like we should be able to implement it as something
like:

    for branch in get_live_branches():
        if branch['short_name'] == branch_name:
            return branch
    return None
In fact it would probably make more sense to get rid of this function
altogether and put that code in reported_affected.py, which can avoid
calling get_live_branches() multiple times.

Ben.

--
Ben Hutchings, Software Developer   Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom

Join {cip-dev@lists.cip-project.org to automatically receive all group messages.