Re: [Module::Build] Archive::Tar file format
Status: Beta
Brought to you by:
kwilliams
|
From: Randy K. <ra...@th...> - 2004-01-12 23:15:11
|
On Mon, 12 Jan 2004, Glenn Linderman wrote:
> On approximately 1/12/2004 1:20 PM, came the following characters from
> the keyboard of Randy Kobes:
[ .. ]
> > I think the problem here is that the 'dist' build target
> > makes an archive suitable for CPAN, whereas the archive
> > that ppm expects (as specified by the codebase) is just
> > an archive of the blib/ directory. Try
> > perl build ppd
> > tar cvf GFfP-0.1.tar blib
> > gzip --best GFfP-0.1.tar
> > ppm install GFfP.ppd
>
> Hmm. I don't know enough about CPAN or PPM to verify or contradict this
> speculation.
>
> I started using Module::Build because it seemed like it was supposed to
> be an easier way to build packages that MakeMaker. If what you say
> above is, indeed, correct and turns out to be "the problem", then it
> would seems that either Module::Build needs an additional target to
> build distributions for PPM, or else I missed understanding which target
> I should use when I read the Module::Build documentation.
>
> If a different .tar.gz file is the problem, I'd think it
> should be bundled into the perl build ppd command, such
> that that command builds the two files necessary to use
> with PPM. I don't have a solution or recommendation for
> the naming conflict that results from having two different
> .tar.gz files for two different purposes for the same
> module for CPAN vs PPM. Maybe the substrings "-CPAN" and
> "-PPM" should be added into the .tar.gz file name
> somewhere.
You're right that the ppd target would need to be changed
in order to build the archive that ppm expects - something
like the following:
=========================================================
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 12 Jan 2004 22:56:57 -0000
@@ -1,6 +1,8 @@
package Module::Build::PPMMaker;
use strict;
+use File::Find;
+use Archive::Tar;
# This code is mostly borrowed from ExtUtils::MM_Unix 6.10_03, with a
# few tweaks based on the PPD spec at
@@ -24,9 +26,10 @@
my $distfile = $build->dist_dir . ".tar.gz";
print "Using default codebase '$distfile'\n";
@codebase = ($distfile);
- }
+ $self->make_archive($distfile);
+ }
- my %dist;
+ my %dist;
foreach my $info (qw(name author abstract version)) {
my $method = "dist_$info";
$dist{$info} = $build->$method() or die "Can't determine distribution's $info\n";
@@ -121,6 +124,16 @@
# generates something like "0,18,0,0"
return join ',', (split(/\./, $version), (0)x4)[0..3];
+}
+
+sub make_archive {
+ my ($self, $distfile) = @_;
+ my @f;
+ my $arc = Archive::Tar->new();
+ finddepth(sub { push @f, $File::Find::name;
+ print $File::Find::name,"\n"}, 'blib');
+ $arc->add_files(@f);
+ $arc->write($distfile, 1);
}
sub _varchname { # Copied from PPM.pm
==================================================================
would work, minimally. Then
perl build ppd
ppm install Module-Name.ppd
would be enough to install the package via ppm.
> The command sequence you offered above does, in fact,
> work. But I don't know enough to know if it is because I
> am using a different version of TAR (not Archive::Tar), or
> because there are fewer files in the archive,
> either or both of which may have made PPM happier.
The question of using A::T I think is separate ... Making
an archive for installing a ppm package on the same machine
should work with any version of A::T - where issues with
A::T come in is in making an archive for use on a different
platform (specifically, Win32).
The two archives serve different purposes - the one
currently made with the 'dist' target (composed of the files
in MANIFEST) are for making a CPAN compatible distribution,
whereas the one consisting just of the blib/ directory is
for a binary ppm distribution. In a loose sense the two are
orthogonal - the CPAN archive contains all files except
those in blib/, and the ppm archive contains only the blib/
files.
--
best regards,
randy
|