-
Notifications
You must be signed in to change notification settings - Fork 0
/
genscript.pl
144 lines (102 loc) · 3.37 KB
/
genscript.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/usr/bin/perl
use strict;
use warnings;
use File::Spec;
use Capture::Tiny qw(capture_merged);
use Config;
use Cwd;
use Getopt::Long;
my $recent;
my $reverse;
my $path;
GetOptions('recent' => \$recent, 'reverse' => \$reverse, 'path=s', \$path);
die "No path option specified\n" unless $path and -d $path;
open my $script, '>', 'smokeall.sh' or die "$!\n";
print $script '#!/bin/sh', "\n";
my @authors = (
'^A[N-Z]',
'^B[A-M]',
'^B[N-Z]',
'^C',
'^D[A-M]',
'^D[N-Z]',
'^[EF]',
'^G',
'^[HI]',
'^J[A-M]',
'^J[N-Z]',
'^K',
'^L',
'^M[A-M]',
'^M[N-Z]',
'^[NO]',
'^[PQ]',
'^R[A-M]',
'^R[N-Z]',
'^S[A-M]',
'^S[N-Z]',
'^T',
'^[UVWXY]',
'^Z',
);
my $minismokebox = File::Spec->catfile($Config::Config{installsitescript},'minismokebox');
die "No 'minismokebox' found\n" unless $minismokebox;
my $perl = File::Spec->catfile($path,'bin','perl');
my $yactool = File::Spec->catfile($path,'bin','yactool');
unless ( -e $perl ) {
# hmmm no perl there. Let's see if it is a dev release
my @possibles = glob("${perl}5*");
die "No perl executable found at '$path'\n" unless @possibles;
$perl = shift @possibles;
}
my $output = capture_merged { system($perl,'-e','printf "%vd", $^V;'); };
chomp $output;
my $cpanp = File::Spec->catfile($path,'bin', 'cpanp' . ( $perl =~ /\Q$output\E$/ ? $output : '' ) );
print $script qq{$minismokebox --perl $perl\n} if $recent;
foreach my $author ( @authors ) {
#print $script qq{perl -MFile::Path -e 'rmtree shift;' $conf\n};
print $script qq{$yactool --flush\n};
print $script qq{$cpanp -x --update_source\n};
print $script qq{$minismokebox --perl $perl --author '$author'\n};
}
print $script qq{perl -MFile::Path -e 'rmtree shift;' $conf\n};
close $script;
chmod 0755, 'smokeall.sh' or die "$!\n";
exit 0;
__END__
=head1 NAME
genscript.pl - Generate a shell script to smoke all of CPAN
=head1 SYNOPSIS
perl genscript.pl --path /path/to/perl/installation
=head1 DESCRIPTION
genscript.pl is a perl script that will generate a shell script that
can be used to smoke test all of CPAN using L<minismokebox>
=head1 CONFIGURATION
The script will locate the L<minismokebox> that is associated with the C<perl>
that was used to execute the script and use that in the generated script.
The value of the C<%ENV> variable C<PERL5_YACSMOKE_BASE> is used to find the
location of the C<.cpanplus> folder which requires cleaning up.
The C<--path> command-line switch is used to find the C<perl> executable to
use to do the smoke testing with.
Example: perl-5.10.1 has been built and installed with Dprefix=/home/cpan/perl-5.10.1
perl genscript.pl --path /home/cpan/perl-5.10.1
=head1 SWITCHES
=over
=item C<--path>
The path to the C<perl> installation to smoke test with. Usually what was passed to
C<Configure> at build time with C<Dprefix>.
=item C<--recent>
Indicate whether you want to smoke test recent uploads to CPAN before smoke testing all
of CPAN.
=item OUTPUT
The script generates a shell script in the current working directory called C<smokeall.sh>
This can be simply invoked
./smokeall.sh
to start the (lengthy) CPAN smoke process. >:)
=back
=head1 AUTHOR
Chris C<BinGOs> Williams <chris@bingosnet.co.uk>
=head1 LICENSE
Copyright E<copy> Chris Williams
This module may be used, modified, and distributed under the same terms as Perl itself. Please see the license that came with your Perl distribution for details.
=cut