All of lore.kernel.org
 help / color / mirror / Atom feed
From: daniel.sangorrin@toshiba.co.jp (daniel.sangorrin at toshiba.co.jp)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [cip-kernel-sec 3/6] report_affected: fix code when branches are specified
Date: Wed, 10 Jul 2019 01:28:39 +0000	[thread overview]
Message-ID: <OSBPR01MB3077BA36398A4378C784B85ED0F00@OSBPR01MB3077.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <1561752543.21054.80.camel@codethink.co.uk>

> From: Ben Hutchings <ben.hutchings@codethink.co.uk>
> On Tue, 2019-06-25 at 12:26 +0900, Daniel Sangorrin wrote:
> > The previous code could not handle branches with names
> > other than stable branch names. For example, passing
> > "linux-4.4.y-cip" as a branch would return an error.
> [...]
> > --- a/scripts/report_affected.py
> > +++ b/scripts/report_affected.py
> > @@ -18,14 +18,17 @@ import kernel_sec.version
> >
> > ?def main(git_repo, remotes,
> > ??????????only_fixed_upstream, include_ignored, *branch_names):
> > +????live_branches = kernel_sec.branch.get_live_branches()
> > ?????if branch_names:
> > -????????# Support stable release strings as shorthand for stable branches
> > -????????branches = [kernel_sec.branch.get_base_ver_stable_branch(name)
> > -????????????????????if name[0].isdigit()
> > -????????????????????else kernel_sec.branch.get_stable_branch(name)
> > -????????????????????for name in branch_names]
> > +????????branches = []
> > +????????for branch in live_branches:
> > +????????????for name in branch_names:
> > +????????????????if name[0].isdigit():
> > +????????????????????name = 'linux-%s.y' % name
> > +????????????????if branch['short_name'] == name:
> > +????????????????????branches.append(branch)
> [...]
> 
> This results in quietly skipping arguments that don't match any known
> branch.  The current behaviour (failing with a TypeError) is not good
> but I think failing quietly is worse.

I was taking the approach of "doing as much as possible". Something like what a recovery tool does on a disk with broken sectors: if a broken sector is found skip it.

In the new version, the script will raise an argument error if it cannot find the corresponding stable branch.

Thanks,
Daniel


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

  reply	other threads:[~2019-07-10  1:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-25  3:26 [cip-dev] fixes and support for tags Daniel Sangorrin
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 1/6] check_git_repo: add checks to the local repository Daniel Sangorrin
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 2/6] prepare_remotes: helper script to prepare local repo Daniel Sangorrin
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 3/6] report_affected: fix code when branches are specified Daniel Sangorrin
2019-06-28 20:09   ` Ben Hutchings
2019-07-10  1:28     ` daniel.sangorrin at toshiba.co.jp [this message]
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 4/6] report_affected: check user supplied branch names Daniel Sangorrin
2019-06-28 20:12   ` Ben Hutchings
2019-07-10  1:29     ` daniel.sangorrin at toshiba.co.jp
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 5/6] report_affected: add support for reporting on tags Daniel Sangorrin
2019-06-28 20:46   ` Ben Hutchings
2019-07-10  1:36     ` daniel.sangorrin at toshiba.co.jp
2019-06-25  3:26 ` [cip-dev] [cip-kernel-sec 6/6] pep8: fix pep8-related errors such as too long lines Daniel Sangorrin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=OSBPR01MB3077BA36398A4378C784B85ED0F00@OSBPR01MB3077.jpnprd01.prod.outlook.com \
    --to=daniel.sangorrin@toshiba.co.jp \
    --cc=cip-dev@lists.cip-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.