Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from perlpunk/metajson
Read from META.json and more
- Loading branch information
Showing
5 changed files
with
363 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
FROM opensuse/leap:15.2 | ||
|
||
RUN zypper refresh \ | ||
&& zypper install -y \ | ||
osc \ | ||
perl \ | ||
perl-YAML-LibYAML \ | ||
perl-XML-Simple \ | ||
perl-Parse-CPAN-Packages \ | ||
procmail \ | ||
wget \ | ||
vim \ | ||
git \ | ||
perl-Text-Autoformat \ | ||
perl-YAML \ | ||
perl-Pod-POM \ | ||
perl-libwww-perl \ | ||
perl-Class-Accessor-Chained \ | ||
perl-Perl-PrereqScanner \ | ||
perl-Algorithm-Diff \ | ||
perl-Module-Build-Tiny \ | ||
perl-ExtUtils-Depends \ | ||
perl-ExtUtils-PkgConfig \ | ||
obs-service-format_spec_file \ | ||
&& true | ||
|
||
|
||
RUN cd /tmp && wget http://www.cpan.org/modules/02packages.details.txt.gz | ||
|
||
ENV LANG=en_US.UTF-8 \ | ||
LC_CTYPE="en_US.UTF-8" \ | ||
LC_NUMERIC="en_US.UTF-8" \ | ||
LC_TIME="en_US.UTF-8" \ | ||
LC_COLLATE="en_US.UTF-8" | ||
|
||
|
||
# perl /cpanspec/cpanspec -v -f --skip-changes --pkgdetails /tmp/02packages.details.txt.gz tarball | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use 5.010; | ||
use Data::Dumper; | ||
use Getopt::Long; | ||
|
||
GetOptions( | ||
"debug" => \my $debug, | ||
"dry" => \my $dry, | ||
"help|h" => \my $help, | ||
) # flag | ||
or die "Error in command line arguments"; | ||
|
||
if ($help) { | ||
print <<'EOM'; | ||
Usage: | ||
batch.pl /path/to/packages 0 50 # process the first 51 packages | ||
EOM | ||
exit; | ||
} | ||
|
||
my ($dir, $from, $to) = @ARGV; | ||
$from ||= 0; | ||
$to ||= $from; | ||
|
||
my @skip = qw/ | ||
perl-AcePerl | ||
perl-Acme-MetaSyntactic | ||
perl-Acme-Ook | ||
perl-Algorithm-Munkres | ||
perl-Alien-LibGumbo | ||
perl-Alien-SVN | ||
perl-Alien-Tidyp | ||
perl-Apache-AuthNetLDAP | ||
perl-Apache-Filter | ||
perl-Apache-SessionX | ||
perl-Apache-Gallery | ||
perl-App-ProcIops | ||
perl-App-Nopaste | ||
perl-App-SVN-Bisect | ||
perl-App-gcal | ||
perl-Array-Dissect | ||
perl-Audio-CD | ||
perl-Authen-SASL-Cyrus | ||
perl-BIND-Conf_Parser | ||
perl-BSXML | ||
perl-Boost-Geometry-Utils | ||
perl-Class-Accessor-Chained | ||
Class-Multimethods | ||
perl-Crypt-HSXKPasswd | ||
perl-Crypt-Rot13 | ||
/; | ||
my %skip; | ||
@skip{ @skip } = (); | ||
|
||
opendir my $dh, $dir or die $!; | ||
my @pkgs = sort grep { | ||
-d "$dir/$_" && m/^perl-/ | ||
and not exists $skip{ $_ } | ||
} readdir $dh; | ||
closedir $dh; | ||
|
||
my $count = @pkgs; | ||
say "Total: $count"; | ||
|
||
my $opt_debug = $debug ? '--debug' : ''; | ||
for my $i ($from .. $to) { | ||
my $pkg = $pkgs[ $i ]; | ||
chdir $dir; | ||
say "=========== ($i) $pkg"; | ||
next if $dry; | ||
chdir $pkg; | ||
my $mod = $pkg; | ||
$mod =~ s/^perl-//; | ||
my @glob = glob("$mod*"); | ||
my $cmd = qq{cpanspec $opt_debug -v -f --skip-changes --pkgdetails /tmp/02packages.details.txt.gz @glob 2>&1}; | ||
say "Cmd: $cmd"; | ||
my $out = qx{$cmd}; | ||
say $out; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/perl | ||
use strict; | ||
use warnings; | ||
use 5.010; | ||
use JSON::PP; | ||
use File::Basename qw/ dirname /; | ||
my $bin = dirname(__FILE__); | ||
require "$bin/../lib/Intrusive.pm"; | ||
|
||
my $coder = JSON::PP->new->utf8->pretty->canonical; | ||
|
||
my ($path) = @ARGV; | ||
|
||
# Makefile.PL etc. might print things to STDOUT, temporary redirect | ||
# to STDERR | ||
open my $orig, ">&", STDOUT; | ||
open STDOUT, ">&STDERR"; | ||
|
||
my $deps = Intrusive->new->dist_dir($path)->find_modules; | ||
|
||
# restore STDOUT | ||
open STDOUT, ">&", $orig; | ||
|
||
my $json = $coder->encode({%$deps}); | ||
print $json; | ||
|
Oops, something went wrong.