diff options
author | Walter Lozano <walter.lozano@collabora.com> | 2021-06-07 15:50:12 -0300 |
---|---|---|
committer | Dominique Dumont <dod@debian.org> | 2021-06-26 12:42:24 +0000 |
commit | 690e071fa734b7c9dbf3dca3724c422ad2a4852c (patch) | |
tree | 13737bea8a74a45d817cb74b3e358af5873e57ca | |
parent | 979e94c4e505a30562edbfe12d45d77aea961e96 (diff) |
Add support for output without wild cards
On some use cases it is useful to produce an output without wild cards to
allow the report to consume by other systems.
To allow it, add the support for optional argument "long" which avoid
squashing copyright_id.
Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
-rw-r--r-- | bin/scan-copyrights | 9 | ||||
-rw-r--r-- | lib/Dpkg/Copyright/Scanner.pm | 8 |
2 files changed, 16 insertions, 1 deletions
diff --git a/bin/scan-copyrights b/bin/scan-copyrights index 82908925..31470e0f 100644 --- a/bin/scan-copyrights +++ b/bin/scan-copyrights @@ -4,10 +4,15 @@ use 5.20.0; use warnings ; use strict; use Path::Tiny; +use Getopt::Long; use Dpkg::Copyright::Scanner qw/print_copyright/; my %args; +my $long; + +GetOptions('long' => \$long); + if (my $input = $ENV{COPYRIGHT_SCANNER_INPUT} || $ARGV[0]) { # used for test setup my $input_path = path($input); @@ -19,6 +24,10 @@ if (my $input = $ENV{COPYRIGHT_SCANNER_INPUT} || $ARGV[0]) { } } +if ($long) { + $args{long} = 1; +} + print_copyright(%args); __END__ diff --git a/lib/Dpkg/Copyright/Scanner.pm b/lib/Dpkg/Copyright/Scanner.pm index da58fe74..c58aaad6 100644 --- a/lib/Dpkg/Copyright/Scanner.pm +++ b/lib/Dpkg/Copyright/Scanner.pm @@ -60,7 +60,9 @@ sub print_copyright ( %args ) { } # regroup %files hash: all leaves have same id -> wild card - __squash_tree_of_copyright_ids($split_files, $copyrights_by_id); + if ($args{long} != 1) { + __squash_tree_of_copyright_ids($split_files, $copyrights_by_id); + } # pack files by copyright id my @packed = __pack_files($split_files); @@ -1048,6 +1050,10 @@ Parameters in C<%args>: set to 1 to suppress progress messages. Should be used only in tests. +=item long + +set to 1 to avoid squashing copyright ids. Useful to avoid output with wild cards. + =back |