You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/07/11 21:04:01 UTC

[3/8] git commit: Add a `dist` action for CPAN to CFC Perl build.

Add a `dist` action for CPAN to CFC Perl build.


Project: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/commit/13ac440e
Tree: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/tree/13ac440e
Diff: http://git-wip-us.apache.org/repos/asf/lucy-clownfish/diff/13ac440e

Branch: refs/heads/master
Commit: 13ac440ee830051e073ed80faa322f55edf9604a
Parents: 22d5b79
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Mon Jul 7 12:44:52 2014 -0700
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Wed Jul 9 22:15:15 2014 -0700

----------------------------------------------------------------------
 compiler/perl/buildlib/Clownfish/CFC/Build.pm | 34 ++++++++++++++++++++++
 1 file changed, 34 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/13ac440e/compiler/perl/buildlib/Clownfish/CFC/Build.pm
----------------------------------------------------------------------
diff --git a/compiler/perl/buildlib/Clownfish/CFC/Build.pm b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
index 8de7c9c..0eeb1db 100644
--- a/compiler/perl/buildlib/Clownfish/CFC/Build.pm
+++ b/compiler/perl/buildlib/Clownfish/CFC/Build.pm
@@ -25,6 +25,8 @@ use base qw( Clownfish::CFC::Perl::Build::Charmonic );
 no lib 'lib';
 
 use File::Spec::Functions qw( catfile updir catdir curdir );
+use File::Copy qw( move );
+use File::Path qw( rmtree );
 use Config;
 use Cwd qw( getcwd );
 use Carp;
@@ -167,5 +169,37 @@ sub ACTION_code {
     $self->SUPER::ACTION_code;
 }
 
+sub ACTION_dist {
+    my $self = shift;
+
+    # We build our Perl release tarball from a subdirectory rather than from
+    # the top-level $REPOS_ROOT.  Because some assets we need are outside this
+    # directory, we need to copy them in.
+    my %to_copy = (
+        '../../CONTRIBUTING' => 'CONTRIBUTING',
+        '../../LICENSE'      => 'LICENSE',
+        '../../NOTICE'       => 'NOTICE',
+        '../../README'       => 'README',
+        '../../lemon'        => 'lemon',
+        '../src'             => 'src',
+        '../include'         => 'include',
+        $CHARMONIZER_C       => 'charmonizer.c',
+    );
+    print "Copying files...\n";
+    while (my ($from, $to) = each %to_copy) {
+        confess("'$to' already exists") if -e $to;
+        system("cp -R $from $to") and confess("cp failed");
+    }
+    move( "MANIFEST", "MANIFEST.bak" ) or die "move() failed: $!";
+    $self->depends_on("manifest");
+    $self->SUPER::ACTION_dist;
+
+    # Now that the tarball is packaged up, delete the copied assets.
+    rmtree($_) for values %to_copy;
+    unlink("META.yml");
+    unlink("META.json");
+    move( "MANIFEST.bak", "MANIFEST" ) or die "move() failed: $!";
+}
+
 1;