You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by Stas Bekman <st...@stason.org> on 2001/11/20 13:00:12 UTC
[patch] automatic build's args re-use
This patch allows to re-run the build using the same args as the one
that's already built
Should be used as:
% perl -MApache::BuildConfig -erebuild
or if not yet installed:
% perl -Ilib -MApache::BuildConfig -erebuild
should probably be wrapped into a build/rebuild.pl script to type less.
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.72
diff -u -r1.72 Build.pm
--- lib/Apache/Build.pm 2001/11/02 17:59:05 1.72
+++ lib/Apache/Build.pm 2001/11/20 11:40:23
@@ -448,6 +448,24 @@
sub new {
$obj;
}
+EOF
+
+ print $fh <<'EOF';
+
+sub rebuild {
+ my $self = __PACKAGE__->new;
+ my $valid_opts = ModPerl::BuildOptions->table();
+ my @opts = map { "$_=" .
+ ($self->{$_} =~ /^\d+$/
+ ? $self->{$_}
+ : qq{'$self->{$_}'}
+ ) } sort grep { exists $valid_opts->{$_} } keys %$self;
+ my $command = "perl Makefile.PL @opts";
+ print "Running: $command\n";
+ system $command;
+}
+# % perl -MApache::BuildConfig -erebuild
+*main::rebuild=\&rebuild;
1;
EOF
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [patch] automatic build's args re-use
Posted by Doug MacEachern <do...@covalent.net>.
On Wed, 21 Nov 2001, Stas Bekman wrote:
> that doesn't work, since new args starting with MP_ are added. If I do
> what you suggest I get:
...
> Unknown Option: MP_LIBNAME
you found a bug, try now :)
> here is the new patch:
>
> not sure about the __PACKAGE__ thing in the first sub line though.
looks good. __PACKAGE__ is fine. if you could change to grep /^MP_/,
then we have somewhat of a sanity check that we don't use any MP_
names that aren't valid build options. +1 with that.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [patch] automatic build's args re-use
Posted by Stas Bekman <st...@stason.org>.
On Tue, 20 Nov 2001, Doug MacEachern wrote:
> On Tue, 20 Nov 2001, Stas Bekman wrote:
>
> > This patch allows to re-run the build using the same args as the one
> > that's already built
> >
> > Should be used as:
> >
> > % perl -MApache::BuildConfig -erebuild
>
> Apache::BuildConfig is only supposed to be used by Apache::Build.
>
> > + print $fh <<'EOF';
>
> rebuild should live in Apache::Build, instead of calling new() it would
> call build_config() to get the values from Apache::BuildConfig.
>
> > +sub rebuild {
> > + my $self = __PACKAGE__->new;
> > + my $valid_opts = ModPerl::BuildOptions->table();
> > + my @opts = map { "$_=" .
> > + ($self->{$_} =~ /^\d+$/
> > + ? $self->{$_}
> > + : qq{'$self->{$_}'}
> > + ) } sort grep { exists $valid_opts->{$_} } keys %$self;
>
> no need for $valid_opts, /^MP_/ will do, since all build options are
> prefixed with MP_ and if they weren't valid, they wouldn't have made it
> into Apache::BuildConfig.
that doesn't work, since new args starting with MP_ are added. If I do
what you suggest I get:
perl -Ilib -MApache::Build -erebuild
Running: perl Makefile.PL MP_APXS='/home/stas/httpd/prefork/bin/apxs'
MP_CCOPTS='-DMP_IOBUFSIZE=16384 -Werror' MP_DEBUG='1' MP_GENERATE_XS='1'
MP_LIBNAME='libmodperl' MP_MAINTAINER='1' MP_TRACE='1' MP_USE_DSO='1'
MP_USE_GTOP='1'
Reading Makefile.PL args from @ARGV
MP_APXS = /home/stas/httpd/prefork/bin/apxs
MP_CCOPTS = -DMP_IOBUFSIZE=16384 -Werror
MP_DEBUG = 1
MP_GENERATE_XS = 1
Unknown Option: MP_LIBNAME
here is the new patch:
not sure about the __PACKAGE__ thing in the first sub line though.
Index: lib/Apache/Build.pm
===================================================================
RCS file: /home/cvs/modperl-2.0/lib/Apache/Build.pm,v
retrieving revision 1.72
diff -u -r1.72 Build.pm
--- lib/Apache/Build.pm 2001/11/02 17:59:05 1.72
+++ lib/Apache/Build.pm 2001/11/21 02:01:57
@@ -455,6 +455,22 @@
close $fh or die "failed to write $file: $!";
}
+
+sub rebuild {
+ my $self = __PACKAGE__->build_config;
+ my $valid_opts = ModPerl::BuildOptions->table();
+ my @opts = map { qq[$_='$self->{$_}'] }
+ sort grep { exists $valid_opts->{$_} } keys %$self;
+ my $command = "perl Makefile.PL @opts";
+ print "Running: $command\n";
+ system $command;
+}
+# % perl -MApache::Build -erebuild
+*main::rebuild = \&rebuild if $0 eq '-e';
+
+
+
+
#--- attribute access ---
sub is_dynamic {
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:stas@stason.org http://ticketmaster.com http://apacheweek.com
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org
Re: [patch] automatic build's args re-use
Posted by Doug MacEachern <do...@covalent.net>.
On Tue, 20 Nov 2001, Stas Bekman wrote:
> This patch allows to re-run the build using the same args as the one
> that's already built
>
> Should be used as:
>
> % perl -MApache::BuildConfig -erebuild
Apache::BuildConfig is only supposed to be used by Apache::Build.
> + print $fh <<'EOF';
rebuild should live in Apache::Build, instead of calling new() it would
call build_config() to get the values from Apache::BuildConfig.
> +sub rebuild {
> + my $self = __PACKAGE__->new;
> + my $valid_opts = ModPerl::BuildOptions->table();
> + my @opts = map { "$_=" .
> + ($self->{$_} =~ /^\d+$/
> + ? $self->{$_}
> + : qq{'$self->{$_}'}
> + ) } sort grep { exists $valid_opts->{$_} } keys %$self;
no need for $valid_opts, /^MP_/ will do, since all build options are
prefixed with MP_ and if they weren't valid, they wouldn't have made it
into Apache::BuildConfig. can also just quote every value, no need for
conditional on /^\d+$/
> + my $command = "perl Makefile.PL @opts";
> + print "Running: $command\n";
> + system $command;
> +}
> +# % perl -MApache::BuildConfig -erebuild
> +*main::rebuild=\&rebuild;
and this should be:
*main::rebuild = \&rebuild if $0 eq '-e';
so the alias is only created for 'perl -MApache::Build -e rebuild'
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org