[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#887817: lintian: check for patches present in debian/patches/ but missing from the series file



Chris Lamb:
> Hi Paul,
> 
>> lintian: check for patches present in debian/patches/ but missing
>> from the series file
> 
> WIP patch attached:
> 
>   commit db15e28b88b6b3ab66a18cbafb2492c8568a7444
>   Author: Chris Lamb <lamby@debian.org>
>   Date:   Sat Jan 20 21:14:59 2018 +1100
>   
>       * checks/patch-systems.{desc,pm}: Check patch files under the
>         debian/patches that are not mentioned in any series file.
>         Thanks to Paul Wise. (Closes: #887817)
>   
>    checks/patch-systems.desc                     |  8 ++++++++
>    checks/patch-systems.pm                       | 12 ++++++++++++
>    debian/changelog                              |  3 +++
>    t/tests/legacy-scripts/desc                   |  1 +
>    t/tests/legacy-scripts/tags                   |  1 +
>    t/tests/patch-systems-dpatch-description/desc |  1 +
>    t/tests/patch-systems-dpatch-description/tags |  1 +
>    t/tests/patch-systems-quilt-general/desc      |  1 +
>    t/tests/patch-systems-quilt-general/tags      |  2 ++
>    9 files changed, 30 insertions(+)
> 
> 
> Best wishes,
> 

Hi Chris,

Minor suggestion for improvement.  Consider replacing:

foreach my $file ($info->sorted_index) {
  ...
  next unless $file =~ m{^debian/patches/(?<name>.+)$};
  ...
}

with

 if (my $dir = $info->index('debian/patches/')) {
    for my $file ($dir->children) {
      ...
    }
 }

And then replace $+{name} with $file->basename. (Untested; subject to
typos and minor bugs)


This would avoid a linear scan over the entire source package and
replace it with only a scan over the d/patches dir.  For larger source
packages (e.g. src:linux or src:chromium) this may (or may not) exhibit
a visible dent in performance.

Thanks,
~Niels


Reply to: