git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #82541 from ydlr/nix-generate-from-cpan

nix-generate-from-cpan: remove "unkown" license and improve core module detection

commit2fc67aca651a7b2b5e77bb41d61747db7801d951 authorRobert Helgesson <robert@rycee.net> dateSun 15 Mar 2020, 12:54 (7 years ago) parent7566b4f9035381
1 file changed+4−9
maintainers/scripts/nix-generate-from-cpan.pl+4−9
maintainers/scripts/nix-generate-from-cpan.pl+4−9
@@ -6,6 +6,7 @@ use warnings;
66
77use CPAN::Meta();
88use CPANPLUS::Backend();
9+use Module::CoreList;
910use Getopt::Long::Descriptive qw( describe_options );
1011use JSON::PP qw( encode_json );
1112use Log::Log4perl qw(:easy);
@@ -164,7 +165,7 @@ Readonly::Hash my %LICENSE_MAP => (
164165
165166 # License not provided in metadata.
166167 unknown => {
167− licenses => [qw( unknown )],
168+ licenses => [],
168169 amb => 1
169170 }
170171);
@@ -278,14 +279,8 @@ sub get_deps {
278279 foreach my $n ( $deps->required_modules ) {
279280 next if $n eq "perl";
280281
281− # Figure out whether the module is a core module by attempting
282− # to `use` the module in a pure Perl interpreter and checking
283− # whether it succeeded. Note, $^X is a magic variable holding
284− # the path to the running Perl interpreter.
285− if ( system("env -i $^X -M$n -e1 >/dev/null 2>&1") == 0 ) {
286− DEBUG("skipping Perl-builtin module $n");
287− next;
288− }
282+ my @core = Module::CoreList->find_modules(qr/^$n$/);
283+ next if (@core);
289284
290285 my $pkg = module_to_pkg( $cb, $n );
291286