Thread: [Module-build-general] PATCH: added ACTION_versioninstall
Status: Beta
Brought to you by:
kwilliams
|
From: Brian I. <in...@tt...> - 2003-02-20 01:24:40
|
Here's a patch to make:
./Build versioninstall work.
Cheers, Brian
diff -ru Module-Build-0.15-orig/lib/Module/Build/Base.pm Module-Build-0.15/lib/Module/Build/Base.pm
--- Module-Build-0.15-orig/lib/Module/Build/Base.pm Fri Jan 17 12:53:11 2003
+++ Module-Build-0.15/lib/Module/Build/Base.pm Wed Feb 19 17:01:52 2003
@@ -761,6 +761,28 @@
ExtUtils::Install::install($self->install_map('blib'), 1, 1);
}
+sub ACTION_versioninstall {
+ my ($self) = @_;
+ eval { require only };
+ die "You must have only.pm installed for this operation\n"
+ if $@;
+
+ if (defined $self->{args}{versionlib}) {
+ require Config;
+ $only::config::versionlib = $self->{args}{versionlib};
+ $only::config::versionarch =
+ File::Spec->catdir($self->{args}{versionlib},
+ $Config::Config{archname});
+ }
+ my @args = ();
+ if (defined $self->{args}{version}) {
+ push @args, $self->{args}{version};
+ }
+ $self->depends_on('build');
+ local @ARGV = @args;
+ only::install();
+}
+
sub ACTION_clean {
my ($self) = @_;
foreach my $item (keys %{$self->{cleanup}}) {
diff -ru Module-Build-0.15-orig/lib/Module/Build.pm Module-Build-0.15/lib/Module/Build.pm
--- Module-Build-0.15-orig/lib/Module/Build.pm Fri Jan 17 13:11:05 2003
+++ Module-Build-0.15/lib/Module/Build.pm Wed Feb 19 16:46:26 2003
@@ -733,6 +733,28 @@
anything, it will just report what it I<would> have done if you had
actually run the C<install> action.
+=item versioninstall
+
+If you have C<only.pm> installed on your system, you can use this action
+to install a module into the version specific library trees. This means
+that you can have several versions of the same module installed and
+C<use> a specific one like this:
+
+ use only MyModule => 0.55;
+
+To override the default installation libraries in C<only::config>,
+specify the C<versionlib> parameter when you run the C<Build.PL> script:
+
+ perl Build.PL versionlib=/my/version/place/
+
+To override which version the module is installed as, specify the
+C<versionlib> parameter when you run the C<Build.PL> script:
+
+ perl Build.PL version=0.50
+
+See the C<only.pm> documentation for more information on version
+specific installs.
+
=item manifest
This is an action intended for use by module authors, not people
Only in Module-Build-0.15: x
|
|
From: Ken W. <ke...@ma...> - 2003-02-20 02:43:43
|
Applied!
I think the fact that $only::config::versionlib,
$only::config::versionarch, and @ARGV need to be manipulated
dynamically means that only.pm needs a little interface work, though -
do you plan on adding a programmatic interface that could just accept
this stuff as arguments?
-Ken
On Wednesday, February 19, 2003, at 07:24 PM, Brian Ingerson wrote:
> Here's a patch to make:
>
> ./Build versioninstall work.
>
> Cheers, Brian
>
>
> diff -ru Module-Build-0.15-orig/lib/Module/Build/Base.pm
> Module-Build-0.15/lib/Module/Build/Base.pm
> --- Module-Build-0.15-orig/lib/Module/Build/Base.pm Fri Jan 17
> 12:53:11 2003
> +++ Module-Build-0.15/lib/Module/Build/Base.pm Wed Feb 19 17:01:52 2003
> @@ -761,6 +761,28 @@
> ExtUtils::Install::install($self->install_map('blib'), 1, 1);
> }
>
> +sub ACTION_versioninstall {
> + my ($self) = @_;
> + eval { require only };
> + die "You must have only.pm installed for this operation\n"
> + if $@;
> +
> + if (defined $self->{args}{versionlib}) {
> + require Config;
> + $only::config::versionlib = $self->{args}{versionlib};
> + $only::config::versionarch =
> + File::Spec->catdir($self->{args}{versionlib},
> + $Config::Config{archname});
> + }
> + my @args = ();
> + if (defined $self->{args}{version}) {
> + push @args, $self->{args}{version};
> + }
> + $self->depends_on('build');
> + local @ARGV = @args;
> + only::install();
> +}
> +
> sub ACTION_clean {
> my ($self) = @_;
> foreach my $item (keys %{$self->{cleanup}}) {
> diff -ru Module-Build-0.15-orig/lib/Module/Build.pm
> Module-Build-0.15/lib/Module/Build.pm
> --- Module-Build-0.15-orig/lib/Module/Build.pm Fri Jan 17 13:11:05 2003
> +++ Module-Build-0.15/lib/Module/Build.pm Wed Feb 19 16:46:26 2003
> @@ -733,6 +733,28 @@
> anything, it will just report what it I<would> have done if you had
> actually run the C<install> action.
>
> +=item versioninstall
> +
> +If you have C<only.pm> installed on your system, you can use this
> action
> +to install a module into the version specific library trees. This
> means
> +that you can have several versions of the same module installed and
> +C<use> a specific one like this:
> +
> + use only MyModule => 0.55;
> +
> +To override the default installation libraries in C<only::config>,
> +specify the C<versionlib> parameter when you run the C<Build.PL>
> script:
> +
> + perl Build.PL versionlib=/my/version/place/
> +
> +To override which version the module is installed as, specify the
> +C<versionlib> parameter when you run the C<Build.PL> script:
> +
> + perl Build.PL version=0.50
> +
> +See the C<only.pm> documentation for more information on version
> +specific installs.
> +
> =item manifest
>
> This is an action intended for use by module authors, not people
> Only in Module-Build-0.15: x
>
>
> -------------------------------------------------------
> This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
> The most comprehensive and flexible code editor you can use.
> Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
> www.slickedit.com/sourceforge
> _______________________________________________
> Module-build-general mailing list
> Mod...@li...
> https://lists.sourceforge.net/lists/listinfo/module-build-general
>
-Ken
|
|
From: Brian I. <in...@tt...> - 2003-02-20 04:39:05
|
On 19/02/03 20:43 -0600, Ken Williams wrote:
> Applied!
>
> I think the fact that $only::config::versionlib,
> $only::config::versionarch, and @ARGV need to be manipulated
> dynamically means that only.pm needs a little interface work, though -
> do you plan on adding a programmatic interface that could just accept
> this stuff as arguments?
Good point. That's pretty crufty. I'll fix it. Expect a patch later
tonight.
Cheers, Brian
>
> -Ken
>
> On Wednesday, February 19, 2003, at 07:24 PM, Brian Ingerson wrote:
>
> > Here's a patch to make:
> >
> > ./Build versioninstall work.
> >
> > Cheers, Brian
> >
> >
> > diff -ru Module-Build-0.15-orig/lib/Module/Build/Base.pm
> > Module-Build-0.15/lib/Module/Build/Base.pm
> > --- Module-Build-0.15-orig/lib/Module/Build/Base.pm Fri Jan 17
> > 12:53:11 2003
> > +++ Module-Build-0.15/lib/Module/Build/Base.pm Wed Feb 19 17:01:52 2003
> > @@ -761,6 +761,28 @@
> > ExtUtils::Install::install($self->install_map('blib'), 1, 1);
> > }
> >
> > +sub ACTION_versioninstall {
> > + my ($self) = @_;
> > + eval { require only };
> > + die "You must have only.pm installed for this operation\n"
> > + if $@;
> > +
> > + if (defined $self->{args}{versionlib}) {
> > + require Config;
> > + $only::config::versionlib = $self->{args}{versionlib};
> > + $only::config::versionarch =
> > + File::Spec->catdir($self->{args}{versionlib},
> > + $Config::Config{archname});
> > + }
> > + my @args = ();
> > + if (defined $self->{args}{version}) {
> > + push @args, $self->{args}{version};
> > + }
> > + $self->depends_on('build');
> > + local @ARGV = @args;
> > + only::install();
> > +}
> > +
> > sub ACTION_clean {
> > my ($self) = @_;
> > foreach my $item (keys %{$self->{cleanup}}) {
> > diff -ru Module-Build-0.15-orig/lib/Module/Build.pm
> > Module-Build-0.15/lib/Module/Build.pm
> > --- Module-Build-0.15-orig/lib/Module/Build.pm Fri Jan 17 13:11:05 2003
> > +++ Module-Build-0.15/lib/Module/Build.pm Wed Feb 19 16:46:26 2003
> > @@ -733,6 +733,28 @@
> > anything, it will just report what it I<would> have done if you had
> > actually run the C<install> action.
> >
> > +=item versioninstall
> > +
> > +If you have C<only.pm> installed on your system, you can use this
> > action
> > +to install a module into the version specific library trees. This
> > means
> > +that you can have several versions of the same module installed and
> > +C<use> a specific one like this:
> > +
> > + use only MyModule => 0.55;
> > +
> > +To override the default installation libraries in C<only::config>,
> > +specify the C<versionlib> parameter when you run the C<Build.PL>
> > script:
> > +
> > + perl Build.PL versionlib=/my/version/place/
> > +
> > +To override which version the module is installed as, specify the
> > +C<versionlib> parameter when you run the C<Build.PL> script:
> > +
> > + perl Build.PL version=0.50
> > +
> > +See the C<only.pm> documentation for more information on version
> > +specific installs.
> > +
> > =item manifest
> >
> > This is an action intended for use by module authors, not people
> > Only in Module-Build-0.15: x
> >
> >
> > -------------------------------------------------------
> > This SF.net email is sponsored by: SlickEdit Inc. Develop an edge.
> > The most comprehensive and flexible code editor you can use.
> > Code faster. C/C++, C#, Java, HTML, XML, many more. FREE 30-Day Trial.
> > www.slickedit.com/sourceforge
> > _______________________________________________
> > Module-build-general mailing list
> > Mod...@li...
> > https://lists.sourceforge.net/lists/listinfo/module-build-general
> >
>
> -Ken
|
|
From: Brian I. <in...@tt...> - 2003-02-24 02:20:37
|
On 19/02/03 20:43 -0600, Ken Williams wrote:
> Applied!
>
> I think the fact that $only::config::versionlib,
> $only::config::versionarch, and @ARGV need to be manipulated
> dynamically means that only.pm needs a little interface work, though -
> do you plan on adding a programmatic interface that could just accept
> this stuff as arguments?
And now for that patch I promised. Sorry I took so long, but you
challenged me to go back and refactor only.pm, which I did a whole bunch
of. I think you'll find the new patch to be much cleaner :)
I also am getting some interesting ideas on how to give C<only> an OO
API. Something like:
use only YAML => '0.35';
could be:
use only;
my $o;
BEGIN {
$o = only->new;
$o->module('YAML');
$o->condition('0.35');
$o->versionlib('/home/ingy/modules');
$o->include; # have object put itself into @INC
}
use YAML qw(:all);
BEGIN {
$o->exclude; # remove itself from @INC
}
Anyway, I digress. Here is your patch. I must admit I find it quite
powerful to say:
perl Build.PL
./Build versioninstall versionlib=/home/ingy/foo
Cheers, Brian
diff -ru Module-Build-0.15-orig/lib/Module/Build/Base.pm Module-Build-0.15.only/lib/Module/Build/Base.pm
--- Module-Build-0.15-orig/lib/Module/Build/Base.pm Fri Jan 17 12:53:11 2003
+++ Module-Build-0.15.only/lib/Module/Build/Base.pm Sun Feb 23 17:56:55 2003
@@ -761,6 +761,14 @@
ExtUtils::Install::install($self->install_map('blib'), 1, 1);
}
+sub ACTION_versioninstall {
+ my ($self) = @_;
+ eval { require only::install };
+ die "You must have only.pm installed for this operation:\n$@" if $@;
+ $self->depends_on('build');
+ only::install::install(%{$self->{args}});
+}
+
sub ACTION_clean {
my ($self) = @_;
foreach my $item (keys %{$self->{cleanup}}) {
diff -ru Module-Build-0.15-orig/lib/Module/Build.pm Module-Build-0.15.only/lib/Module/Build.pm
--- Module-Build-0.15-orig/lib/Module/Build.pm Fri Jan 17 13:11:05 2003
+++ Module-Build-0.15.only/lib/Module/Build.pm Wed Feb 19 16:46:26 2003
@@ -733,6 +733,28 @@
anything, it will just report what it I<would> have done if you had
actually run the C<install> action.
+=item versioninstall
+
+If you have C<only.pm> installed on your system, you can use this action
+to install a module into the version specific library trees. This means
+that you can have several versions of the same module installed and
+C<use> a specific one like this:
+
+ use only MyModule => 0.55;
+
+To override the default installation libraries in C<only::config>,
+specify the C<versionlib> parameter when you run the C<Build.PL> script:
+
+ perl Build.PL versionlib=/my/version/place/
+
+To override which version the module is installed as, specify the
+C<versionlib> parameter when you run the C<Build.PL> script:
+
+ perl Build.PL version=0.50
+
+See the C<only.pm> documentation for more information on version
+specific installs.
+
=item manifest
This is an action intended for use by module authors, not people
Only in Module-Build-0.15.only: x
|
|
From: Ken W. <ke...@ma...> - 2003-02-24 19:04:53
|
On Sunday, February 23, 2003, at 08:20 PM, Brian Ingerson wrote:
> On 19/02/03 20:43 -0600, Ken Williams wrote:
>> Applied!
>>
>> I think the fact that $only::config::versionlib,
>> $only::config::versionarch, and @ARGV need to be manipulated
>> dynamically means that only.pm needs a little interface work, though -
>> do you plan on adding a programmatic interface that could just accept
>> this stuff as arguments?
>
> And now for that patch I promised. Sorry I took so long, but you
> challenged me to go back and refactor only.pm, which I did a whole
> bunch
> of. I think you'll find the new patch to be much cleaner :)
Here's how I'm applying it:
sub ACTION_versioninstall {
my ($self) = @_;
die "You must have only.pm 0.25 or greater installed for this
operation: $@\n"
unless eval { require only; 'only'->VERSION(0.25); 1 };
$self->depends_on('build');
my %onlyargs = map {exists($self->{args}{$_}) ? ($_ =>
$self->{args}{$_}) : ()}
qw(version versionlib);
only::install::install(%onlyargs);
}
There might be other things in the $self->{args} hash that you don't
want to pass to only::install::install(), so I had to check for
specific keys.
I've also added a caution in the Changes file that the interface still
seems volatile.
If I had more time I'd offer some feedback on the OO interface, but
unfortunately I'm up against a bit of a time wall here. =(
-Ken
|
|
From: Brian I. <in...@tt...> - 2003-02-24 20:22:53
|
On 24/02/03 13:04 -0600, Ken Williams wrote:
>
> On Sunday, February 23, 2003, at 08:20 PM, Brian Ingerson wrote:
>
> > On 19/02/03 20:43 -0600, Ken Williams wrote:
> >> Applied!
> >>
> >> I think the fact that $only::config::versionlib,
> >> $only::config::versionarch, and @ARGV need to be manipulated
> >> dynamically means that only.pm needs a little interface work, though -
> >> do you plan on adding a programmatic interface that could just accept
> >> this stuff as arguments?
> >
> > And now for that patch I promised. Sorry I took so long, but you
> > challenged me to go back and refactor only.pm, which I did a whole
> > bunch
> > of. I think you'll find the new patch to be much cleaner :)
>
> Here's how I'm applying it:
>
> sub ACTION_versioninstall {
> my ($self) = @_;
>
> die "You must have only.pm 0.25 or greater installed for this
> operation: $@\n"
> unless eval { require only; 'only'->VERSION(0.25); 1 };
>
> $self->depends_on('build');
>
> my %onlyargs = map {exists($self->{args}{$_}) ? ($_ =>
> $self->{args}{$_}) : ()}
> qw(version versionlib);
> only::install::install(%onlyargs);
> }
>
> There might be other things in the $self->{args} hash that you don't
> want to pass to only::install::install(), so I had to check for
> specific keys.
ok, but...
I had it that way on purpose because only::install::install ignores
unknown parameters. That way it could be forward compatible with new
only::install args.
but, that's fine, because I'd still want to patch the M::B docs for the
new args.
Thanks for applying.
> I've also added a caution in the Changes file that the interface still
> seems volatile.
How so?
(Show me a failing test, and I'll show you a patch! ;)
> If I had more time I'd offer some feedback on the OO interface, but
> unfortunately I'm up against a bit of a time wall here. =(
Yeah well, no problem. We all have lots to do!
I put the OO interface into the latest release: only-0.25. I also
refactored the internals to use the same OO interface. I'm pretty happy
with how it all turned out.
But I'd love to hear your comments someday. :)
Cheers, Brian
|
|
From: Ken W. <ke...@ma...> - 2003-02-24 20:48:15
|
On Monday, February 24, 2003, at 02:22 PM, Brian Ingerson wrote: > > (Show me a failing test, and I'll show you a patch! ;) Heh - show me a test for only.pm in Module::Build's regression tests, and that would help me never show you a failing test. =) Anyway, patches are no good for already-released software - there will still be buggy combinations out there if such bugs are found by others. For instance, bug: with version 0.25, if only.pm can't find a 'version' in get_meta(), it will die regardless of whether the user supplied a 'version' argument. It's also possible for the 'distribution_name' key to be null in your meta-file, because it's never checked for success. I'm not trying to pick on your work, I'm just saying that it's hard to write bug-free (or bug-rare) software without a few releases of it, and that's why I'm saying it's "volatile" at this point. Later it will become "mature", no doubt. Actually, were you objecting to my use of the word "volatile", or that I required version 0.25 of only? -Ken |
|
From: Brian I. <in...@tt...> - 2003-02-25 01:24:11
|
On 24/02/03 14:48 -0600, Ken Williams wrote: > > On Monday, February 24, 2003, at 02:22 PM, Brian Ingerson wrote: > > > > (Show me a failing test, and I'll show you a patch! ;) > > Heh - show me a test for only.pm in Module::Build's regression tests, > and that would help me never show you a failing test. =) Heh. Touche! Well I actually did consider a regression test patch, but I noticed you didn't have any tests for './Build install' so I blew it off. > Anyway, patches are no good for already-released software - there will > still be buggy combinations out there if such bugs are found by others. > > For instance, bug: with version 0.25, if only.pm can't find a 'version' > in get_meta(), it will die regardless of whether the user supplied a > 'version' argument. ouch. good catch. > It's also possible for the 'distribution_name' key to be null in your > meta-file, because it's never checked for success. Yeah, I know. That field is only for documentation at this point, so I was silently forgiving. > I'm not trying to pick on your work, I'm just saying that it's hard to > write bug-free (or bug-rare) software without a few releases of it, and > that's why I'm saying it's "volatile" at this point. Later it will > become "mature", no doubt. Pick away! I truly appreciate other people's input and opinions. > Actually, were you objecting to my use of the word "volatile", or that > I required version 0.25 of only? Not objecting. Just wondering. Thanks for the clarification. And I think that requiring 0.25 is a good thing. Cheers, Brian |
|
From: Ken W. <ke...@ma...> - 2003-02-25 15:08:54
|
On Monday, February 24, 2003, at 07:23 PM, Brian Ingerson wrote: > Heh. Touche! > > Well I actually did consider a regression test patch, but I noticed you > didn't have any tests for './Build install' so I blew it off. Now that there's a 'destdir' parameter to 'install', I should be able to write a test fairly easily, actually. I'll get on it for the next release. This is pretty important, I think, so thanks for reminding me. -Ken |