Re: [Module::Build] [PATCH] ppm_dist action
Status: Beta
Brought to you by:
kwilliams
|
From: Ken W. <ke...@ma...> - 2004-01-15 04:18:22
|
Here's the patch I'm applying, based on Randy Sims' - let me know if it
needs modification.
-Ken
Index: lib/Module/Build/Base.pm
===================================================================
RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v
retrieving revision 1.239
diff -u -r1.239 Base.pm
--- lib/Module/Build/Base.pm 15 Jan 2004 02:48:43 -0000 1.239
+++ lib/Module/Build/Base.pm 15 Jan 2004 04:16:35 -0000
@@ -1475,6 +1475,14 @@
$self->add_to_cleanup($file);
}
+sub ACTION_ppm_dist {
+ my ($self) = @_;
+
+ $self->depends_on('build', 'ppd');
+ $self->add_to_cleanup($self->ppm_name);
+ $self->make_tarball($self->{properties}{blib}, $self->ppm_name);
+}
+
sub ACTION_dist {
my ($self) = @_;
@@ -1616,6 +1624,11 @@
return
"$self->{properties}{dist_name}-$self->{properties}{dist_version}";
}
+sub ppm_name {
+ my $self = shift;
+ return 'PPM-' . $self->dist_dir;
+}
+
sub script_files {
my $self = shift;
if (@_) {
@@ -1743,18 +1756,22 @@
}
sub make_tarball {
- my ($self, $dir) = @_;
-
- print "Creating $dir.tar.gz\n";
+ my ($self, $dir, $file) = @_;
+ $file ||= $dir;
+
+ print "Creating $file.tar.gz\n";
if ($self->{args}{tar}) {
my $tar_flags = $self->{properties}{verbose} ? 'cvf' : 'cf';
- $self->do_system($self->{args}{tar}, $tar_flags, "$dir.tar", $dir);
- $self->do_system($self->{args}{gzip}, "$dir.tar") if
$self->{args}{gzip};
+ $self->do_system($self->{args}{tar}, $tar_flags, "$file.tar",
$dir);
+ $self->do_system($self->{args}{gzip}, "$file.tar") if
$self->{args}{gzip};
} else {
require Archive::Tar;
+ # Archive::Tar versions >= 1.09 use the following to enable a
compatibility
+ # hack so that the resulting archive is compatible with older
clients.
+ $Archive::Tar::DO_NOT_USE_PREFIX = 0;
my $files = $self->rscan_dir($dir);
- Archive::Tar->create_archive("$dir.tar.gz", 1, @$files);
+ Archive::Tar->create_archive("$file.tar.gz", 1, @$files);
}
}
Index: lib/Module/Build/PPMMaker.pm
===================================================================
RCS file:
/cvsroot/module-build/Module-Build/lib/Module/Build/PPMMaker.pm,v
retrieving revision 1.6
diff -u -r1.6 PPMMaker.pm
--- lib/Module/Build/PPMMaker.pm 9 Jan 2004 17:06:21 -0000 1.6
+++ lib/Module/Build/PPMMaker.pm 15 Jan 2004 04:16:36 -0000
@@ -21,7 +21,7 @@
if (exists $args{codebase}) {
@codebase = ref $args{codebase} ? @{$args{codebase}} :
($args{codebase});
} else {
- my $distfile = $build->dist_dir . ".tar.gz";
+ my $distfile = $build->ppm_name . '.tar.gz';
print "Using default codebase '$distfile'\n";
@codebase = ($distfile);
}
|