Skip to content

Commit 4c3f96b

Browse files
author
H.Merijn Brand - Tux
committed
Merge META works - provide cpanfile
1 parent 19c7c82 commit 4c3f96b

File tree

6 files changed

+86
-2
lines changed

6 files changed

+86
-2
lines changed

ChangeLog

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
0.90 - 25 May 2019, H.Merijn Brand
1+
0.90 - 17 Jun 2019, H.Merijn Brand
22
* It's 2018
33
* Update links
44
* It's 2019
55
* Update to Devel::PPPort-3.52
66
* Tested with perl-5.30.0
7+
* Provide cpanfile
78

89
0.89 - 14 Sep 2017, H.Merijn Brand
910
* Implement dictionary introspection in HLI

MANIFEST

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ ppport.h
99
README
1010
Unify.h
1111
Unify.xs
12+
cpanfile
1213
lib/DBD/Unify.pm
1314
lib/DBD/Unify/TypeInfo.pm
1415
lib/DBD/Unify/GetInfo.pm

MANIFEST.SKIP

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
\.git
88
\.xsi$
99
\.perlcriticrc
10+
\.whitesource
1011
blib/
1112
csv/
1213
cover_db/

cpanfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
requires "Carp";
2+
requires "DBI" => "1.42";
3+
requires "DynaLoader";
4+
5+
recommends "DBI" => "1.642";
6+
7+
on "configure" => sub {
8+
requires "Config";
9+
requires "Cwd";
10+
requires "DBI::DBD";
11+
requires "ExtUtils::MakeMaker";
12+
};
13+
14+
on "build" => sub {
15+
requires "Config";
16+
requires "File::Copy";
17+
requires "File::Find";
18+
};
19+
20+
on "test" => sub {
21+
requires "Test::Harness";
22+
requires "Test::More" => "0.90";
23+
24+
recommends "Test::More" => "1.302164";
25+
};

sandbox/genMETA.pl

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
);
2020

2121
$meta->from_data (<DATA>);
22+
$meta->gen_cpanfile ();
2223

2324
if ($check) {
2425
$meta->check_encoding ();

sandbox/genMETA.pm

+56-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
package genMETA;
44

5-
our $VERSION = "1.08-20160520";
5+
our $VERSION = "1.09-20190531";
66

77
use 5.14.1;
88
use warnings;
@@ -453,4 +453,59 @@ sub fix_meta {
453453
unlink glob "MYMETA*";
454454
} # fix_meta
455455

456+
sub _cpfd {
457+
my ($jsn, $sct, $f) = @_;
458+
459+
open my $sh, ">", \my $b;
460+
my $sep = "";
461+
for (qw( requires recommends suggests )) {
462+
my $s = $jsn->{"$sct$_"} or next;
463+
print $sh $sep;
464+
foreach my $m (sort keys %$s) {
465+
$m eq "perl" and next;
466+
my $v = $s->{$m};
467+
printf $sh qq{%-10s "%s"}, $_, $m;
468+
my $aw = (24 - length $m); $aw < 0 and $aw = 0;
469+
printf $sh qq{%s => "%s"}, " " x $aw, $v if $v;
470+
say $sh ";";
471+
}
472+
$sep = "\n";
473+
}
474+
close $sh;
475+
$sct || $f and $b and $b .= "};";
476+
return $b;
477+
} # _cpfd
478+
479+
sub gen_cpanfile {
480+
my $self = shift;
481+
482+
open my $fh, ">", "cpanfile";
483+
484+
my $jsn = $self->{h};
485+
foreach my $sct_ ("", "configure_", "build_", "test_", "runtime_") {
486+
487+
my $sct = $sct_ =~ s/_$//r;
488+
489+
my $b = _cpfd ($jsn, $sct_, 0) or next;
490+
491+
if ($sct) {
492+
say $fh qq/\non "$sct" => sub {/;
493+
say $fh $b =~ s/^/ /gmr;
494+
}
495+
else {
496+
print $fh $b;
497+
}
498+
}
499+
500+
if (my $of = $jsn->{optional_features}) {
501+
foreach my $f (sort keys %$of) {
502+
my $fs = $of->{$f};
503+
say $fh qq/\nfeature "$f", "$fs->{description}" => sub {/;
504+
say $fh _cpfd ($fs, "", 1) =~ s/^/ /gmr;
505+
}
506+
}
507+
508+
close $fh;
509+
} # gen_cpanfile
510+
456511
1;

0 commit comments

Comments
 (0)