ACK: [kteam-tools][PATCH] apply-stable-patches: fix kernel version identification in 'Cc: stable'

Kamal Mostafa kamal at canonical.com
Thu Jul 24 16:46:00 UTC 2014


On Thu, 2014-07-24 at 13:45 +0100, Luis Henriques wrote:
> This patch drops the support for identifying the '>', '>=', ... in the
> stable kernel versions in the s-o-b area. 


ACK.  This is a good idea.

 -Kamal


>  This is usually useless: when
> the 'Cc: stable' line in a commit contains a kernel version, it is
> *always* meant to be interpreted as 'applicable to this kernel version and
> above'.
> 
> The code being dropped has been responsible for some applicable patches
> to have been ignored.  For example, when applying a patch containing the
> following (taken from linux commit 97b8ee845393 "ring-buffer: Fix polling
> on trace_pipe"):
> 
>  Cc: stable at vger.kernel.org # 2.6.27
> 
> to stable kernel 3.11, the patch will be identified as not applicable,
> because the code assumes it applies *only* to 2.6.27, which is clearly
> wrong.
> 
> Signed-off-by: Luis Henriques <luis.henriques at canonical.com>
> ---
>  stable/apply-stable-patches | 38 ++++++++------------------------------
>  1 file changed, 8 insertions(+), 30 deletions(-)
> 
> diff --git a/stable/apply-stable-patches b/stable/apply-stable-patches
> index 075cc70c81d3..12f8376c34a0 100755
> --- a/stable/apply-stable-patches
> +++ b/stable/apply-stable-patches
> @@ -182,11 +182,10 @@ class KernelVersion:
>      version = None
>      patchlevel = None
>      sublevel = None
> -    plus = 0
>  
>      # __init__
>      #
> -    def __init__(self, kver, plus):
> +    def __init__(self, kver):
>          if isinstance(kver, basestring):
>              kver = kver.split('.')
>              if len(kver) > 1:
> @@ -206,7 +205,6 @@ class KernelVersion:
>              else:
>                  # sublevel is optional: if not specified, assume 0
>                  self.sublevel = 0
> -        self.plus = plus
>  
>      # compare against current kernel version
>      # returns:
> @@ -351,21 +349,10 @@ class ApplyStablePatches(StdApp):
>                      sline = s.group(0)
>                      s2 = cchint.search(sline)
>                      while s2:
> -                        plus = 0
> -                        if (s2.group('gr')):
> -                            plus = 1
> -                        elif (s2.group('ge') or s2.group('ge') or s2.group('plus')
> -                            or s2.group('later')):
> -                            plus = 2
>                          if 'verbose' in self.cfg:
> -                            pf = ""
> -                            if plus == 1:
> -                                pf = "> "
> -                            elif plus == 2:
> -                                pf = ">= "
> -                            stdo("\ncommit %s is marked for version %s%s" %
> -                                 (c, pf, s2.group('kver')))
> -                        forvers.append(KernelVersion(s2.group('kver'), plus))
> +                            stdo("\ncommit %s is marked for version %s" %
> +                                 (c, s2.group('kver')))
> +                        forvers.append(KernelVersion(s2.group('kver')))
>                          sline = sline[s2.end():]
>                          s2 = cchint.search(sline)
>                      if 'verbose' in self.cfg and forvers:
> @@ -440,7 +427,7 @@ class ApplyStablePatches(StdApp):
>                  mkdir(fixed_dir)
>              if not path.exists(discarded_dir):
>                  mkdir(discarded_dir)
> -            kernel = KernelVersion(Kernel().version(), False)
> +            kernel = KernelVersion(Kernel().version())
>  	    if 'check_already' in self.cfg:
>  		status, result = run_command('git show-branch --merge-base HEAD master')
>  		if status == 0:
> @@ -481,18 +468,9 @@ class ApplyStablePatches(StdApp):
>                      if change[1]:
>                          ignore = True
>                          for kver in change[1]:
> -                            if kver.plus == 1:
> -                                if kernel.compare(kver) > 0:
> -                                    ignore = False
> -                                    break
> -                            elif kver.plus == 2:
> -                                if kernel.compare(kver) >= 0:
> -                                    ignore = False
> -                                    break
> -                            else:
> -                                if kernel.compare(kver) == 0:
> -                                    ignore = False
> -                                    break
> +                            if kernel.compare(kver) >= 0:
> +                                ignore = False
> +                                break
>                          if ignore:
>                              ignored_file = '%s/%s' % (ignored_dir, filename)
>                              if path.exists(ignored_file):






More information about the kernel-team mailing list