Before treating the block check if we violate the license

Checking hash key existance is free compared to index

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Always _clean_block() after index part in license check

Will allow better checking license and creation of generic function

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Simplify double space now that we normalize spacing

We normalize spacing so no need to use \s+

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Push to _clean_block trimmed block logic of gfdl and cleanup \s+ to \s

More efficent means less time to run

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Push removing of pod2man syntax to _clean_block

Will be run less often.

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Do ligth weight cleaning in gfdl

Do not reclean but trim punctuation.

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
c/cruft.pm: Add "retain" as keyword for NVidia license

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Remember to use $cleanedblock instead of $block

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Use "$cleanedblock" instead of "$block"

Signed-off-by: Niels Thykier <niels@thykier.net>
Push gfdl checking to its own function_check_gfdl_license_problem

Will allow to simplofy the code further

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Move empty gfdl text at the beginning of _check_gfdl_license_problem

Will allow further simplification

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
Push to data gfdl regexp

No need to cluter code with data.

Signed-off-by: Bastien ROUCARIÈS <roucaries.bastien+debian@gmail.com>
L::Util: Assume that file names rarely contain backslash

Optimise for the case where file names do no have backslash as it
fairly uncommon in "your average package".

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Remove unused "use feature"

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Use [ ] instead of \s in "hot regexes"

Since space is normalised, we will always be looking for a single
space and this (hopefully) allows Perl to use "simplier" matching when
only one byte can match (instead of at least 5 different ones).

Based on the (idea behind the) following optimisation committed to Perl:
  http://perl5.git.perl.org/perl.git/commit/0ba8faef1d393a5e5eec58121e95c78331a76dda

At the same time, remove /i flags from these regexes (for the same
reason).

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Save some calls to L::Data->value

Signed-off-by: Niels Thykier <niels@thykier.net>
c/cruft.pm: Cache the result of _clean_block

Surprisingly enough there are a couple of text blocks that gets tested
against multiple problematic licenses.

Signed-off-by: Niels Thykier <niels@thykier.net>
L::C::Package: Save a hash look-up

Signed-off-by: Niels Thykier <niels@thykier.net>
L::C::Package: Cache 5 common permission strings

Reduce the overhead of perm2oct by caching 5 common permission strings.
It is ridiculous how well this works.

Signed-off-by: Niels Thykier <niels@thykier.net>
L::Path: Inline _is_type helper into its callers

The helper method is not really that helpful and carries a measurable
overhead on "very large packages" (hi chromium-browser).

Signed-off-by: Niels Thykier <niels@thykier.net>