Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package cpanspec for openSUSE:Factory 
checked in at 2022-03-13 20:25:33
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/cpanspec (Old)
 and      /work/SRC/openSUSE:Factory/.cpanspec.new.25692 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "cpanspec"

Sun Mar 13 20:25:33 2022 rev:44 rq:961453 version:1.82.01.1646998297.5af26bb

Changes:
--------
--- /work/SRC/openSUSE:Factory/cpanspec/cpanspec.changes        2021-05-10 
15:41:23.417083837 +0200
+++ /work/SRC/openSUSE:Factory/.cpanspec.new.25692/cpanspec.changes     
2022-03-13 20:25:49.351701600 +0100
@@ -1,0 +2,14 @@
+Fri Mar 11 11:41:02 UTC 2022 - Tina M??ller <[email protected]>
+
+- Add a call to `cpanspec -h` for testing
+- Update dependencies
+
+-------------------------------------------------------------------
+Fri Mar 11 11:39:45 UTC 2022 - Tina M??ller <[email protected]>
+
+- Update to version 1.82.01.1646998297.5af26bb:
+  * v1.82.01
+  * Read from MYMETA.{json,yml} (#33)
+  * Drop perl markup in summary line (#32)
+
+-------------------------------------------------------------------

Old:
----
  cpanspec-1.81.01.1620405353.7ed9076.obscpio

New:
----
  cpanspec-1.82.01.1646998297.5af26bb.obscpio

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ cpanspec.spec ++++++
--- /var/tmp/diff_new_pack.Xv5rZi/_old  2022-03-13 20:25:50.111702495 +0100
+++ /var/tmp/diff_new_pack.Xv5rZi/_new  2022-03-13 20:25:50.123702508 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package cpanspec
 #
-# Copyright (c) 2021 SUSE LLC
+# Copyright (c) 2022 SUSE LLC
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -18,7 +18,7 @@
 
 %define cpan_name cpanspec
 Name:           cpanspec
-Version:        1.81.01.1620405353.7ed9076
+Version:        1.82.01.1646998297.5af26bb
 Release:        0
 Summary:        Generate a SUSE spec file for a CPAN module
 License:        Artistic-1.0 OR GPL-1.0-or-later
@@ -27,15 +27,18 @@
 Source0:        cpanspec-%{version}.tar.xz
 BuildRequires:  perl
 BuildRequires:  perl-macros
+BuildRequires:  perl(Algorithm::Diff)
 BuildRequires:  perl(Archive::Tar)
 BuildRequires:  perl(Archive::Zip)
 BuildRequires:  perl(IO::Uncompress::Bunzip2)
 BuildRequires:  perl(LWP::UserAgent)
 BuildRequires:  perl(Parse::CPAN::Packages)
 BuildRequires:  perl(Perl::PrereqScanner)
+BuildRequires:  perl(Pod::POM)
 BuildRequires:  perl(Pod::Simple::TextContent)
 BuildRequires:  perl(Text::Autoformat)
 BuildRequires:  perl(YAML)
+BuildRequires:  perl(YAML::XS)
 Requires:       perl(Algorithm::Diff)
 Requires:       perl(Archive::Tar)
 Requires:       perl(Archive::Zip)
@@ -50,6 +53,7 @@
 Requires:       perl(Text::Autoformat)
 Requires:       perl(Text::Capitalize)
 Requires:       perl(YAML)
+Requires:       perl(YAML::XS)
 Recommends:     perl(IO::Uncompress::Bunzip2)
 BuildArch:      noarch
 %{perl_requires}
@@ -68,6 +72,7 @@
 
 %check
 make %{?_smp_mflags} test
+perl ./cpanspec -h
 
 %install
 %perl_make_install

++++++ _service ++++++
--- /var/tmp/diff_new_pack.Xv5rZi/_old  2022-03-13 20:25:50.183702579 +0100
+++ /var/tmp/diff_new_pack.Xv5rZi/_new  2022-03-13 20:25:50.187702584 +0100
@@ -1,10 +1,10 @@
 <services>
-  <service name="obs_scm" mode="disabled">
-    <param name="versionprefix">1.81.01</param>
+  <service name="obs_scm" mode="manual">
+    <param name="versionprefix">1.82.01</param>
     <param name="url">git://github.com/openSUSE/cpanspec</param>
     <param name="scm">git</param>
     <param name="changesgenerate">enable</param>
-    <param name="changesauthor">[email protected]</param>
+    <param name="changesauthor">Tina M??ller 
&lt;[email protected]&gt;</param>
     <param name="revision">master</param>
   </service>
   <service name="set_version" mode="disabled"/>

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.Xv5rZi/_old  2022-03-13 20:25:50.219702621 +0100
+++ /var/tmp/diff_new_pack.Xv5rZi/_new  2022-03-13 20:25:50.235702641 +0100
@@ -1,7 +1,8 @@
 <servicedata>
  <service name="tar_scm">
   <param name="url">git://github.com/openSUSE/cpanspec</param>
-  <param 
name="changesrevision">7ed9076bb6e249082bab6d5b6a66eed7f33e8703</param>
+  <param 
name="changesrevision">5af26bbce689d5ba075935014ebe361c028060c3</param>
  </service>
 </servicedata>
+(No newline at EOF)
 

++++++ cpanspec-1.81.01.1620405353.7ed9076.obscpio -> 
cpanspec-1.82.01.1646998297.5af26bb.obscpio ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpanspec-1.81.01.1620405353.7ed9076/bin/intrusive.pl 
new/cpanspec-1.82.01.1646998297.5af26bb/bin/intrusive.pl
--- old/cpanspec-1.81.01.1620405353.7ed9076/bin/intrusive.pl    2021-05-07 
18:35:53.000000000 +0200
+++ new/cpanspec-1.82.01.1646998297.5af26bb/bin/intrusive.pl    1970-01-01 
01:00:00.000000000 +0100
@@ -1,26 +0,0 @@
-#!/usr/bin/perl
-use strict;
-use warnings;
-use 5.010;
-use JSON::PP;
-use File::Basename qw/ dirname /;
-my $bin = dirname(__FILE__);
-require "$bin/../lib/Intrusive.pm";
-
-my $coder = JSON::PP->new->utf8->pretty->canonical;
-
-my ($path) = @ARGV;
-
-# Makefile.PL etc. might print things to STDOUT, temporary redirect
-# to STDERR
-open my $orig, ">&", STDOUT;
-open STDOUT, ">&STDERR";
-
-my $deps = Intrusive->new->dist_dir($path)->find_modules;
-
-# restore STDOUT
-open STDOUT, ">&", $orig;
-
-my $json = $coder->encode({%$deps});
-print $json;
-
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpanspec-1.81.01.1620405353.7ed9076/cpanspec 
new/cpanspec-1.82.01.1646998297.5af26bb/cpanspec
--- old/cpanspec-1.81.01.1620405353.7ed9076/cpanspec    2021-05-07 
18:35:53.000000000 +0200
+++ new/cpanspec-1.82.01.1646998297.5af26bb/cpanspec    2022-03-11 
12:31:37.000000000 +0100
@@ -190,7 +190,7 @@
 use 5.010;
 
 our $NAME    = "cpanspec";
-our $VERSION = '1.81.01';
+our $VERSION = '1.82.01';
 my $script = __FILE__;
 
 use Cwd;
@@ -276,7 +276,7 @@
 our @add_buildrequires;
 
 our ($file, $name, $source, $version);
-our ($content, $summary, $description, $author, $license);
+our ($content, $summary, $description, $author);
 
 # env. vars and their macro analogues
 my @MACROS = (
@@ -380,23 +380,22 @@
 }
 
 sub get_file($) {
-    my $type;
-    $file = shift;
-    # Look up $file in 02packages.details.txt.
-    verbose("Get file $file");
+    my $ofile = shift;
+    my ($file, $name, $version, $type);
+    # Look up $ofile in 02packages.details.txt.
+    verbose("Get file $ofile");
     update_packages();
     if (!defined($packages)) {
         verbose "parsing packages";
         $packages = Parse::CPAN::Packages->new($pkgdetails);
         verbose "done";
     }
-    die "Parse::CPAN::Packages->new() failed: $!\n"
-      if (!defined($packages));
+    die "Parse::CPAN::Packages->new() failed: $!\n" unless defined $packages;
     my ($m, $d);
-    if ($m = $packages->package($file) and $d = $m->distribution()) {
+    if ($m = $packages->package($ofile) and $d = $m->distribution()) {
         $source = $cpan . "/authors/id/" . $d->prefix();
         $file   = basename($d->filename());
-        fetch($source, $file) if (!-f $file);
+        fetch($source, $file) unless -f $file;
         $name    = $d->dist();
         $version = $d->version();
         $version =~ s/^v\.?//;
@@ -405,7 +404,7 @@
     else {
         warn "Failed to parse '$file' or find a module by that name, 
skipping...\n";
     }
-    return $type;
+    return ($file, $name, $version, $type);
 }
 
 sub get_source($) {
@@ -485,18 +484,18 @@
     my $pm   = "";
     my $cont;
 
-    my $path = $args{module};
-    $path =~ s,::,/,g;
-    my @pmfiles = ("lib/$path.pod", "lib/$path.pm");
+    my $path = $args{module};     # YAML::PP::LibYAML
+    $path =~ s,::,/,g;            # YAML/PP/LibYAML
+    my @pmfiles = ("lib/$path.pod", "lib/$path.pm"); # 
lib/YAML/PP/LibYAML.{pm,pod}
     if ($args{module} =~ /::/) {
-        my @tmp = split '/', $path;
-        my $last = pop @tmp;
-        push(@pmfiles, "lib/$last.pod", "lib/$last.pm");
+        my @tmp = split '/', $path; # YAML PP LibYAML
+        my $last = pop @tmp;        # LibYAML
+        push(@pmfiles, "lib/$last.pod", "lib/$last.pm"); # lib/LibYAML.{pm,pod}
     }
     do {
         push(@pmfiles, "$path.pod", "$path.pm");
-    } while ($path =~ s,^[^/]+/,,);
-    push(@pmfiles, "$args{module}")
+    } while ($path =~ s,^[^/]+/,,);   # PP/LibYAML -> LibYAML
+    push(@pmfiles, "$args{module}")   # DateTime
       if ($args{module} !~ /::/);
 
     for my $file (@pmfiles) {
@@ -563,8 +562,13 @@
         my $pom = $head1->content;
         $pom =~ /^[^-]+ -* (.*)$/m;
 
-        # return...
-        return "$1" if $1;
+        my $s = $1;
+        if($s)
+        {
+          # strip markup
+          $s =~ s/C<([^>]+)>/$1/g;
+          return $s;
+        }
     }
     return $summary;
 }
@@ -573,6 +577,7 @@
     my $cont   = shift;
     my @lines  = ();
     my $parser = Pod::POM->new;
+    my $author;
 
     # extract pod; the file may contain no pod, that's ok
     my $pom = $parser->parse_text($cont);
@@ -597,11 +602,12 @@
         # return...
         return $author;
     }
-    return $author = 'sorry, no author found';
+    return 'sorry, no author found';
 }
 
-sub get_license($) {
+sub get_license_from_content($) {
     my $cont   = shift;
+    my $license;
     my @lines  = ();
     my $parser = Pod::POM->new;
 
@@ -611,7 +617,7 @@
   HEAD1:
     foreach my $head1 ($pom->head1) {
 
-        next HEAD1 unless $head1->title =~ /LICENSE/i || $head1->title =~ 
/COPYRIGHT/i;
+        next HEAD1 unless $head1->title =~ /LICEN[CS]E/i || $head1->title =~ 
/COPYRIGHT/i;
 
         my $pom = $head1->content;
         eval { $license = $pom->present('Pod::POM::View::Text'); };
@@ -627,11 +633,17 @@
         $license = join " ", @lines;
         $license =~ s,\s+, ,g;
 
+        if ($license
+            && (   $license =~ /under the same terms (and conditions )?as Perl/
+                || $license =~ /same terms as the Perl 5/
+                || $license =~ /under the terms of the Perl artistic license/
+                || $license =~ qr/free software.*dev.perl.org.* for more 
information/)) {
+            $license = $perllicense;
+        }
         # return...
         return $license;
     }
-    return $license = undef;
-
+    return undef;
 }
 
 sub check_rpm($) {
@@ -812,7 +824,8 @@
     my $download = undef;
     my $summary;
     ($file, $name, $source, $version) = (undef, undef, undef, undef);
-    ($content, $description, $author, $license) = (undef, undef, undef, undef);
+    my $license;
+    ($content, $description, $author) = (undef, undef, undef);
 
     if ($ofile =~ /^(?:.*\/)?(.+)-(?:v\.?)?([^-]+)\.(tar)\.(?:gz|bz2)$/i) {
         $file    = $ofile;
@@ -837,7 +850,7 @@
         $ofile =~ s/-/::/g;
 
         # Look up $file in 02packages.details.txt.
-        $type = get_file($ofile);
+        ($file, $name, $version, $type) = get_file($ofile);
         $download = 1;
     }
     next unless $name;
@@ -946,127 +959,24 @@
             path        => $path,
         );
 
+    $description = $config->{description} if $config->{description};
     if (!$description) {
-       get_description($content) || get_description($content, 'OVERVIEW');
-    }
-
-    $summary = get_summary($summary, $content, $module) unless defined 
$summary;
-
-    get_author($content) if (!defined($author));
-
-    my $authors="Authors:\n--------\n$author";
-
-    my @skipdoc;
-    for my $r (split(/ /, $config->{skip_doc} || '')) {
-        push(@skipdoc, $r);
+        get_description($content) || get_description($content, 'OVERVIEW');
     }
 
-    my $doskip = sub {
-        for my $s (@skipdoc) {
-            return 1 if $_ =~ /$s/;
-        }
-        return 0;
-    };
-
-    my @doc=sort { $a cmp $b } grep {
-                !/\//
-            and !/\.(pl|xs|h|c|pm|ini?|pod|cfg|inl|bak|spec)$/i
-            and !/^\./
-            and !/~$/
-            and $_ ne $path
-            and $_ ne "MANIFEST"
-            and $_ ne "MANIFEST.SKIP"
-            and !/^INSTALL/i
-            and $_ ne "SIGNATURE"
-           and !/^META\..+$/i
-           and !/^MYMETA\..+$/i
-            and $_ ne "NINJA"
-            and $_ ne "c"
-            and $_ ne "configure"
-            and $_ ne "config.guess"
-            and $_ ne "config.sub"
-            and $_ ne "typemap"
-            and $_ ne "bin"
-            and $_ ne "lib"
-            and $_ ne "t"
-           and $_ ne "xt"
-            and $_ ne "inc"
-           and $_ ne "dist.ini.meta"
-            and $_ ne "autobuild.sh"
-           and $_ ne "debian"
-           and $_ ne "cpanfile"
-            and !/^perlcritic/
-           and !/^perltidy/
-            and $_ ne "pm_to_blib"
-            and $_ ne "install.sh"
-            and !/\.tar\./
-            and !/~$/
-            and !$doskip->($_)
-            } @files;
-
-    my %adddoc;
-    for my $r (split(/ /, $config->{add_doc} || '')) {
-        push(@doc, $r);
-    }
+    # $author //= get_author($content);
+    # my $authors="Authors:\n--------\n$author";
 
-    # special subdir
-    push(@doc, "examples") if grep(/^examples\//, @files);
-    push(@doc, "doc") if grep(/^doc\//, @files);
-    push(@doc, "docs") if grep(/^docs\//, @files);
-    push(@doc, "util") if grep(/^util\//, @files);
-    push(@doc, "example") if grep(/^example\//, @files);
-    push(@doc, "samples") if grep(/^samples\//, @files);
-    push(@doc, "license") if grep(/^license\//, @files);
+    my @doc = find_doc($config, $path, @files);
 
-    my $date=strftime("%a %b %d %Y", localtime);
+    my $date = strftime("%a %b %d %Y", localtime);
 
     my $noarch=!grep /\.(c|h|xs|inl)$/i, @files;
     my $vendorlib=($noarch ? "vendorlib" : "vendorarch");
     my $lib="\%{perl_$vendorlib}";
 
-    if (@filter_requires) {
-        my $script="$name-filter-requires.sh";
-        verbose "Writing $script...";
-        my $sh;
-        if ($force) {
-            rename($script, "$script~") if (-e $script);
-            $sh=new FileHandle ">$script";
-        } else {
-            $sh=new FileHandle $script, O_WRONLY|O_CREAT|O_EXCL;
-        }
-        die "Failed to create $script: $!\n" if (!$sh);
-
-        print $sh "#!/bin/sh\n\n"
-            . "\@\@PERL_REQ\@\@ \"\$\@\" | sed -e '/^$filter_requires[0]\$/d'";
-        if (@filter_requires > 1) {
-            for my $dep (@filter_requires[1..$#filter_requires]) {
-                print $sh " \\\n    -e '/^$dep\$/d'";
-            }
-        }
-        print $sh "\n";
-    }
-
-    if (@filter_provides) {
-        my $script = "$name-filter-provides.sh";
-        verbose "Writing $script...";
-        my $sh;
-        if ($force) {
-            rename($script, "$script~") if (-e $script);
-            $sh = new FileHandle ">$script";
-        }
-        else {
-            $sh = new FileHandle $script, O_WRONLY | O_CREAT | O_EXCL;
-        }
-        die "Failed to create $script: $!\n" if (!$sh);
-
-        print $sh "#!/bin/sh\n\n" . "\@\@PERL_PROV\@\@ \"\$\@\" | sed -e 
'/^$filter_provides[0]\$/d'";
-        if (@filter_provides > 1) {
-            for my $dep (@filter_provides[1 .. $#filter_provides]) {
-                print $sh " \\\n    -e '/^$dep\$/d'";
-            }
-        }
-        print $sh "\n";
-    }
+    filter_requires($name) if @filter_requires;
+    filter_provides($name) if @filter_provides;
 
     my $specfile = "$prefix$name.spec";
     verbose "Writing $specfile...";
@@ -1079,8 +989,7 @@
     else {
         $spec = new FileHandle "$specfile", O_WRONLY | O_CREAT | O_EXCL;
     }
-
-    if (!$spec) {
+    unless ($spec) {
         warn "Failed to create $specfile: $!\n";
         next;
     }
@@ -1088,193 +997,46 @@
     print $spec qq[\%{!?perl_$vendorlib: \%define perl_$vendorlib \%(eval 
"\`$cmdperl -V:install$vendorlib\`"; echo \$install$vendorlib)}\n\n]
       if ($compat);
 
-    $license = undef;
-
     my $scripts = 0;
-    my (%build_requires, %requires, %recommends);
-    my %provides;
-    my $metayaml = -e "$basedir/$path/META.yml" ? 1 : '';
-    my $metajson = -e "$basedir/$path/META.json" ? 1 : '';
+    my (%build_requires, %requires, %recommends, %provides);
     my $dynamic = 1;
     my $got_prereqs = 0;
 
-    if ($metajson) {
-        open my $fh, '<', "$basedir/$path/META.json" or die $!;
-        my $json = do { local $/; <$fh> };
-        close $fh;
-        $metajson = eval { $coder->decode($json) };
-        if ($@) {
-            warn "Error decoding META.json, ignoring ($@)";
-            $stats{metajson} = 'error';
+    if (-e "$basedir/$path/META.json") {
+        my $results = read_meta_json("$basedir/$path/META.json", \%stats);
+        $got_prereqs = $results->{got_prereqs};
+        $dynamic = $results->{dynamic};
+        $summary //= $results->{abstract};
+        if ($results->{build}) {
+            %build_requires = %{ $results->{build_requires} };
+            %requires = %{ $results->{requires} };
+            %recommends = %{ $results->{recommends} };
         }
-        else {
-            $stats{metajson} = 1;
-            if (exists $metajson->{dynamic_config} and not 
$metajson->{dynamic_config}) {
-                $dynamic = 0;
-            }
-
-            my ($prov, $build, $run, $rec) = prereqs_from_metajson($metajson);
-            if (keys %$prov) {
-                @provides{ keys %$prov } = values %$prov;
-            }
-            if ($build) {
-                %build_requires = %$build;
-                %requires = %$run;
-                %recommends = %$rec;
-                $got_prereqs = 1;
-                if ($debug) {
-                    warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%build_requires], 
['build_requires']);
-                    warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%requires], ['requires']);
-                    warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%recommends], ['recommends']);
-                }
-            }
-            $stats{license}->{metajson} = $metajson->{license};
-            if ($metajson->{abstract}) {
-                $stats{abstract}->{metajson} = $metajson->{abstract};
-            }
+        if (my $prov = $results->{provides}) {
+            @provides{ keys %$prov } = values %$prov;
         }
+        $got_prereqs = $results->{got_prereqs};
     }
 
-    if ($metayaml) {
-        my $yml = readfile("$path/META.yml");
-        my $meta = eval { Load($yml); };
-        if ($@) {
-            warn "Error parsing $path/META.yml: $@";
-            $stats{metayaml} = 'error';
-            goto SKIP;
-        }
-        $stats{metayaml} = 1;
-        if (exists $meta->{dynamic_config} and not $meta->{dynamic_config}) {
-            $dynamic = 0;
-        }
-
-        if ($meta->{abstract} && $meta->{abstract} ne 'unknown') {
-            my $abstract = $meta->{abstract};
-            $stats{abstract}->{metayaml} = $abstract;
-            $summary = $abstract unless defined $summary;
+    if (-e "$basedir/$path/META.yml") {
+        my $results = read_meta_yaml("$path/META.yml", \%stats);
+        $got_prereqs = $results->{got_prereqs};
+        $dynamic = $results->{dynamic};
+        $summary //= $results->{abstract};
+        if (not $got_prereqs and $results->{build}) {
+            %build_requires = %{ $results->{build_requires} };
+            %requires = %{ $results->{requires} };
+            %recommends = %{ $results->{recommends} };
         }
-
-        my ($prov, $build, $run, $rec) = prereqs_from_metayaml($meta);
-        if (not %provides and keys %$prov) {
+        if (not keys %provides and my $prov = $results->{provides}) {
             @provides{ keys %$prov } = values %$prov;
         }
-
-        if (not $got_prereqs and $build) {
-            %build_requires = %$build;
-            %requires = %$run;
-            %recommends = %$rec;
-            $got_prereqs = 1;
-            if ($debug) {
-                warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%build_requires], 
['build_requires']);
-                warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%requires], ['requires']);
-                warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%recommends], ['recommends']);
-            }
-        }
-        $stats{got_prereqs} = $got_prereqs; # did we get static dependencies?
-
-        # FIXME - I'm not sure this is sufficient...
-        if ($meta->{script_files} or $meta->{scripts}) {
-            $scripts = 1;
-        }
-
-        $stats{license}->{metayaml} = $meta->{license};
-        if ($meta->{license}) {
-            # This list of licenses is from the Module::Build::API
-            # docs, cross referenced with the list of licenses in
-            # /usr/share/rpmlint/config.
-            if ($meta->{license} =~ /^perl$/i) {
-                $license = $perllicense;
-            }
-            elsif ($meta->{license} =~ /^apache$/i) {
-                $license = "Apache-2.0";
-            }
-            elsif ($meta->{license} =~ /^artistic$/i) {
-                $license = "Artistic-1.0";
-            }
-            elsif ($meta->{license} =~ /^artistic_?2$/i) {
-                $license = "Artistic-2.0";
-            }
-            elsif ($meta->{license} =~ /^bsd$/i) {
-                $license = "BSD-3-Clause";
-            }
-            elsif ($meta->{license} =~ /^gpl$/i) {
-                $license = "GPL-1.0-or-later";
-            }
-            elsif ($meta->{license} =~ /^gpl2$/i) {
-                $license = "GPL-2.0-or-later";
-            }
-            elsif ($meta->{license} =~ /^lgpl$/i) {
-                $license = "LGPL-2.1-or-later";
-            }
-            elsif ($meta->{license} =~ /^mit$/i) {
-                $license = "MIT";
-            }
-            elsif ($meta->{license} =~ /^mozilla$/i) {
-                $license = "MPL";
-            }
-            elsif ($meta->{license} =~ /^gpl3$/i) {
-                $license = "GPL-3.0-or-later";
-            }
-            elsif ($meta->{license} =~ /^open_source$/i || $meta->{license} =~ 
/^unrestricted$/i) {
-                $license = "SUSE-Public-Domain";    # rpmlint will complain
-            }
-            elsif ($meta->{license} =~ /^restrictive$/i) {
-                $license = "SUSE-NonFree";
-                warn "License is 'restrictive'." . "  This package should not 
be redistributed.\n";
-            }
-            elsif ($meta->{license} =~ /^unknown$/i) {
-                # do nothing, it's unknown and we know
-            }
-            else {
-                warn "Unknown license in meta '" . $meta->{license} . "'!\n";
-            }
-        }
-      SKIP:
+        $scripts = $results->{scripts};
+        $license = $results->{license};
     }
     $stats{dynamic} = $dynamic;
     $debug and warn 
__PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\$dynamic], ['dynamic']);
 
-    if (!defined($license)) {
-        get_license($content);
-        if (
-            $license
-            && (   $license =~ /under the same terms as Perl/
-                || $license =~ /same terms as the Perl 5/
-                || $license =~ /under the terms of the Perl artistic license/
-                || $license =~ qr/free software.*dev.perl.org.* for more 
information/))
-        {
-            $license = $perllicense;
-        }
-    }
-
-    if (!length($summary)) {
-        $summary = "$module Perl module";
-    }
-
-    $license = "CHECK($perllicense)" if (!$license);
-    $stats{license}->{spec} = $license;
-
-    $description = $summary if (!defined($description));
-    $stats{summary} = $summary;
-
-    $summary =~ s,\.$,,;
-    $summary =~ s,^[aA] ,,;
-    if ($summary ne ucfirst($summary)) {
-        # capitalize the damn thing - for real
-        $summary = ucfirst($summary);
-        #require Text::Capitalize;
-        #$summary = Text::Capitalize::capitalize_title($summary);
-    }
-    if (length($summary) > 79) {
-        $summary = substr($summary, 0, 72) . "[cut]";
-    }
-    if ($config->{summary}) {
-        $summary = $config->{summary};
-    }
-    if ($config->{description}) {
-        $description = $config->{description};
-    }
-
     my $usebuildpl  = 0;
     my $usebuildplt = 0;
     if (grep /^Build\.PL$/, @files) {
@@ -1294,27 +1056,59 @@
         $debug and warn "Got prereqs, no need to run Makefile.PL/Build.PL";
     }
     else {
-        # Basic idea borrowed from Module::Depends.
-        my $intrusive = qq{perl $bin/bin/intrusive.pl $basedir$path};
-        my $jsondeps = qx{$intrusive};
-        my $deps = eval { $coder->decode($jsondeps) };
-        unless ($deps) {
-            warn "JSON: >>$jsondeps<<";
-            die $@;
-        }
-        my %lrequires = %{ $deps->{requires} };
-        foreach my $dep (keys(%lrequires)) {
-            $requires{$dep} = $lrequires{$dep};
-        }
-        %lrequires = %{ $deps->{build_requires} };
-        foreach my $dep (keys(%lrequires)) {
-            if (defined $build_requires{$dep}) {
-                next if version->parse($build_requires{$dep}) > 
version->parse($lrequires{$dep});
+        # Run Makefile.PL/Build.PL and read from generated MYMETA.{json,yml}
+        my $cmd = "perl Makefile.PL";
+        if ($usebuildpl) {
+            $cmd = "perl Build.PL";
+        }
+        my $out = qx{cd $basedir/$path; $cmd 2>&1};
+        if ($?) {
+            warn "Error when running $cmd: >>$out<<\n";
+        }
+        else {
+            my $dynamic_results;
+            if (-e "$basedir/$path/MYMETA.json") {
+                $dynamic_results = 
read_meta_json("$basedir/$path/MYMETA.json", \%stats);
+            }
+            elsif (-e "$basedir/$path/MYMETA.yml") {
+                $dynamic_results = read_meta_yaml("$path/MYMETA.yml", \%stats);
+                $license //= $dynamic_results->{license};
+            }
+            $summary //= $dynamic_results->{abstract};
+            # Add possible new requirements to existing static ones
+            my %newrequires = %{ $dynamic_results->{requires} };
+            foreach my $dep (keys(%newrequires)) {
+                $requires{$dep} = $newrequires{$dep};
+            }
+            %newrequires = %{ $dynamic_results->{build_requires} };
+            foreach my $dep (keys(%newrequires)) {
+                if (defined $build_requires{$dep}) {
+                    next if version->parse($build_requires{$dep}) > 
version->parse($newrequires{$dep});
+                }
+                $build_requires{$dep} = $newrequires{$dep};
             }
-            $build_requires{$dep} = $lrequires{$dep};
         }
     }
 
+    $license //= get_license_from_content($content);
+    $license = "CHECK($perllicense)" unless $license;
+    $stats{license}->{spec} = $license;
+
+    $summary //= get_summary($summary, $content, $module);
+    $description //= $summary;
+    $stats{summary} = $summary;
+    $summary =~ s,\.$,,;
+    $summary =~ s,^[aA] ,,;
+    $summary = ucfirst $summary;
+    if (length($summary) > 79) {
+        $summary = substr($summary, 0, 72) . "[cut]";
+    }
+
+    $summary = $config->{summary} if $config->{summary};
+    if (not length $summary) {
+        $summary = "$module Perl module";
+    }
+
     $stats{provides} = keys %provides;
     dump_statistics($module, $version, \%stats);
     unless (%provides) {
@@ -1369,14 +1163,11 @@
 
     print $spec "Epoch:          $epoch\n" if (defined($epoch));
     if ($config->{license}) {
-        if($config->{license} =~ /^Perl( License)?$/i)
-        {
-          $config->{license} = $perllicense;
+        if($config->{license} =~ /^Perl( License)?$/i) {
+            $config->{license} = $perllicense;
         }
-        if("CHECK($config->{license})" ne $license
-        && $config->{license} ne $license)
-        {
-          print $spec "#Upstream: $license\n";
+        if("CHECK($config->{license})" ne $license && $config->{license} ne 
$license) {
+            print $spec "#Upstream: $license\n";
         }
         print $spec "License:   $config->{license}\n";
     }
@@ -1890,6 +1681,211 @@
     return $string;
 }
 
+sub read_meta_json {
+    $debug and warn __PACKAGE__.':'.__LINE__.": =============== 
read_meta_json\n";
+    my ($file, $stats) = @_;
+    my %results = ( dynamic => 1 );
+    open my $fh, '<', $file or die $!;
+    my $json = do { local $/; <$fh> };
+    close $fh;
+    my $metajson = eval { $coder->decode($json) };
+    if ($@) {
+        warn "Error decoding META.json, ignoring ($@)";
+        $stats->{metajson} = 'error';
+        return;
+    }
+    $stats->{metajson} = 1;
+    if (exists $metajson->{dynamic_config} and not 
$metajson->{dynamic_config}) {
+        $results{dynamic} = 0;
+    }
+
+    my ($prov, $build, $run, $rec) = prereqs_from_metajson($metajson);
+    if (keys %$prov) {
+        @{ $results{provides} }{keys %$prov } = values %$prov;
+    }
+    if ($build) {
+        $results{build} = 1;
+        $results{build_requires} = $build;
+        $results{requires} = $run;
+        $results{recommends} = $rec;
+        $results{got_prereqs} = 1;
+        if ($debug) {
+            warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%results], 
['results']);
+        }
+    }
+    $results{license} = $metajson->{license};
+    if ($metajson->{abstract} && $metajson->{abstract} ne 'unknown') {
+        my $abstract = $metajson->{abstract};
+        $stats->{abstract}->{metajson} = $abstract;
+        $results{abstract} = $abstract;
+    }
+    $stats->{license}->{metajson} = $metajson->{license};
+    if ($metajson->{abstract}) {
+        $stats->{abstract}->{metajson} = $metajson->{abstract};
+    }
+
+    return \%results;
+}
+
+sub read_meta_yaml {
+    $debug and warn __PACKAGE__.':'.__LINE__.": =============== 
read_meta_yaml\n";
+    my ($file, $stats) = @_;
+    my $yml = readfile($file);
+    my $meta = eval { Load($yml); };
+    if ($@) {
+        warn "Error parsing $file: $@";
+        $stats->{metayaml} = 'error';
+        return;
+    }
+    my %results = ( dynamic => 1 );
+    $stats->{metayaml} = 1;
+    if (exists $meta->{dynamic_config} and not $meta->{dynamic_config}) {
+        $results{dynamic} = 0;
+    }
+
+    if ($meta->{abstract} && $meta->{abstract} ne 'unknown') {
+        my $abstract = $meta->{abstract};
+        $stats->{abstract}->{metayaml} = $abstract;
+        $results{abstract} = $abstract;
+    }
+
+    my ($prov, $build, $run, $rec) = prereqs_from_metayaml($meta);
+    if (keys %$prov) {
+        @{ $results{provides} }{keys %$prov } = values %$prov;
+    }
+
+    if ($build) {
+        $results{build} = 1;
+        $results{build_requires} = $build;
+        $results{requires} = $run;
+        $results{recommends} = $rec;
+        $results{got_prereqs} = 1;
+        if ($debug) {
+            warn __PACKAGE__.':'.__LINE__.$".Data::Dumper->Dump([\%results], 
['results']);
+        }
+    }
+    $stats->{got_prereqs} = $results{got_prereqs}; # did we get static 
dependencies?
+
+    # FIXME - I'm not sure this is sufficient...
+    if ($meta->{script_files} or $meta->{scripts}) {
+        $results{scripts} = 1;
+    }
+    my $license;
+
+    $stats->{license}->{metayaml} = $meta->{license};
+    if ($meta->{license}) {
+        # This list of licenses is from the Module::Build::API
+        # docs, cross referenced with the list of licenses in
+        # /usr/share/rpmlint/config.
+        if ($meta->{license} =~ /^perl$/i) {
+            $license = $perllicense;
+        }
+        elsif ($meta->{license} =~ /^apache$/i) {
+            $license = "Apache-2.0";
+        }
+        elsif ($meta->{license} =~ /^artistic$/i) {
+            $license = "Artistic-1.0";
+        }
+        elsif ($meta->{license} =~ /^artistic_?2$/i) {
+            $license = "Artistic-2.0";
+        }
+        elsif ($meta->{license} =~ /^bsd$/i) {
+            $license = "BSD-3-Clause";
+        }
+        elsif ($meta->{license} =~ /^gpl$/i) {
+            $license = "GPL-1.0-or-later";
+        }
+        elsif ($meta->{license} =~ /^gpl2$/i) {
+            $license = "GPL-2.0-or-later";
+        }
+        elsif ($meta->{license} =~ /^lgpl$/i) {
+            $license = "LGPL-2.1-or-later";
+        }
+        elsif ($meta->{license} =~ /^mit$/i) {
+            $license = "MIT";
+        }
+        elsif ($meta->{license} =~ /^mozilla$/i) {
+            $license = "MPL";
+        }
+        elsif ($meta->{license} =~ /^gpl3$/i) {
+            $license = "GPL-3.0-or-later";
+        }
+        elsif ($meta->{license} =~ /^open_source$/i || $meta->{license} =~ 
/^unrestricted$/i) {
+            $license = "SUSE-Public-Domain";    # rpmlint will complain
+        }
+        elsif ($meta->{license} =~ /^restrictive$/i) {
+            $license = "SUSE-NonFree";
+            warn "License is 'restrictive'." . "  This package should not be 
redistributed.\n";
+        }
+        elsif ($meta->{license} =~ /^unknown$/i) {
+            # do nothing, it's unknown and we know
+        }
+        else {
+            warn "Unknown license in meta '" . $meta->{license} . "'!\n";
+        }
+    }
+    $results{license} = $license;
+    return \%results;
+}
+
+sub find_doc {
+    my ($config, $path, @files) = @_;
+
+    my @skipdoc = split ' ', ($config->{skip_doc} || '');
+    my $doskip = sub {
+        for my $s (@skipdoc) { return 1 if m/$s/ }
+        return 0;
+    };
+
+    my @doc = sort { $a cmp $b } grep {
+                !m{/}
+            and !/\.(pl|xs|h|c|pm|ini?|pod|cfg|inl|bak|spec)$/i
+            and !/^\./
+            and !/~$/
+            and $_ ne $path
+            and $_ ne "MANIFEST"
+            and $_ ne "MANIFEST.SKIP"
+            and $_ ne "SIGNATURE"
+            and $_ ne "NINJA"
+            and $_ ne "c"
+            and $_ ne "configure"
+            and $_ ne "config.guess"
+            and $_ ne "config.sub"
+            and $_ ne "typemap"
+            and $_ ne "bin"
+            and $_ ne "lib"
+            and $_ ne "t"
+            and $_ ne "xt"
+            and $_ ne "inc"
+            and $_ ne "dist.ini.meta"
+            and $_ ne "autobuild.sh"
+            and $_ ne "debian"
+            and $_ ne "cpanfile"
+            and $_ ne "pm_to_blib"
+            and $_ ne "install.sh"
+            and !/^INSTALL/i
+            and !/^META\..+$/i
+            and !/^MYMETA\..+$/i
+            and !/^perlcritic/
+            and !/^perltidy/
+            and !/\.tar\./
+            and !/~$/
+            and !$doskip->($_)
+        } @files;
+
+    push @doc, split ' ', ($config->{add_doc} || '');
+
+    # special subdir
+    push(@doc, "examples") if grep(/^examples\//, @files);
+    push(@doc, "doc") if grep(/^doc\//, @files);
+    push(@doc, "docs") if grep(/^docs\//, @files);
+    push(@doc, "util") if grep(/^util\//, @files);
+    push(@doc, "example") if grep(/^example\//, @files);
+    push(@doc, "samples") if grep(/^samples\//, @files);
+    push(@doc, "license") if grep(/^license\//, @files);
+    return @doc;
+}
+
 sub dump_statistics {
     my ($module, $version, $stats) = @_;
     $stats->{name} = $module;
@@ -1900,4 +1896,50 @@
     verbose($yaml);
 }
 
+sub filter_requires {
+    my ($name) = @_;
+    my $script="$name-filter-requires.sh";
+    verbose "Writing $script...";
+    my $sh;
+    if ($force) {
+        rename($script, "$script~") if (-e $script);
+        $sh=new FileHandle ">$script";
+    } else {
+        $sh=new FileHandle $script, O_WRONLY|O_CREAT|O_EXCL;
+    }
+    die "Failed to create $script: $!\n" if (!$sh);
+
+    print $sh "#!/bin/sh\n\n"
+        . "\@\@PERL_REQ\@\@ \"\$\@\" | sed -e '/^$filter_requires[0]\$/d'";
+    if (@filter_requires > 1) {
+        for my $dep (@filter_requires[1..$#filter_requires]) {
+            print $sh " \\\n    -e '/^$dep\$/d'";
+        }
+    }
+    print $sh "\n";
+}
+
+sub filter_provides {
+    my ($name) = @_;
+    my $script = "$name-filter-provides.sh";
+    verbose "Writing $script...";
+    my $sh;
+    if ($force) {
+        rename($script, "$script~") if (-e $script);
+        $sh = new FileHandle ">$script";
+    }
+    else {
+        $sh = new FileHandle $script, O_WRONLY | O_CREAT | O_EXCL;
+    }
+    die "Failed to create $script: $!\n" if (!$sh);
+
+    print $sh "#!/bin/sh\n\n" . "\@\@PERL_PROV\@\@ \"\$\@\" | sed -e 
'/^$filter_provides[0]\$/d'";
+    if (@filter_provides > 1) {
+        for my $dep (@filter_provides[1 .. $#filter_provides]) {
+            print $sh " \\\n    -e '/^$dep\$/d'";
+        }
+    }
+    print $sh "\n";
+}
+
 # vi: set ai et:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/cpanspec-1.81.01.1620405353.7ed9076/lib/Intrusive.pm 
new/cpanspec-1.82.01.1646998297.5af26bb/lib/Intrusive.pm
--- old/cpanspec-1.81.01.1620405353.7ed9076/lib/Intrusive.pm    2021-05-07 
18:35:53.000000000 +0200
+++ new/cpanspec-1.82.01.1646998297.5af26bb/lib/Intrusive.pm    1970-01-01 
01:00:00.000000000 +0100
@@ -1,182 +0,0 @@
-use strict;
-package Intrusive;
-use Cwd qw( getcwd );
-use ExtUtils::MakeMaker ();
-use Parse::CPAN::Meta;
-use Cwd qw( getcwd );
-use base qw( Class::Accessor::Chained );
-__PACKAGE__->mk_accessors(qw( dist_dir debug libs requires build_requires 
error ));
-
-sub new {
-    my $self = shift;
-
-    return $self->SUPER::new({
-        libs           => [],
-        requires       => {},
-        build_requires => {},
-        error          => '',
-    });
-}
-
-sub find_modules {
-    my $self = shift;
-
-    my $here = getcwd;
-    unless (chdir $self->dist_dir) {
-        $self->error( "couldn't chdir to " . $self->dist_dir . ": $!" );
-        return $self;
-    }
-    eval { $self->_find_modules };
-    chdir $here;
-    die $@ if $@;
-
-    return $self;
-}
-
-sub _find_modules {
-    my $self = shift;
-
-    # this order is important, as when a Makefile.PL and Build.PL are
-    # present, the Makefile.PL could just be a passthrough
-    my $pl = -e 'Build.PL' ? 'Build.PL' : -e 'Makefile.PL' ? 'Makefile.PL' : 0;
-    unless ($pl) {
-        $self->error( 'No {Build,Makefile}.PL found in '.$self->dist_dir );
-        return $self;
-    }
-
-    # avoid downloads in configure!
-    $ENV{HTTP_PROXY}  = "http://9.9.9.9";;
-    # fake up Module::Build and ExtUtils::MakeMaker
-    no warnings 'redefine';
-    local *STDIN; # run non-interactive
-    local *STDOUT;
-    local *ExtUtils::Liblist::ext = sub {
-        my ($class, $lib) = @_;
-        $lib =~ s/\-l//;
-        push @{ $self->libs }, $lib;
-        return 1;
-    };
-    local *CORE::GLOBAL::exit = sub { };
-    local $INC{"Module/Build.pm"} = 1;
-    local @MyModuleBuilder::ISA = qw( Module::Build );
-    local *Module::Build::new = sub {
-        my $class = shift;
-        my %args =  @_;
-        $self->requires( $args{requires} || {} );
-        $self->build_requires( $args{build_requires} || {} );
-        bless {}, "Intrusive::Fake::Module::Build";
-    };
-    local *Module::Build::subclass = sub { 'Module::Build' };
-    local $Module::Build::VERSION = 666;
-
-    my $WriteMakefile = sub {
-        my %args = @_;
-        $self->requires( $args{PREREQ_PM} || {} );
-        my %br = %{ $args{TEST_REQUIRES} || {} };
-        %br = (%br, %{ $args{BUILD_REQUIRES} }) if $args{BUILD_REQUIRES};
-        $self->build_requires( \%br );
-        1;
-    };
-    local *main::WriteMakefile;
-    local *ExtUtils::MakeMaker::WriteMakefile = $WriteMakefile;
-
-    # Inline::MakeMaker
-    local $INC{"Inline/MakeMaker.pm"} = 1;
-
-    local @Inline::MakeMaker::EXPORT = qw( WriteMakefile WriteInlineMakefile );
-    local @Inline::MakeMaker::ISA = qw( Exporter );
-    local *Inline::MakeMaker::WriteMakefile = $WriteMakefile;
-    local *Inline::MakeMaker::WriteInlineMakefile = $WriteMakefile;
-
-    # Module::Install
-    local $INC{"inc/Module/Install.pm"} = 1;
-    local @inc::Module::Install::ISA = qw( Exporter );
-    local @inc::Module::Install::EXPORT = qw(
-
-      all_from auto_install AUTOLOAD build_requires check_nmake include
-      include_deps installdirs Makefile makemaker_args Meta name no_index
-      requires WriteAll clean_files can_cc sign cc_inc_paths cc_files
-      cc_optimize_flags author license
-
-    );
-    local *inc::Module::Install::AUTOLOAD = sub { 1 };
-    local *inc::Module::Install::requires = sub {
-        my %deps = (@_ == 1 ? ( $_[0] => 0 ) : @_);
-        $self->requires->{ $_ } = $deps{ $_ } for keys %deps;
-    };
-    local *inc::Module::Install::include_deps = 
*inc::Module::Install::requires;
-    local *inc::Module::Install::build_requires = sub {
-        my %deps = (@_ == 1 ? ( $_[0] => 0 ) : @_);
-        $self->build_requires->{ $_ } = $deps{ $_ } for keys %deps;
-    };
-
-    my $file = File::Spec->catfile( getcwd(), $pl );
-    eval {
-        package main;
-        no strict;
-        no warnings;
-        $SIG{ALRM} = sub { die "Timeout"; };
-        alarm 5;
-       local $0 = $file;
-        do "$file";
-        alarm 0;
-    };
-    $self->error( $@ ) if $@;
-    delete $INC{$file};
-    return $self;
-}
-
-package Intrusive::Fake::Module::Build;
-sub DESTROY {}
-sub AUTOLOAD { shift }
-sub y_n {
-    my ($self, $question, $default) = @_;
-    $default ||= 'n';
-    return 1 if lc $default eq 'y';
-    return 0; # ok, we may say no when yes was intended, but we can't hang
-}
-
-package
-   Term::ReadLine;
-sub new { print "FAIL\n"; }
-
-1;
-
-__END__
-
-=head1 NAME
-
-Module::Depends::Intrusive - intrusive discovery of distribution dependencies.
-
-=head1 SYNOPSIS
-
- # Just like Module::Depends, only use the Intrusive class instead
-
-=head1 DESCRIPTION
-
-This module devines dependencies by running the distributions
-Makefile.PL/Build.PL in a faked up environment and intercepting the
-calls to Module::Build->new and ExtUtils::MakeMaker::WriteMakefile.
-
-You may now freak out about security.
-
-While you're doing that please remember that what we're doing is much
-the same that CPAN.pm does in order to discover prerequisites.
-
-=head1 AUTHOR
-
-Richard Clamp, based on code extracted from the Fotango build system
-originally by James Duncan and Arthur Bergman.
-
-=head1 COPYRIGHT
-
-Copyright 2004 Fotango.  All Rights Reserved.
-
-This module is free software; you can redistribute it and/or modify it
-under the same terms as Perl itself.
-
-=head1 SEE ALSO
-
-L<Module::Depends>
-
-=cut

++++++ cpanspec.obsinfo ++++++
--- /var/tmp/diff_new_pack.Xv5rZi/_old  2022-03-13 20:25:50.363702791 +0100
+++ /var/tmp/diff_new_pack.Xv5rZi/_new  2022-03-13 20:25:50.367702795 +0100
@@ -1,6 +1,6 @@
 name: cpanspec
-version: 1.81.01.1620405353.7ed9076
-mtime: 1620405353
-commit: 7ed9076bb6e249082bab6d5b6a66eed7f33e8703
+version: 1.82.01.1646998297.5af26bb
+mtime: 1646998297
+commit: 5af26bbce689d5ba075935014ebe361c028060c3
 
 

Reply via email to