Skip to contentSkip to conversation

scancpan patches

RFC PATCH New Christopher McCrory 6 participants 12 messages Aug 13, 2018 – Aug 16, 2018

lore
Share & tools
lore
#0 lore raw

cover scancpan patches

These should help scancpan do the right thing.
Tested on perl-astro-suntime, gpl_3
and perl-appconfig, Config.in desciption too long

Christopher McCrory (2):
scancpan: support more licenses
scancpan: wrap abstract if too long

 utils/scancpan | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
Signature · 1 line
2.14.4
#1 lore raw

RFC PATCH 1/2 scancpan: support more licenses

from perl-module-build Module/Build/Base.pm %licenses GPL, LGPT, and BSD

---
 utils/scancpan | 11 +++++++++++
 1 file changed, 11 insertions(+)
utils/scancpan +11 -0
index da8e7b91ac..2070e2a233 100755
@@ -692,8 +692,19 @@ while (my ($distname, $dist) = each %dist) {
                     : $dist->{license};
         # BR requires license name as in http://spdx.org/licenses/
         $license =~ s|apache_2_0|Apache-2.0|;
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;
         $license =~ s|artistic_2|Artistic-2.0|;
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;
+        $license =~ s|bsd|BSD|;
+        $license =~ s|gpl_2|GPL-2.0|;
+        $license =~ s|gpl_3|GPL-3.0|;
+        $license =~ s|gpl|GPL-1.0|;
         $license =~ s|mit|MIT|;
+        $license =~ s|mozilla_1_1|Mozilla-1.1|;
         $license =~ s|openssl|OpenSSL|;
         $license =~ s|perl_5|Artistic or GPL-1.0+|;
         my $license_files = join q{ }, keys %{$license_files{$distname}};
Signature · 1 line
2.14.4
#2 lore raw

RFC PATCH 1/2 scancpan: support more licenses

2018-08-13 15:11 GMT+02:00 Christopher McCrory <[email protected]>:

Quoted 5 lines

from perl-module-build Module/Build/Base.pm %licenses GPL, LGPT, and BSD

Quoted 29 lines
---
 utils/scancpan | 11 +++++++++++
 1 file changed, 11 insertions(+)
utils/scancpan +11 -1
index da8e7b91ac..2070e2a233 100755
@@ -692,8 +692,19 @@ while (my ($distname, $dist) = each %dist) {
                     : $dist->{license};
         # BR requires license name as in http://spdx.org/licenses/
         $license =~ s|apache_2_0|Apache-2.0|;
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;
         $license =~ s|artistic_2|Artistic-2.0|;
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;
+        $license =~ s|bsd|BSD|;
+        $license =~ s|gpl_2|GPL-2.0|;
+        $license =~ s|gpl_3|GPL-3.0|;
+        $license =~ s|gpl|GPL-1.0|;
         $license =~ s|mit|MIT|;
+        $license =~ s|mozilla_1_1|Mozilla-1.1|;
         $license =~ s|openssl|OpenSSL|;
         $license =~ s|perl_5|Artistic or GPL-1.0+|;
         my $license_files = join q{ }, keys %{$license_files{$distname}};
--
Quoted 3 lines

2.14.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180813/bd0c601a/attachment.html>

#3 lore raw

RFC PATCH 1/2 scancpan: support more licenses

In reply to Christopher McCrory

Hello,

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 696

Quoted 3 lines · Christopher McCrory
         $license =~ s|apache_2_0|Apache-2.0|;
utils/scancpan +2 -0
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;

So just "apache" always means it's Apache-2.0 ?

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 701

Quoted 5 lines
         $license =~ s|artistic_2|Artistic-2.0|;
utils/scancpan +4 -0
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;

Just "lgpl" always means it's LGPL-2.1 ?

Quoted 1 line

+ $license =~ s|bsd|BSD|;

"BSD" is not a license. There are several different BSD licenses. Though with just "bsd" as an initial information, there's not much you can do :-/

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

RFC PATCH 1/2 scancpan: support more licenses

Quoted 22 lines · Thomas Petazzoni

Hello,

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 696

Quoted 3 lines · Christopher McCrory
         $license =~ s|apache_2_0|Apache-2.0|;
utils/scancpan +2 -0
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;

So just "apache" always means it's Apache-2.0 ?

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 701

Quoted 5 lines
         $license =~ s|artistic_2|Artistic-2.0|;
utils/scancpan +4 -0
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;

Just "lgpl" always means it's LGPL-2.1 ?

Apparently

Quoted 7 lines
Quoted 1 line

+ $license =~ s|bsd|BSD|;

"BSD" is not a license. There are several different BSD licenses. Though with just "bsd" as an initial information, there's not much you can do :-/

yea :(

AFAICT, this is the source from Base.pm

my %licenses = (

    perl         => 'Perl_5',
    apache       => 'Apache_2_0',
    apache_1_1   => 'Apache_1_1',
    artistic     => 'Artistic_1',
    artistic_2   => 'Artistic_2',
    lgpl         => 'LGPL_2_1',
    lgpl2        => 'LGPL_2_1',
    lgpl3        => 'LGPL_3_0',
    bsd          => 'BSD',
    gpl          => 'GPL_1',
    gpl2         => 'GPL_2',
    gpl3         => 'GPL_3',
    mit          => 'MIT',
    mozilla      => 'Mozilla_1_1',
    restrictive  => 'Restricted',
    open_source  => undef,

unrestricted => undef,
unknown => undef,
);

# TODO - would be nice to not have these here, since they're more

  # properly stored only in Software::License
  my %license_urls = (
    perl         => 'http://dev.perl.org/licenses/',
    apache       => 'http://apache.org/licenses/LICENSE-2.0',
    apache_1_1   => 'http://apache.org/licenses/LICENSE-1.1',
    artistic     => 'http://opensource.org/licenses/artistic-license.php',
    artistic_2   => 'http://opensource.org/licenses/artistic-license-2.0.php
',
    lgpl         => 'http://opensource.org/licenses/lgpl-license.php',
    lgpl2        => 'http://opensource.org/licenses/lgpl-2.1.php',
    lgpl3        => 'http://opensource.org/licenses/lgpl-3.0.html',
    bsd          => 'http://opensource.org/licenses/bsd-license.php',
    gpl          => 'http://opensource.org/licenses/gpl-license.php',
    gpl2         => 'http://opensource.org/licenses/gpl-2.0.php',
    gpl3         => 'http://opensource.org/licenses/gpl-3.0.html',
    mit          => 'http://opensource.org/licenses/mit-license.php',
    mozilla      => 'http://opensource.org/licenses/mozilla1.1.php',
    restrictive  => undef,
    open_source  => undef,
    unrestricted => undef,
    unknown      => undef,
  );
Quoted 8 lines

Best regards,

Thomas
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 7 lines
Christopher McCrory
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180813/739880ce/attachment.html>
#5 lore raw

RFC PATCH 1/2 scancpan: support more licenses

Christopher, All,

On 2018-08-13 10:35 -0700, Christopher McCrory spake thusly:

Quoted 4 lines · Thomas Petazzoni
Quoted 1 line

+? ? ? ? $license =~ s|lgpl|LGPL-2.1|;

Just "lgpl" always means it's LGPL-2.1 ?
Apparently

IANAL...

Usually, if any license of the GPL familly is used without any version specified, then it means just any version can be used:

https://www.gnu.org/licenses/gpl.html

14. Revised Versions of this License.

[...] If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

Similar clauses can be had for each license. So I doubt 'lgpl' would stand for LGPL-2.1.

Besides, see below...

Quoted 7 lines
Quoted 1 line

+? ? ? ? $license =~ s|bsd|BSD|;

"BSD" is not a license. There are several different BSD licenses. Though with just "bsd" as an initial information, there's not much you can do :-/

yea :(
AFAICT, this is the source from Base.pm

What 'Base.pm' are you talink about? On my Ubuntu 17.10, I get:

    $ apt-file search /Base.pm |wc -l
    191
Quoted 35 lines

? my %licenses = (
??? perl???????? => 'Perl_5',
??? apache?????? => 'Apache_2_0',
??? apache_1_1?? => 'Apache_1_1',
??? artistic???? => 'Artistic_1',
??? artistic_2?? => 'Artistic_2',
??? lgpl???????? => 'LGPL_2_1',
??? lgpl2??????? => 'LGPL_2_1',
??? lgpl3??????? => 'LGPL_3_0',
??? bsd????????? => 'BSD',
??? gpl????????? => 'GPL_1',
??? gpl2???????? => 'GPL_2',
??? gpl3???????? => 'GPL_3',
??? mit????????? => 'MIT',
??? mozilla????? => 'Mozilla_1_1',
??? restrictive? => 'Restricted',
??? open_source? => undef,
??? unrestricted => undef,
??? unknown????? => undef,
? );

?# TODO - would be nice to not have these here, since they're more ? # properly stored only in Software::License
? my %license_urls = (
??? perl???????? => 'http://dev.perl.org/licenses/',
??? apache?????? => 'http://apache.org/licenses/LICENSE-2.0',
??? apache_1_1?? => 'http://apache.org/licenses/LICENSE-1.1',
??? artistic???? => 'http://opensource.org/licenses/artistic-license.php', ??? artistic_2?? => 'http://opensource.org/licenses/artistic-license-2.0.php', ??? lgpl???????? => 'http://opensource.org/licenses/lgpl-license.php', ??? lgpl2??????? => 'http://opensource.org/licenses/lgpl-2.1.php', ??? lgpl3??????? => 'http://opensource.org/licenses/lgpl-3.0.html', ??? bsd????????? => 'http://opensource.org/licenses/bsd-license.php', ??? gpl????????? => 'http://opensource.org/licenses/gpl-license.php', ??? gpl2???????? => 'http://opensource.org/licenses/gpl-2.0.php',

Quoted 8 lines

??? gpl3???????? => 'http://opensource.org/licenses/gpl-3.0.html', ??? mit????????? => 'http://opensource.org/licenses/mit-license.php', ??? mozilla????? => 'http://opensource.org/licenses/mozilla1.1.php', ??? restrictive? => undef,
??? open_source? => undef,
??? unrestricted => undef,
??? unknown????? => undef,
? );

And at the same time, still on my Ubuntu 17.10, I was looking at /usr/share/perl/5.26.0/CPAN/Meta/Converter.pm, which has;

# The "old" values were defined by Module::Build, and were often vague. # I have
# made the decisions below based on reading Module::Build::API and how # clearly
# it specifies the version of the license.
my %license_map_2 = (
(map { $_ => $_ } @valid_licenses_2),
apache => 'apache_2_0', # clearly stated as 2.0
artistic => 'artistic_1', # clearly stated as 1
artistic2 => 'artistic_2', # clearly stated as 2
gpl => 'open_source', # we don't know which GPL; punt
lgpl => 'open_source', # we don't know which LGPL; punt
mozilla => 'open_source', # we don't know which MPL; punt
perl => 'perl_5', # clearly Perl 5
restrictive => 'restricted',
);

So... The resolution is not that clear-cut IMNSHO...

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

RFC PATCH 1/2 scancpan: support more licenses

Quoted 8 lines · Yann E. MORIN

Christopher, All,

On 2018-08-13 10:35 -0700, Christopher McCrory spake thusly:

Quoted 4 lines · Thomas Petazzoni
Quoted 1 line

+? ? ? ? $license =~ s|lgpl|LGPL-2.1|;

Just "lgpl" always means it's LGPL-2.1 ?
Apparently

Quoted 4 lines

IANAL...

Usually, if any license of the GPL familly is used without any version specified, then it means just any version can be used:

But that is not the case here. In this case, it's most likely an incomplete
manifest, not a package that is actually under any GPL version.

So instead, scancpan should issue a warning.

I have the feeling that the licenses mentioned in perl packages are not very
reliable, unless it is "perl".

Quoted 74 lines

https://www.gnu.org/licenses/gpl.html

14. Revised Versions of this License.

[...] If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation.

Similar clauses can be had for each license. So I doubt 'lgpl' would stand for LGPL-2.1.

Besides, see below...

Quoted 7 lines
Quoted 1 line

+? ? ? ? $license =~ s|bsd|BSD|;

"BSD" is not a license. There are several different BSD licenses. Though with just "bsd" as an initial information, there's not much you can do :-/

yea :(
AFAICT, this is the source from Base.pm

What 'Base.pm' are you talink about? On my Ubuntu 17.10, I get:

    $ apt-file search /Base.pm |wc -l
    191
Quoted 35 lines

? my %licenses = (
??? perl???????? => 'Perl_5',
??? apache?????? => 'Apache_2_0',
??? apache_1_1?? => 'Apache_1_1',
??? artistic???? => 'Artistic_1',
??? artistic_2?? => 'Artistic_2',
??? lgpl???????? => 'LGPL_2_1',
??? lgpl2??????? => 'LGPL_2_1',
??? lgpl3??????? => 'LGPL_3_0',
??? bsd????????? => 'BSD',
??? gpl????????? => 'GPL_1',
??? gpl2???????? => 'GPL_2',
??? gpl3???????? => 'GPL_3',
??? mit????????? => 'MIT',
??? mozilla????? => 'Mozilla_1_1',
??? restrictive? => 'Restricted',
??? open_source? => undef,
??? unrestricted => undef,
??? unknown????? => undef,
? );

?# TODO - would be nice to not have these here, since they're more ? # properly stored only in Software::License
? my %license_urls = (
??? perl???????? => 'http://dev.perl.org/licenses/',
??? apache?????? => 'http://apache.org/licenses/LICENSE-2.0',
??? apache_1_1?? => 'http://apache.org/licenses/LICENSE-1.1',
??? artistic???? => 'http://opensource.org/licenses/artistic-license.php', ??? artistic_2?? => 'http://opensource.org/licenses/artistic-license-2.0.php', ??? lgpl???????? => 'http://opensource.org/licenses/lgpl-license.php', ??? lgpl2??????? => 'http://opensource.org/licenses/lgpl-2.1.php', ??? lgpl3??????? => 'http://opensource.org/licenses/lgpl-3.0.html', ??? bsd????????? => 'http://opensource.org/licenses/bsd-license.php', ??? gpl????????? => 'http://opensource.org/licenses/gpl-license.php', ??? gpl2???????? => 'http://opensource.org/licenses/gpl-2.0.php',

Quoted 8 lines

??? gpl3???????? => 'http://opensource.org/licenses/gpl-3.0.html', ??? mit????????? => 'http://opensource.org/licenses/mit-license.php', ??? mozilla????? => 'http://opensource.org/licenses/mozilla1.1.php', ??? restrictive? => undef,
??? open_source? => undef,
??? unrestricted => undef,
??? unknown????? => undef,
? );

And at the same time, still on my Ubuntu 17.10, I was looking at /usr/share/perl/5.26.0/CPAN/Meta/Converter.pm, which has;

Quoted 13 lines

# The "old" values were defined by Module::Build, and were often vague. # I have
# made the decisions below based on reading Module::Build::API and how # clearly
# it specifies the version of the license.
my %license_map_2 = (
(map { $_ => $_ } @valid_licenses_2),
apache => 'apache_2_0', # clearly stated as 2.0
artistic => 'artistic_1', # clearly stated as 1
artistic2 => 'artistic_2', # clearly stated as 2
gpl => 'open_source', # we don't know which GPL; punt
lgpl => 'open_source', # we don't know which LGPL; punt
mozilla => 'open_source', # we don't know which MPL; punt

That sounds correct :-)

Regards,
Arnout

Quoted 9 lines

perl => 'perl_5', # clearly Perl 5
restrictive => 'restricted',
);

So... The resolution is not that clear-cut IMNSHO...

Regards,
Yann E. MORIN.

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
#7 lore raw

RFC PATCH 1/2 scancpan: support more licenses

In reply to Christopher McCrory

Hello Christopher,

So, taking Arnout/Yann feedback into account.

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 696

Quoted 10 lines · Christopher McCrory
utils/scancpan +2 -0
index da8e7b91ac..2070e2a233 100755
@@ -692,8 +692,19 @@ while (my ($distname, $dist) = each %dist) {
                     : $dist->{license};
         # BR requires license name as in http://spdx.org/licenses/
         $license =~ s|apache_2_0|Apache-2.0|;
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;

In this case, scancpan should not conclude that Apache-2.0 is used, because "apache" is not specific enough. Instead, it should emit a warning.

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 701

Quoted 5 lines
utils/scancpan +4 -0
         $license =~ s|artistic_2|Artistic-2.0|;
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;

Same.

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 702

Quoted 1 line
utils/scancpan +1 -0
+        $license =~ s|bsd|BSD|;

Same.

Best regards,

Thomas Petazzoni

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com
#8 lore raw

RFC PATCH 1/2 scancpan: support more licenses

hello

Quoted 6 lines · Thomas Petazzoni

Hello Christopher,

So, taking Arnout/Yann feedback into account.

On Mon, 13 Aug 2018 06:11:34 -0700, Christopher McCrory wrote:

Quoted 16 lines

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 696

Quoted 10 lines
utils/scancpan +2 -0
index da8e7b91ac..2070e2a233 100755
@@ -692,8 +692,19 @@ while (my ($distname, $dist) = each %dist) {
                     : $dist->{license};
         # BR requires license name as in http://spdx.org/licenses/
         $license =~ s|apache_2_0|Apache-2.0|;
+        $license =~ s|apache_1_1|Apache-1.1|;
+        $license =~ s|apache|Apache-2.0|;

In this case, scancpan should not conclude that Apache-2.0 is used, because "apache" is not specific enough. Instead, it should emit a warning.

I looked at CPAN/Meta/Converter.pm that is used to generate the META.json files, it contains

* apache => 'apache_2_0', # clearly stated as 2.0

But I'm going with you and warn

Quoted 9 lines

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 701

Quoted 5 lines
utils/scancpan +4 -0
         $license =~ s|artistic_2|Artistic-2.0|;
+        $license =~ s|artistic|Artistic-1.0|;
+        $license =~ s|lgpl_2_1|LGPL-2.1|;
+        $license =~ s|lgpl_3_0|LGPL-3.0|;
+        $license =~ s|lgpl|LGPL-2.1|;

Same.

yea

Quoted 5 lines

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 702

Quoted 1 line
utils/scancpan +1 -0
+        $license =~ s|bsd|BSD|;

Same.

In one of the perl bits that generate the META.json files it adds the URL

https://opensource.org/licenses/bsd-license.php

which is the BSD 2 clause version. But a google search with

site:metacpan.org 'LICENCE: bsd'

finds a mixture of two and three clause versions

I'll gen up another submission with these fixes.

Best regards,

Quoted 7 lines

Thomas Petazzoni
--
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering
https://bootlin.com

Signature · 7 lines
Christopher McCrory
To the optimist, the glass is half full.
To the pessimist, the glass is half empty.
To the engineer, the glass is twice as big as it needs to be.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180815/80f622e9/attachment.html>
#9 lore raw

RFC PATCH 2/2 scancpan: wrap abstract if too long

In reply to Christopher McCrory
---
 utils/scancpan | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/scancpan +3 -1
index 2070e2a233..f8411079e1 100755
@@ -484,6 +484,8 @@ use HTTP::Tiny;
 use Safe;
 use MetaCPAN::API::Tiny;
 use Digest::SHA qw(sha256_hex);
+use Text::Wrap;
+$Text::Wrap::columns = 70;
 
 # Below, 5.026 should be aligned with the version of perl actually
 # bundled in Buildroot:
@@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {
     my $brname = brname( $fsname );
     mkdir $dirname unless -d $dirname;
     if ($need_target{$distname} && ($force || !-f $cfgname)) {
-        my $abstract = $dist->{abstract};
+        my $abstract = wrap("","\t  ",$dist->{abstract});
         my $homepage = $dist->{resources}->{homepage} || qq{https://metacpan.org/release/${distname}};
         say qq{write ${cfgname}} unless $quiet;
         open my $fh, q{>}, $cfgname;
Signature · 1 line
2.14.4
#10 lore raw

RFC PATCH 2/2 scancpan: wrap abstract if too long

2018-08-13 15:11 GMT+02:00 Christopher McCrory <[email protected]>:

Quoted 10 lines
---
 utils/scancpan | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
utils/scancpan +0 -0
index 2070e2a233..f8411079e1 100755

utils/scancpan use HTTP::Tiny; · line 488

Quoted 5 lines
utils/scancpan +1 -0
@@ -484,6 +484,8 @@ use HTTP::Tiny;
 use Safe;
 use MetaCPAN::API::Tiny;
 use Digest::SHA qw(sha256_hex);
+use Text::Wrap;
 

Ok, Text::Wrap is a core module, so the script scancpan stays self-depend.

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 661

Quoted 12 lines
utils/scancpan +1 -0
+$Text::Wrap::columns = 70;
 
 # Below, 5.026 should be aligned with the version of perl actually
 # bundled in Buildroot:
utils/scancpan +1 -1
@@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {
     my $brname = brname( $fsname );
     mkdir $dirname unless -d $dirname;
     if ($need_target{$distname} && ($force || !-f $cfgname)) {
-        my $abstract = $dist->{abstract};
+        my $abstract = wrap("","\t  ",$dist->{abstract});
 

In this script, I don't use quote but q{} and qq{}. And I put one space after comma.

Fran?ois

Quoted 8 lines
utils/scancpan +0 -0
         my $homepage = $dist->{resources}->{homepage} || qq{
 https://metacpan.org/release/${distname}};
         say qq{write ${cfgname}} unless $quiet;
         open my $fh, q{>}, $cfgname;

--
2.14.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20180813/7dfe8759/attachment.html>

#11 lore raw

RFC PATCH 2/2 scancpan: wrap abstract if too long

In reply to Christopher McCrory

Hello,

utils/scancpan use HTTP::Tiny; · line 488

Quoted 7 lines · Christopher McCrory

+++ b/utils/scancpan

utils/scancpan +2 -0
@@ -484,6 +484,8 @@ use HTTP::Tiny;
 use Safe;
 use MetaCPAN::API::Tiny;
 use Digest::SHA qw(sha256_hex);
+use Text::Wrap;
+$Text::Wrap::columns = 70;

Please use 62 instead of 70 here ...

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 660

Quoted 9 lines
utils/scancpan +1 -1
 # Below, 5.026 should be aligned with the version of perl actually
 # bundled in Buildroot:
@@ -655,7 +657,7 @@ while (my ($distname, $dist) = each %dist) {
     my $brname = brname( $fsname );
     mkdir $dirname unless -d $dirname;
     if ($need_target{$distname} && ($force || !-f $cfgname)) {
-        my $abstract = $dist->{abstract};
+        my $abstract = wrap("","\t  ",$dist->{abstract});

... so the help text generated here always fits in:
<tab><2 spaces><62 chars>
"tab counts for 8" as described in:
http://nightly.buildroot.org/#writing-rules-config-in

utils/scancpan while (my ($distname, $dist) = each %dist) { · line 663

Quoted 4 lines
utils/scancpan +0 -0
         my $homepage = $dist->{resources}->{homepage} || qq{https://metacpan.org/release/${distname}};
         say qq{write ${cfgname}} unless $quiet;
         open my $fh, q{>}, $cfgname;

Regards,
Ricardo