[Bps-public-commit] r10788 - in Shipwright/lib/Shipwright: . Backend Source
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Sun Feb 10 08:23:16 EST 2008
Author: sunnavy
Date: Sun Feb 10 08:23:13 2008
New Revision: 10788
Modified:
Shipwright/lib/Shipwright/Backend/SVK.pm
Shipwright/lib/Shipwright/Backend/SVN.pm
Shipwright/lib/Shipwright/Script/Import.pm
Shipwright/lib/Shipwright/Source.pm
Shipwright/lib/Shipwright/Source/Base.pm
Shipwright/lib/Shipwright/Source/CPAN.pm
Shipwright/lib/Shipwright/Source/Compressed.pm
Shipwright/lib/Shipwright/Source/Directory.pm
Shipwright/lib/Shipwright/Source/FTP.pm
Shipwright/lib/Shipwright/Source/HTTP.pm
Shipwright/lib/Shipwright/Source/SVK.pm
Shipwright/lib/Shipwright/Source/SVN.pm
Log:
split non cpan dists from map.yml to source.yml
Modified: Shipwright/lib/Shipwright/Backend/SVK.pm
==============================================================================
--- Shipwright/lib/Shipwright/Backend/SVK.pm (original)
+++ Shipwright/lib/Shipwright/Backend/SVK.pm Sun Feb 10 08:23:13 2008
@@ -56,8 +56,9 @@
File::Spec->catfile( $dir, 'bin', 'shipwright-builder' ) => 'builder',
File::Spec->catfile( $dir, 'bin', 'shipwright-utility' ) => 'utility',
File::Spec->catfile( $dir, 't', 'test' ) => 'null',
- File::Spec->catfile( $dir, 'shipwright', 'order.yml' ) => 'null',
- File::Spec->catfile( $dir, 'shipwright', 'map.yml' ) => 'null',
+ File::Spec->catfile( $dir, 'shipwright', 'order.yml' ) => 'null',
+ File::Spec->catfile( $dir, 'shipwright', 'map.yml' ) => 'null',
+ File::Spec->catfile( $dir, 'shipwright', 'source.yml' ) => 'null',
);
for ( keys %map ) {
@@ -395,8 +396,8 @@
=cut
sub map {
- my $self = shift;
- my $map = shift;
+ my $self = shift;
+ my $map = shift;
if ($map) {
my $dir = tempdir( CLEANUP => 1 );
my $file = File::Spec->catfile( $dir, 'map.yml' );
@@ -417,6 +418,35 @@
}
}
+=head2 source
+
+get or set source
+
+=cut
+
+sub source {
+ my $self = shift;
+ my $source = shift;
+ if ($source) {
+ my $dir = tempdir( CLEANUP => 1 );
+ my $file = File::Spec->catfile( $dir, 'source.yml' );
+
+ $self->checkout(
+ path => '/shipwright/source.yml',
+ target => $file,
+ );
+
+ Shipwright::Util::DumpFile( $file, $source );
+ $self->commit( path => $file, comment => "set source" );
+ $self->checkout( detach => 1, target => $file );
+ }
+ else {
+ my ($out) = Shipwright::Util->run(
+ [ 'svk', 'cat', $self->repository . '/shipwright/source.yml' ] );
+ return Shipwright::Util::Load($out);
+ }
+}
+
=head2 delete
wrapper of delete cmd of svk
Modified: Shipwright/lib/Shipwright/Backend/SVN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Backend/SVN.pm (original)
+++ Shipwright/lib/Shipwright/Backend/SVN.pm Sun Feb 10 08:23:13 2008
@@ -391,8 +391,8 @@
=cut
sub map {
- my $self = shift;
- my $map = shift;
+ my $self = shift;
+ my $map = shift;
if ($map) {
my $dir = tempdir( CLEANUP => 1 );
my $file = File::Spec->catfile( $dir, 'map.yml' );
@@ -413,6 +413,35 @@
}
}
+=head2 source
+
+get or set source
+
+=cut
+
+sub source {
+ my $self = shift;
+ my $source = shift;
+ if ($source) {
+ my $dir = tempdir( CLEANUP => 1 );
+ my $file = File::Spec->catfile( $dir, 'source.yml' );
+
+ $self->checkout(
+ path => '/shipwright',
+ target => $dir,
+ );
+
+ Shipwright::Util::DumpFile( $file, $source );
+ $self->commit( path => $file, comment => "set source" );
+
+ }
+ else {
+ my ($out) = Shipwright::Util->run(
+ [ 'svn', 'cat', $self->repository . '/shipwright/source.yml' ] );
+ return Shipwright::Util::Load($out);
+ }
+}
+
=head2 delete
wrapper of delete cmd of svn
Modified: Shipwright/lib/Shipwright/Script/Import.pm
==============================================================================
--- Shipwright/lib/Shipwright/Script/Import.pm (original)
+++ Shipwright/lib/Shipwright/Script/Import.pm Sun Feb 10 08:23:13 2008
@@ -85,17 +85,14 @@
unless ( $self->overwrite ) {
# skip already imported dists
- $shipwright->source->skip(Hash::Merge::merge( $self->skip,
- $shipwright->backend->map || {} ));
+ $shipwright->source->skip(
+ Hash::Merge::merge( $self->skip, $shipwright->backend->map ||
+ {} ) );
}
Shipwright::Util::DumpFile(
$shipwright->source->map_path,
- Hash::Merge::merge(
- $shipwright->backend->map || {},
- Shipwright::Util::LoadFile( $shipwright->source->map_path )
- || {}
- )
+ $shipwright->backend->map || {},
);
$self->source(
@@ -144,6 +141,12 @@
|| {};
$shipwright->backend->map(
Hash::Merge::merge( $shipwright->backend->map || {}, $new_map ) );
+
+ my $new_url =
+ Shipwright::Util::LoadFile( $shipwright->source->url_path )
+ || {};
+ $shipwright->backend->source(
+ Hash::Merge::merge( $shipwright->backend->source || {}, $new_url ) );
}
# import tests
Modified: Shipwright/lib/Shipwright/Source.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source.pm (original)
+++ Shipwright/lib/Shipwright/Source.pm Sun Feb 10 08:23:13 2008
@@ -18,6 +18,7 @@
$DEFAULT{download_directory} =
File::Spec->catfile( $DEFAULT{directory}, 'download' );
$DEFAULT{map_path} = File::Spec->catfile( $DEFAULT{directory}, 'map.yml' );
+$DEFAULT{url_path} = File::Spec->catfile( $DEFAULT{directory}, 'url.yml' );
=head2 new
Modified: Shipwright/lib/Shipwright/Source/Base.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/Base.pm (original)
+++ Shipwright/lib/Shipwright/Source/Base.pm Sun Feb 10 08:23:13 2008
@@ -13,7 +13,7 @@
use base qw/Class::Accessor::Fast/;
__PACKAGE__->mk_accessors(
qw/source directory download_directory follow min_perl_version map_path
- skip map keep_recommends keep_build_requires name log/
+ skip map keep_recommends keep_build_requires name log url_path/
);
=head2 new
@@ -150,6 +150,7 @@
delete $require->{$module};
}
}
+
for my $type (qw/requires recommends build_requires/) {
for my $module ( keys %{ $require->{$type} } ) {
@@ -173,7 +174,8 @@
my $name = $module;
if ( $self->_is_skipped($module) ) {
- delete $require->{$type}{$module} unless $map->{$module};
+ delete $require->{$type}{$module}
+ unless defined $map->{$module};
}
else {
@@ -214,7 +216,7 @@
$s = Shipwright::Source->new(
%$self,
source => $module,
- name => '', # cpan name is automaticaly fixed.
+ name => '', # cpan name is automaticaly fixed.
);
}
$s->run();
@@ -261,8 +263,19 @@
$map->{$module} = $dist;
Shipwright::Util::DumpFile( $self->map_path, $map );
- warn $self->map_path;
+}
+sub _update_url {
+ my $self = shift;
+ my $name = shift;
+ my $url = shift;
+
+ my $map = {};
+ if ( -e $self->url_path ) {
+ $map = Shipwright::Util::LoadFile( $self->url_path );
+ }
+ $map->{$name} = $url;
+ Shipwright::Util::DumpFile( $self->url_path, $map );
}
sub _is_skipped {
Modified: Shipwright/lib/Shipwright/Source/CPAN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/CPAN.pm (original)
+++ Shipwright/lib/Shipwright/Source/CPAN.pm Sun Feb 10 08:23:13 2008
@@ -26,24 +26,24 @@
my $self = $class->SUPER::new(@_);
CPAN::Config->use;
- mkdir File::Spec->catfile( $cpan_dir, 'CPAN' );
- my $config_file = File::Spec->catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
-
- unless ( -f $config_file ) {
- $CPAN::Config->{cpan_home} = File::Spec->catfile($cpan_dir);
- $CPAN::Config->{build_dir} = File::Spec->catfile( $cpan_dir, 'build' );
- $CPAN::Config->{histfile} =
- File::Spec->catfile( $cpan_dir, 'histfile' );
- $CPAN::Config->{keep_source_where} =
- File::Spec->catfile( $cpan_dir, 'sources' );
- $CPAN::Config->{prefs_dir} = File::Spec->catfile( $cpan_dir, 'prefs' );
- $CPAN::Config->{prerequisites_policy} = 'follow';
- $CPAN::Config->{urllist} ||= [];
- write_file( $config_file,
- Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
-
- }
- require CPAN::MyConfig;
+# mkdir File::Spec->catfile( $cpan_dir, 'CPAN' );
+# my $config_file = File::Spec->catfile( $cpan_dir, 'CPAN', 'MyConfig.pm' );
+#
+# unless ( -f $config_file ) {
+# $CPAN::Config->{cpan_home} = File::Spec->catfile($cpan_dir);
+# $CPAN::Config->{build_dir} = File::Spec->catfile( $cpan_dir, 'build' );
+# $CPAN::Config->{histfile} =
+# File::Spec->catfile( $cpan_dir, 'histfile' );
+# $CPAN::Config->{keep_source_where} =
+# File::Spec->catfile( $cpan_dir, 'sources' );
+# $CPAN::Config->{prefs_dir} = File::Spec->catfile( $cpan_dir, 'prefs' );
+# $CPAN::Config->{prerequisites_policy} = 'follow';
+# $CPAN::Config->{urllist} ||= [];
+# write_file( $config_file,
+# Data::Dumper->Dump( [$CPAN::Config], ['$CPAN::Config'] ) );
+#
+# }
+# require CPAN::MyConfig;
return $self;
}
@@ -56,7 +56,7 @@
$self->log->info( "prepare to run source: " . $self->source );
if ( $self->_run ) {
my $compressed =
- Shipwright::Source::Compressed->new( %$self, _no_map => 1 );
+ Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 );
$compressed->run(@_);
}
}
Modified: Shipwright/lib/Shipwright/Source/Compressed.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/Compressed.pm (original)
+++ Shipwright/lib/Shipwright/Source/Compressed.pm Sun Feb 10 08:23:13 2008
@@ -17,7 +17,8 @@
$self->name( $self->just_name( $self->path ) ) unless $self->name;
$self->log->info( 'run source ' . $self->name . ': ' . $self->source );
- $self->_make_maps( $self->name, $self->source ) unless $self->{_no_map};
+ $self->_update_url( $self->name, $self->source )
+ unless $self->{_no_update_url};
my $ret = $self->SUPER::run(@_);
$self->_follow( File::Spec->catfile( $self->directory, $self->name ) )
Modified: Shipwright/lib/Shipwright/Source/Directory.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/Directory.pm (original)
+++ Shipwright/lib/Shipwright/Source/Directory.pm Sun Feb 10 08:23:13 2008
@@ -29,8 +29,8 @@
$self->log->info(
'run source ' . ( $self->name || $self->path ) . ': ' . $self->source );
- $self->_make_maps( $self->name || $self->just_name( $self->path ),
- $self->source ) unless $self->{_no_map};
+ $self->_update_url( $self->name || $self->just_name( $self->path ),
+ $self->source ) unless $self->{_no_update_url};
$self->SUPER::run(@_);
$self->_follow(
Modified: Shipwright/lib/Shipwright/Source/FTP.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/FTP.pm (original)
+++ Shipwright/lib/Shipwright/Source/FTP.pm Sun Feb 10 08:23:13 2008
@@ -17,7 +17,7 @@
$self->log->info( "prepare to run source: " . $self->source );
$self->SUPER::run();
my $compressed =
- Shipwright::Source::Compressed->new( %$self, _no_map => 1 );
+ Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 );
$compressed->run();
}
@@ -31,7 +31,7 @@
my $file;
if ( $source =~ m{.*/(.+\.(tar\.gz|tgz|tar\.bz2))$} ) {
$file = $1;
- $self->_make_maps( $self->just_name( $file ), $source );
+ $self->_update_url( $self->just_name( $file ), $source );
my $src_dir = $self->download_directory;
mkdir $src_dir unless -e $src_dir;
$self->source( File::Spec->catfile( $src_dir, $file ) );
Modified: Shipwright/lib/Shipwright/Source/HTTP.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/HTTP.pm (original)
+++ Shipwright/lib/Shipwright/Source/HTTP.pm Sun Feb 10 08:23:13 2008
@@ -19,7 +19,7 @@
$self->SUPER::run();
my $compressed =
- Shipwright::Source::Compressed->new( %$self, _no_map => 1 );
+ Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 );
$compressed->run();
}
@@ -33,7 +33,7 @@
my $file;
if ( $source =~ m{.*/(.+\.(tar\.gz|tgz|tar\.bz2))$} ) {
$file = $1;
- $self->_make_maps( $self->just_name( $file ), $source );
+ $self->update_url( $self->just_name( $file ), $source );
my $src_dir = $self->download_directory;
mkdir $src_dir unless -e $src_dir;
Modified: Shipwright/lib/Shipwright/Source/SVK.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/SVK.pm (original)
+++ Shipwright/lib/Shipwright/Source/SVK.pm Sun Feb 10 08:23:13 2008
@@ -16,7 +16,7 @@
my $self = $class->SUPER::new(@_);
$self->name( $self->just_name( $self->source ) ) unless $self->name;
- $self->_make_maps( $self->name, $self->source );
+ $self->_update_url( $self->name, $self->source );
my $s = $self->source;
$s =~ s!^\s*svk:!!;
@@ -35,11 +35,11 @@
my $s;
if ( $self->_is_compressed ) {
require Shipwright::Source::Compressed;
- $s = Shipwright::Source::Compressed->new( %$self, _no_map => 1 );
+ $s = Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 );
}
else {
require Shipwright::Source::Directory;
- $s = Shipwright::Source::Directory->new( %$self, _no_map => 1 );
+ $s = Shipwright::Source::Directory->new( %$self, _no_update_url => 1 );
}
$s->run(@_);
}
Modified: Shipwright/lib/Shipwright/Source/SVN.pm
==============================================================================
--- Shipwright/lib/Shipwright/Source/SVN.pm (original)
+++ Shipwright/lib/Shipwright/Source/SVN.pm Sun Feb 10 08:23:13 2008
@@ -16,7 +16,7 @@
my $self = $class->SUPER::new(@_);
$self->name( $self->just_name( $self->source ) ) unless $self->name;
- $self->_make_maps( $self->name, $self->source );
+ $self->_update_url( $self->name, $self->source );
my $s = $self->source;
$s =~ s!^\s*svn:!!;
@@ -36,11 +36,11 @@
my $s;
if ( $self->_is_compressed ) {
require Shipwright::Source::Compressed;
- $s = Shipwright::Source::Compressed->new( %$self, _no_map => 1 );
+ $s = Shipwright::Source::Compressed->new( %$self, _no_update_url => 1 );
}
else {
require Shipwright::Source::Directory;
- $s = Shipwright::Source::Directory->new( %$self, _no_map => 1 );
+ $s = Shipwright::Source::Directory->new( %$self, _no_update_url => 1 );
}
$s->run(@_);
}
More information about the Bps-public-commit
mailing list