From 20a24ed881dd1f255c06db5cbc84308dde4c6fab Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Thu, 3 Jan 2013 04:50:59 -0600 Subject: added get_installed_cpans() subroutine --- SBO-Lib/lib/SBO/Lib.pm | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index e06f124..b41fde2 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -850,3 +850,27 @@ sub get_readme_contents($) { close $fh; return $readme; } + +# return a list of perl modules installed via the CPAN +sub get_installed_cpans() { + my @locals; + for my $dir (@INC) { + push @locals, "$dir/perllocal.pod" if -f "$dir/perllocal.pod"; + } + my @contents; + for my $file (@locals) { + my $fh = open_read $file; + push @contents, grep {/Module|VERSION/} <$fh>; + close $fh; + } + my $mod_regex = qr/C\s+L<([^\|]+)/; + my $ver_regex = qr/C]+)>/; + my (@mods, @vers); + for my $line (@contents) { + push @mods, ($line =~ $mod_regex)[0]; + push @vers, ($line =~ $ver_regex)[0]; + } + my %cpans; + $cpans{$mods}[$_] = $vers[$_] for keys @mods; + return \%cpans; +} -- cgit v1.2.3 From 3dfa9294421bcf117265692294c0c72c41711ac4 Mon Sep 17 00:00:00 2001 From: J Pipkin Date: Fri, 4 Jan 2013 03:05:02 -0600 Subject: stop pulling version, integrate into sboupgrade --- SBO-Lib/lib/SBO/Lib.pm | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'SBO-Lib/lib/SBO/Lib.pm') diff --git a/SBO-Lib/lib/SBO/Lib.pm b/SBO-Lib/lib/SBO/Lib.pm index b41fde2..821daa3 100644 --- a/SBO-Lib/lib/SBO/Lib.pm +++ b/SBO-Lib/lib/SBO/Lib.pm @@ -42,6 +42,7 @@ our @EXPORT = qw( get_arch get_build_queue merge_queues + get_installed_cpans $tempdir $conf_dir $conf_file @@ -860,17 +861,19 @@ sub get_installed_cpans() { my @contents; for my $file (@locals) { my $fh = open_read $file; - push @contents, grep {/Module|VERSION/} <$fh>; +# push @contents, grep {/Module|VERSION/} <$fh>; + push @contents, grep {/Module/} <$fh>; close $fh; } my $mod_regex = qr/C\s+L<([^\|]+)/; - my $ver_regex = qr/C]+)>/; +# my $ver_regex = qr/C]+)>/; my (@mods, @vers); for my $line (@contents) { push @mods, ($line =~ $mod_regex)[0]; - push @vers, ($line =~ $ver_regex)[0]; +# push @vers, ($line =~ $ver_regex)[0]; } - my %cpans; - $cpans{$mods}[$_] = $vers[$_] for keys @mods; - return \%cpans; + return \@mods; +# my %cpans; +# $cpans{$mods[$_]} = $vers[$_] for keys @mods; +# return \%cpans; } -- cgit v1.2.3