Re: [Module::Build] Archive::Tar file format
Status: Beta
Brought to you by:
kwilliams
|
From: Glenn L. <pe...@ne...> - 2004-01-13 00:09:02
|
On approximately 1/12/2004 3:12 PM, came the following characters from
the keyboard of Randy Kobes:
> 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).
Well my first problem is that I can't use M::B to build a package that
will install on the same machine it is built on! I had a number of
symptoms, most of which are now resolved, and at least one of which came
from the use of A::T, but yet unresolved is major issue of being able to
install via PPM using what M::B builds.
> 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.
Seems like the archive made with M::B dist target does contain blib
contents. Now maybe that is because I stuck lots of bad things in my
MANIFEST (which I just whacked at until it worked, except something
still doesn't)...
MANIFEST This list of files
META.yml no clue, but Module::Build wants it
build.pl Module::Build facility
blib/lib/GFfP.pm The main module (but no brains)
blib/arch/auto/GFfP/GFfP.bs no clue
blib/arch/auto/GFfP/GFfP.dll The brains for the module
blib/arch/auto/GFfP/GFfP.exp related to the .dll somehow
blib/arch/auto/GFfP/GFfP.lib related to the .dll somehow
With this MANIFEST, I get errors when I first run M::B (or after a
realclean), saying that the stuff that isn't built yet, isn't there, so
therefore the package isn't complete. That bothers me somewhat, and
maybe the reason is because of what you are saying about the difference
between the archives. But including these files in MANIFEST seemed to
be the only way to get them in the archive! And the M::B people have
seen my MANIFEST in my test case before.
I also wasn't particularly thrilled with moving my "source" GFfP.pm into
blib/lib, as I think it would be too easy to want to delete blib
directory... I'd have expected a structure where the .pm file was in the
root directory, and then got copied into blib/lib during the build process.
Pardon all my ignorances, but this is my first "written from scratch"
module, and although I've read a bunch of docs, most of this doesn't
seem to be particularly well documented unless it is already understood.
Or else I've missed where MANIFEST contents are documented. I have to
confess to not reading any MakeMaker documentation, since I chose to try
out M::B instead. But a MakeMaker module I've worked on some clearly
keeps its source .pm files in the root of the file structure... and has
no blib references in its MANIFEST. So that's why I was surprised,
probably.
--
Glenn -- http://nevcal.com/
===========================
The best part about procrastination is that you are never bored,
because you have all kinds of things that you should be doing.
|