* [Buildroot] [PATCH] scancpan: print package/Config.in only when useful
@ 2018-10-24 7:10 Francois Perrad
2018-11-01 21:22 ` Thomas Petazzoni
0 siblings, 1 reply; 2+ messages in thread
From: Francois Perrad @ 2018-10-24 7:10 UTC (permalink / raw)
To: buildroot
ie. when a new Perl package is added
Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
---
utils/scancpan | 38 ++++++++++++++++++++++----------------
1 file changed, 22 insertions(+), 16 deletions(-)
diff --git a/utils/scancpan b/utils/scancpan
index 7c1e4236f..f9589a4ff 100755
--- a/utils/scancpan
+++ b/utils/scancpan
@@ -526,6 +526,7 @@ my %checksum; # author -> list of checksum
my $mirror = 'http://cpan.metacpan.org'; # a CPAN mirror
my $mcpan = MetaCPAN::API::Tiny->new(base_url => 'http://fastapi.metacpan.org/v1');
my $ua = HTTP::Tiny->new();
+my $new_pkgs;
my %white_list = (
'ExtUtils-Config' => 1,
@@ -684,7 +685,10 @@ while (my ($distname, $dist) = each %dist) {
my $mkname = $dirname . q{/} . $fsname . q{.mk};
my $hashname = $dirname . q{/} . $fsname . q{.hash};
my $brname = brname( $fsname );
- mkdir $dirname unless -d $dirname;
+ unless (-d $dirname) {
+ mkdir $dirname;
+ $new_pkgs = 1;
+ }
if ($need_target{$distname} && ($force || !-f $cfgname)) {
$dist->{abstract} =~ s|\s+$||;
my $abstract = wrap( q{}, qq{\t }, $dist->{abstract} );
@@ -773,24 +777,26 @@ while (my ($distname, $dist) = each %dist) {
}
}
-my %pkg;
-my $cfgname = q{package/Config.in};
-if (-f $cfgname) {
- open my $fh, q{<}, $cfgname;
- while (<$fh>) {
- chomp;
- $pkg{$_} = 1 if m|package/perl-|;
+if ($new_pkgs) {
+ my %pkg;
+ my $cfgname = q{package/Config.in};
+ if (-f $cfgname) {
+ open my $fh, q{<}, $cfgname;
+ while (<$fh>) {
+ chomp;
+ $pkg{$_} = 1 if m|package/perl-|;
+ }
+ close $fh;
}
- close $fh;
-}
-foreach my $distname (keys %need_target) {
- my $fsname = fsname( $distname );
- $pkg{qq{\tsource "package/${fsname}/Config.in"}} = 1;
-}
+ foreach my $distname (keys %need_target) {
+ my $fsname = fsname( $distname );
+ $pkg{qq{\tsource "package/${fsname}/Config.in"}} = 1;
+ }
-say qq{${cfgname} must contain the following lines:};
-say join qq{\n}, sort keys %pkg;
+ say qq{${cfgname} must contain the following lines:};
+ say join qq{\n}, sort keys %pkg;
+}
say join qq{\n}, @info;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [Buildroot] [PATCH] scancpan: print package/Config.in only when useful
2018-10-24 7:10 [Buildroot] [PATCH] scancpan: print package/Config.in only when useful Francois Perrad
@ 2018-11-01 21:22 ` Thomas Petazzoni
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni @ 2018-11-01 21:22 UTC (permalink / raw)
To: buildroot
Hello,
On Wed, 24 Oct 2018 09:10:56 +0200, Francois Perrad wrote:
> ie. when a new Perl package is added
>
> Signed-off-by: Francois Perrad <francois.perrad@gadz.org>
> ---
> utils/scancpan | 38 ++++++++++++++++++++++----------------
> 1 file changed, 22 insertions(+), 16 deletions(-)
Applied to master after extending the commit log. Thanks!
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-01 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-24 7:10 [Buildroot] [PATCH] scancpan: print package/Config.in only when useful Francois Perrad
2018-11-01 21:22 ` Thomas Petazzoni
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox