smokeinabox
view release on metacpan or search on metacpan
tools/update-bundle.pl view on Meta::CPAN
use strict;
use Cwd;
use File::Path qw[mkpath];
use CPANPLUS::Backend;
$|++;
my $Prefix = '../'; # updir from cpanplus/devel
my $Libdir = 'lib/';
my $Cwd = cwd();
my $Target = $Cwd . '/cpansmokebox/inc/bundle'; # Target dir to copy to
my $MineOnly = @ARGV ? 1 : 0;
my $Conf = CPANPLUS::Configure->new();
$Conf->set_conf( enable_custom_sources => 0 );
$Conf->set_conf( verbose => 1 );
$Conf->set_conf( hosts => [ { scheme => 'ftp', host => 'localhost', path => '/CPAN/' } ] );
$Conf->set_conf( no_update => 1 );
$Conf->set_conf( source_engine => 'CPANPLUS::Internals::Source::CPANIDX' );
my $CB = CPANPLUS::Backend->new( $Conf );
### from p4
{ my @Copy = qw[
];
for my $entry (@Copy) {
my $dir = $Prefix . $entry . $Libdir;
print "Copying files from $entry...";
system("cp -R $dir $Target");
print "done\n";
}
}
### from installations
unless( $MineOnly ) {
my @Modules = qw[
Archive::Extract
Archive::Tar
File::Fetch
IPC::Cmd
Log::Message
Log::Message::Simple
Module::Load
Module::Loaded
Module::Load::Conditional
Object::Accessor
Package::Constants
Params::Check
Term::UI
File::Spec
IO::String
IO::Zlib
Locale::Maketext::Simple
Module::CoreList
Module::Pluggable
version
Parse::CPAN::Meta
Config::IniFiles
Sort::Versions
Regexp::Assemble
Test::Reporter
CPANPLUS::YACSmoke
];
# IPC::Run no more!
UPDATE: for my $module ( @Modules ) {
my $obj = $CB->module_tree( $module );
### do an uptodate check
{ local @INC = ( $Target );
print "Updating $module..." .
"[HAVE: " . $obj->installed_version .'] ' .
"[CPAN: " . $obj->version .'] ';
if( $obj->is_uptodate ) {
print "already uptodate\n";
next UPDATE;
}
}
$obj->fetch( fetchdir => '/tmp' ) or die "Could not fetch";
my $dir = $obj->extract( extractdir => '/tmp' )
or die "Could not extract";
### either they have the lib structure
if( -d $dir . "/lib" ) {
chdir $dir . "/lib" or die "Could not chdir: $!";
system("cp -R . $Target") and die "Could not copy files";
### XXX special case -- version.pm has Special Dirs :(
### need the 'vperl/vpp.pm' file too
if( $module eq 'version' ) {
system("cp ../vperl/vpp.pm $Target/version/")
and die "Could not copy special files for $module";
}
print "done\n";
( run in 0.794 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )