* [cip-dev] [cip-kernel-sec] report_affected: report cip branches
@ 2019-06-20 6:13 Daniel Sangorrin
2019-06-20 19:51 ` Ben Hutchings
0 siblings, 1 reply; 3+ messages in thread
From: Daniel Sangorrin @ 2019-06-20 6:13 UTC (permalink / raw)
To: cip-dev
Allow reporting on cip branches, instead of returning an
error like this one:
$ ./scripts/report_affected.py linux-4.4.y-cip
Traceback (most recent call last):
File "./scripts/report_affected.py", line 105, in <module>
args.only_fixed_upstream, args.include_ignored, *args.branches)
File "./scripts/report_affected.py", line 33, in main
branches.sort(key=kernel_sec.branch.get_sort_key)
File "./scripts/kernel_sec/branch.py", line 146, in get_sort_key
base_ver = branch['base_ver']
TypeError: 'NoneType' object is not subscriptable
Signed-off-by: Daniel Sangorrin <daniel.sangorrin@toshiba.co.jp>
---
scripts/kernel_sec/branch.py | 19 +++++++++++++++++--
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/scripts/kernel_sec/branch.py b/scripts/kernel_sec/branch.py
index fb8785c..828de13 100644
--- a/scripts/kernel_sec/branch.py
+++ b/scripts/kernel_sec/branch.py
@@ -22,6 +22,7 @@ from . import version
_STABLE_BRANCH_RE = re.compile(r'^linux-([\d.]+)\.y$')
+_CIP_BRANCH_RE = re.compile(r'^linux-([\d.]+)\.y-cip$')
def get_base_ver_stable_branch(base_ver):
@@ -34,9 +35,23 @@ def get_base_ver_stable_branch(base_ver):
}
+def get_base_ver_cip_branch(base_ver):
+ branch_name = 'linux-%s.y-cip' % base_ver
+ return {
+ 'short_name': branch_name,
+ 'git_remote': 'cip',
+ 'git_name': branch_name,
+ 'base_ver': base_ver
+ }
+
+
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))
def _extract_live_stable_branches(doc):
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [cip-dev] [cip-kernel-sec] report_affected: report cip branches
2019-06-20 6:13 [cip-dev] [cip-kernel-sec] report_affected: report cip branches Daniel Sangorrin
@ 2019-06-20 19:51 ` Ben Hutchings
2019-06-20 20:03 ` Ben Hutchings
0 siblings, 1 reply; 3+ messages in thread
From: Ben Hutchings @ 2019-06-20 19:51 UTC (permalink / raw)
To: cip-dev
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
Ben.
--
Ben Hutchings, Software Developer ? Codethink Ltd
https://www.codethink.co.uk/ Dale House, 35 Dale Street
Manchester, M1 2HF, United Kingdom
^ permalink raw reply [flat|nested] 3+ messages in thread
* [cip-dev] [cip-kernel-sec] report_affected: report cip branches
2019-06-20 19:51 ` Ben Hutchings
@ 2019-06-20 20:03 ` Ben Hutchings
0 siblings, 0 replies; 3+ messages in thread
From: Ben Hutchings @ 2019-06-20 20:03 UTC (permalink / raw)
To: cip-dev
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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-20 20:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-20 6:13 [cip-dev] [cip-kernel-sec] report_affected: report cip branches Daniel Sangorrin
2019-06-20 19:51 ` Ben Hutchings
2019-06-20 20:03 ` Ben Hutchings
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.