perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: [patch] automatic build's args re-use
Date Wed, 21 Nov 2001 02:18:33 GMT
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


Mime
View raw message