[Bps-public-commit] Shipwright branch, master, updated. 7c6426ff4cee8c48afe5029e0e3df4f67ad42e05

? sunnavy sunnavy at bestpractical.com
Sun Jun 5 07:09:09 EDT 2011


The branch, master has been updated
       via  7c6426ff4cee8c48afe5029e0e3df4f67ad42e05 (commit)
       via  0396d213cbec2b6b4d83b7c1fb78f1d4ae198e0c (commit)
       via  f334ee1ce7e470e9d7f93db1824b4b56c7761c90 (commit)
       via  d9fdf270fe6e7b3762895d8622caabeffab72cb8 (commit)
      from  fafbd460ae9cd72df0ad5491787b86c2c89c99f2 (commit)

Summary of changes:
 lib/Shipwright/Script/Import.pm |   74 +++++++++++++++++++++------------------
 lib/Shipwright/Source.pm        |   13 ++++---
 lib/Shipwright/Source/Base.pm   |   13 ++++++-
 3 files changed, 60 insertions(+), 40 deletions(-)

- Log -----------------------------------------------------------------
commit d9fdf270fe6e7b3762895d8622caabeffab72cb8
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Jun 5 18:08:51 2011 +0800

    skip build_requires option

diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index 4631da6..50eb7a4 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -8,7 +8,7 @@ __PACKAGE__->mk_accessors(
     qw/comment no_follow build_script require_yml include_dual_lifed
       name test_script extra_tests overwrite min_perl_version skip version as
       skip_recommends skip_all_test_requires skip_all_recommends skip_installed
-      no_default_build
+      no_default_build skip_all_build_requires
       /
 );
 
@@ -22,24 +22,25 @@ use List::MoreUtils qw/firstidx/;
 
 sub options {
     (
-        'm|comment=s'            => 'comment',
-        'name=s'                 => 'name',
-        'no-follow'              => 'no_follow',
-        'build-script=s'         => 'build_script',
-        'require-yml=s'          => 'require_yml',
-        'test-script'            => 'test_script',
-        'extra-tests'            => 'extra_tests',
-        'overwrite'              => 'overwrite',
-        'min-perl-version=s'     => 'min_perl_version',
-        'skip=s'                 => 'skip',
-        'version=s'              => 'version',
-        'as=s'                   => 'as',
-        'skip-recommends=s'      => 'skip_recommends',
-        'skip-all-recommends'    => 'skip_all_recommends',
-        'skip-all-test-requires' => 'skip_all_test_requires',
-        'skip-installed'         => 'skip_installed',
-        'include-dual-lifed'     => 'include_dual_lifed',
-        'no-default-build'       => 'no_default_build',
+        'm|comment=s'             => 'comment',
+        'name=s'                  => 'name',
+        'no-follow'               => 'no_follow',
+        'build-script=s'          => 'build_script',
+        'require-yml=s'           => 'require_yml',
+        'test-script'             => 'test_script',
+        'extra-tests'             => 'extra_tests',
+        'overwrite'               => 'overwrite',
+        'min-perl-version=s'      => 'min_perl_version',
+        'skip=s'                  => 'skip',
+        'version=s'               => 'version',
+        'as=s'                    => 'as',
+        'skip-recommends=s'       => 'skip_recommends',
+        'skip-all-recommends'     => 'skip_all_recommends',
+        'skip-all-test-requires'  => 'skip_all_test_requires',
+        'skip-all-build-requires' => 'skip_all_build_requires',
+        'skip-installed'          => 'skip_installed',
+        'include-dual-lifed'      => 'include_dual_lifed',
+        'no-default-build'        => 'no_default_build',
     );
 }
 
@@ -126,19 +127,20 @@ sub run {
 
         for my $source (@sources) {
             my $shipwright = Shipwright->new(
-                repository             => $self->repository,
-                source                 => $source,
-                name                   => $self->name,
-                follow                 => !$self->no_follow,
-                min_perl_version       => $self->min_perl_version,
-                include_dual_lifed     => $self->include_dual_lifed,
-                skip                   => $self->skip,
-                version                => $self->version,
-                installed              => $installed,
-                skip_recommends        => $self->skip_recommends,
-                skip_all_recommends    => $self->skip_all_recommends,
-                skip_all_test_requires => $self->skip_all_test_requires,
-                skip_installed         => $self->skip_installed,
+                repository              => $self->repository,
+                source                  => $source,
+                name                    => $self->name,
+                follow                  => !$self->no_follow,
+                min_perl_version        => $self->min_perl_version,
+                include_dual_lifed      => $self->include_dual_lifed,
+                skip                    => $self->skip,
+                version                 => $self->version,
+                installed               => $installed,
+                skip_recommends         => $self->skip_recommends,
+                skip_all_recommends     => $self->skip_all_recommends,
+                skip_all_test_requires  => $self->skip_all_test_requires,
+                skip_all_build_requires => $self->skip_all_build_requires,
+                skip_installed          => $self->skip_installed,
             );
 
             confess_or_die "cpan dists can't be branched"
@@ -221,7 +223,7 @@ sub run {
               load_yaml_file( $shipwright->source->branches_path );
             $branches ||= {} if
 
-            $self->log->fatal( "importing $name" );
+            $self->log->fatal( "import $name" );
             $shipwright->backend->import(
                 source  => $source,
                 comment => $self->comment || 'import ' . $source,
@@ -285,6 +287,9 @@ sub _import_req {
     my $shipwright = shift;
     my $script_dir = shift;
 
+    my $name = (splitdir( $source ))[-1];
+    $self->log->fatal( "import requirements for $name" );
+
     my $require_file = catfile( $source, '__require.yml' );
     $require_file = catfile( $script_dir, 'require.yml' )
       unless -e catfile( $source, '__require.yml' );
@@ -321,7 +326,7 @@ sub _import_req {
                         next;
                     }
 
-                    $self->log->fatal( "importing $name" );
+                    $self->log->fatal( "import $name" );
                     my $s = catdir( $dir, $name );
 
                     my $script_dir;
@@ -485,6 +490,7 @@ Shipwright::Script::Import - Import sources and their dependencies
                                   not to import
  --skip-all-recommends          : skip all the recommends to import
  --skip-all-test-requires       : skip all the test requires to import
+ --skip-all-build-requires      : skip all the build requires to import
  --skip-installed               : skip all the installed modules to import
  --include-dual-lifed           : include modules which live both in the perl core 
                                   and on CPAN
diff --git a/lib/Shipwright/Source/Base.pm b/lib/Shipwright/Source/Base.pm
index 7b87633..f2611c4 100644
--- a/lib/Shipwright/Source/Base.pm
+++ b/lib/Shipwright/Source/Base.pm
@@ -17,7 +17,7 @@ __PACKAGE__->mk_accessors(
       min_perl_version map_path skip map skip_recommends skip_all_recommends
       skip_installed include_dual_lifed
       keep_build_requires name log url_path version_path branches_path version
-      skip_all_test_requires installed
+      skip_all_test_requires skip_all_build_requires installed
       /
 );
 
@@ -96,6 +96,7 @@ sub _follow {
       || $self->skip_all_recommends;
     push @types, 'recommends' unless $skip_recommends;
     push @types, 'test_requires' unless $self->skip_all_test_requires;
+    push @types, 'build_requires' unless $self->skip_all_build_requires;
 
     if ( !-e $require_path ) {
 
@@ -577,6 +578,7 @@ EOF
         # them when update later
         $require->{recommends} = {} if $skip_recommends;
         $require->{test_requires} = {} if $self->skip_all_test_requires;
+        $require->{build_requires} = {} if $self->skip_all_build_requires;
 
         dump_yaml_file( $require_path, $require );
     }

commit f334ee1ce7e470e9d7f93db1824b4b56c7761c90
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Jun 5 18:20:19 2011 +0800

    return Compressed or Directory if the file/dir exists

diff --git a/lib/Shipwright/Source.pm b/lib/Shipwright/Source.pm
index fa9711a..191cfb8 100644
--- a/lib/Shipwright/Source.pm
+++ b/lib/Shipwright/Source.pm
@@ -79,13 +79,14 @@ sub type {
 
     _translate_source($source);
 
-    # prefix that can't be omitted
-    if ( $$source =~ /^file:.*\.(?:tar\.(?:gz|bz2)|tgz|tbz|zip)$/ ) {
-        $$source =~ s/^file://i;
-        return 'Compressed';
+    if ( $$source =~ /\.(?:tar\.(?:gz|bz2)|tgz|tbz|zip)$/ ) {
+        if ( $$source =~ s/^file://i || -f $$source ) {
+            return 'Compressed';
+        }
     }
 
-    return 'Directory'  if $$source =~ s/^dir(?:ectory)?://i;
+    return 'Directory' if $$source =~ s/^dir(?:ectory)?://i;
+
     return 'Shipyard' if $$source =~ s/^(?:shipyard|shipwright)://i;
 
     # prefix that can be omitted
@@ -101,6 +102,8 @@ sub type {
         return 'SVK';
     }
 
+    return 'Directory' if -d $$source;
+
     # default is cpan module or distribution
     $$source =~ s!^cpan:!!i;
 

commit 0396d213cbec2b6b4d83b7c1fb78f1d4ae198e0c
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Jun 5 18:38:51 2011 +0800

    enable skip Foo:: to skip both Foo and Foo::*

diff --git a/lib/Shipwright/Source/Base.pm b/lib/Shipwright/Source/Base.pm
index f2611c4..07407f7 100644
--- a/lib/Shipwright/Source/Base.pm
+++ b/lib/Shipwright/Source/Base.pm
@@ -664,6 +664,15 @@ sub _is_skipped {
               if $self->skip->{$name} || $self->skip->{$name_without_prefix};
         }
 
+        my @spaces = grep { /::$/ } keys %{$self->skip};
+        for my $space ( @spaces ) {
+            # we want to skip both Foo and Foo::*
+            if ( "${module}::" =~ /^$space/ ) {
+                $skip = 1;
+                last;
+            }
+        }
+
         if ($skip) {
             $self->log->info("$module is skipped");
             return 1;

commit 7c6426ff4cee8c48afe5029e0e3df4f67ad42e05
Author: sunnavy <sunnavy at bestpractical.com>
Date:   Sun Jun 5 18:42:06 2011 +0800

    lower log level of import requirements, as it is not that important to show user

diff --git a/lib/Shipwright/Script/Import.pm b/lib/Shipwright/Script/Import.pm
index 50eb7a4..5c5be3b 100644
--- a/lib/Shipwright/Script/Import.pm
+++ b/lib/Shipwright/Script/Import.pm
@@ -288,7 +288,7 @@ sub _import_req {
     my $script_dir = shift;
 
     my $name = (splitdir( $source ))[-1];
-    $self->log->fatal( "import requirements for $name" );
+    $self->log->info( "import requirements for $name" );
 
     my $require_file = catfile( $source, '__require.yml' );
     $require_file = catfile( $script_dir, 'require.yml' )

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list