scancpan: refactor with MetaCPAN::API source()
authorFrancois Perrad <fperrad@gmail.com>
Wed, 14 Jun 2017 14:15:30 +0000 (16:15 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Thu, 15 Jun 2017 20:31:50 +0000 (22:31 +0200)
instead of get_manifest()

Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
support/scripts/scancpan

index f87cdce7afa1bc9af6c8eb493ccbee64c6cc1982..82c77a8575629ce77609f7fb6238d7f7d60b6146 100755 (executable)
@@ -536,13 +536,6 @@ sub get_checksum {
     return $chksum->{$basename}, $basename;
 }
 
-sub get_manifest {
-    my ($author, $distname, $version) = @_;
-    my $url = qq{http://fastapi.metacpan.org/source/${author}/${distname}-${version}/MANIFEST};
-    my $response = $ua->get($url);
-    return $response->{content};
-}
-
 sub is_xs {
     my ($manifest) = @_;
     # This heuristic determines if a module is a native extension, by searching
@@ -572,7 +565,9 @@ sub fetch {
         say qq{fetch ${name}} unless $quiet;
         my $result = $mcpan->release( distribution => $name );
         $dist{$name} = $result;
-        my $manifest = get_manifest( $result->{author}, $name, $result->{version} );
+        my $manifest = $mcpan->source( author => $result->{author},
+                                       release => $name . q{-} . $result->{version},
+                                       path => 'MANIFEST' );
         $need_dlopen{$name} = is_xs( $manifest );
         $license_files{$name} = find_license_files( $manifest );
         my %build = ();