module-build-checkins Mailing List for Module::Build (Page 11)
Status: Beta
Brought to you by:
kwilliams
You can subscribe to this list here.
2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(82) |
Dec
(58) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2005 |
Jan
(49) |
Feb
(57) |
Mar
(49) |
Apr
(49) |
May
(2) |
Jun
(147) |
Jul
(60) |
Aug
(55) |
Sep
(51) |
Oct
(68) |
Nov
(61) |
Dec
(44) |
2006 |
Jan
(27) |
Feb
(38) |
Mar
(89) |
Apr
(31) |
May
(17) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Randy W. S. <si...@us...> - 2005-11-30 10:46:12
|
Update of /cvsroot/module-build/Module-Build/lib/Module In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16771/lib/Module Modified Files: Build.pm Log Message: Minor doc fixes. Index: Build.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build.pm,v retrieving revision 1.202 retrieving revision 1.203 diff -u -d -r1.202 -r1.203 --- Build.pm 21 Nov 2005 03:36:13 -0000 1.202 +++ Build.pm 30 Nov 2005 10:46:04 -0000 1.203 @@ -163,7 +163,7 @@ =item General Usage (L<Module::Build>) This is the document you are currently reading. It describes basic -usage and background information. Its main purpose is to assist the +usage and background information. Its main purpose is to assist the user who wants to learn how to invoke and control C<Module::Build> scripts at the command line. @@ -171,18 +171,18 @@ This document describes the C<Module::Build> API for authors who are writing F<Build.PL> scripts for a distribution or controlling -C<Module::Build> processes programmatically. It describes the +C<Module::Build> processes programmatically. It describes the methods available as well as providing general information on -subclassing C<Module::Build> to alter and extend its behavior. Also, +subclassing C<Module::Build> to alter and extend its behavior. Also, there is a section on controlling the Build process from other scripts, including how to construct an object and how to invoke actions through it from an external script. =item Cookbook (L<Module::Build::Cookbook>) -This document demonstrates how to accomplish many common tasks. It +This document demonstrates how to accomplish many common tasks. It covers general command line usage and authoring of F<Build.PL> -scripts. Includes working examples. +scripts. Includes working examples. =back @@ -196,7 +196,7 @@ Second, arguments are processed in a very systematic way. Arguments are always key=value pairs. They may be specified at C<perl Build.PL> -time (i.e. C<perl Build.PL destdir=/my/secret/place>), in which case +time (i.e. C<perl Build.PL destdir=/my/secret/place>), in which case their values last for the lifetime of the C<Build> script. They may also be specified when executing a particular action (i.e. C<Build test verbose=1>), in which case their values last only for the @@ -444,7 +444,7 @@ =item prereq_report This action prints out a list of all prerequisites, the versions required, and -the versions actually installed. This can be useful for reviewing the +the versions actually installed. This can be useful for reviewing the configuration of your system prior to a build, or when compiling data to send for a bug report. @@ -556,7 +556,7 @@ =head2 Command Line Options The following options can be used during any invocation of Build.PL or -the Build script, during any action. For information on other options +the Build script, during any action. For information on other options specific to an action, see the documentation for the respective action. NOTE: There is some preliminary support for options to use the more |
From: Ken W. <kwi...@us...> - 2005-11-29 05:18:47
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18584/lib/Module/Build Modified Files: Authoring.pod Base.pm Log Message: Build will now chdir() to the right directory first Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.529 retrieving revision 1.530 diff -u -d -r1.529 -r1.530 --- Base.pm 29 Nov 2005 05:03:09 -0000 1.529 +++ Base.pm 29 Nov 2005 05:18:40 -0000 1.530 @@ -562,6 +562,9 @@ # Set the build class. $self->{properties}{build_class} ||= ref $self; + # If there was no orig_dir, set to the same as base_dir + $self->{properties}{orig_dir} ||= $self->{properties}{base_dir}; + my $defaults = $self->valid_properties_defaults; foreach my $prop (keys %$defaults) { @@ -643,6 +646,7 @@ license mb_version module_name + orig_dir perl pm_files pod_files @@ -1159,15 +1163,13 @@ use Cwd; use File::Spec; +my \$orig_dir; BEGIN { \$^W = 1; # Use warnings - my \$curdir = File::Spec->canonpath( Cwd::cwd() ); - \$curdir = uc \$curdir if $case_tolerant; - my \$is_same_dir = \$^O eq 'MSWin32' ? (Win32::GetShortPathName(\$curdir) eq '$q{base_dir}') - : (\$curdir eq '$q{base_dir}'); - unless (\$is_same_dir) { - die ('This script must be run from $q{base_dir}, not '.\$curdir."\\n". - "Please re-run the Build.PL script here.\\n"); + \$orig_dir = Cwd::cwd(); + my \$base_dir = '$q{base_dir}'; + unless (chdir(\$base_dir)) { + die ("Couldn't chdir(\$base_dir), aborting\\n"); } unshift \@INC, ( @@ -1189,6 +1191,7 @@ my \$build = $build_package->resume ( properties => { config_dir => '$q{config_dir}', + orig_dir => \$orig_dir, }, ); Index: Authoring.pod =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Authoring.pod,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- Authoring.pod 22 Nov 2005 10:40:43 -0000 1.24 +++ Authoring.pod 29 Nov 2005 05:18:40 -0000 1.25 @@ -1061,6 +1061,13 @@ instead of called from a shell), and lasts until C<perl Build.PL> is run again or the C<clean> action is run. +=item orig_dir() + +Returns a string containing the working directory that was in effect +before the F<Build> script chdir()-ed into the C<base_dir>. This +might be useful for writing wrapper tools that might need to chdir() +back out. + =item runtime_params() =item runtime_params($key) |
From: Ken W. <kwi...@us...> - 2005-11-29 05:18:47
|
Update of /cvsroot/module-build/Module-Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18584 Modified Files: Changes Log Message: Build will now chdir() to the right directory first Index: Changes =================================================================== RCS file: /cvsroot/module-build/Module-Build/Changes,v retrieving revision 1.400 retrieving revision 1.401 diff -u -d -r1.400 -r1.401 --- Changes 29 Nov 2005 05:03:09 -0000 1.400 +++ Changes 29 Nov 2005 05:18:40 -0000 1.401 @@ -15,6 +15,10 @@ YAML.pm - some common strings weren't quoted & escaped properly. Now only some uncommon ones are. [Spotted by Joshua ben Jore] + - Rather than dying when the Build script is run from the wrong + directory, it now simply chdir()s into the right directory and + keeps going. [Suggested by Dominique Quatravaux] + - Added an "Examples on CPAN" section to the cookbook, with an initial entry pointing to John Peacock's SVN-Notify-Mirror distribution. |
From: Ken W. <kwi...@us...> - 2005-11-29 05:13:12
|
Update of /cvsroot/module-build/Module-Build/t/lib In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17804/t/lib Modified Files: DistGen.pm Log Message: Clarify this warning message Index: DistGen.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/lib/DistGen.pm,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- DistGen.pm 15 Nov 2005 06:32:49 -0000 1.13 +++ DistGen.pm 29 Nov 2005 05:13:04 -0000 1.14 @@ -30,7 +30,7 @@ my $self = bless( \%data, $package ); if ( -d $self->dirname ) { - warn "Warning: Removing existing directory at '@{[$self->dirname]}'\n"; + warn "Warning: Removing existing directory '@{[$self->dirname]}'\n"; $self->remove; } |
From: Ken W. <kwi...@us...> - 2005-11-29 05:03:17
|
Update of /cvsroot/module-build/Module-Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16078 Modified Files: Changes Log Message: Handle some YAML escaping better Index: Changes =================================================================== RCS file: /cvsroot/module-build/Module-Build/Changes,v retrieving revision 1.399 retrieving revision 1.400 diff -u -d -r1.399 -r1.400 --- Changes 27 Nov 2005 02:53:30 -0000 1.399 +++ Changes 29 Nov 2005 05:03:09 -0000 1.400 @@ -11,6 +11,10 @@ list of all prerequisites, the versions required, and the versions actually installed. [David Wheeler] + - Fixed a bug when creating the META.yml file without the help of + YAML.pm - some common strings weren't quoted & escaped properly. + Now only some uncommon ones are. [Spotted by Joshua ben Jore] + - Added an "Examples on CPAN" section to the cookbook, with an initial entry pointing to John Peacock's SVN-Notify-Mirror distribution. |
From: Ken W. <kwi...@us...> - 2005-11-29 05:03:17
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16078/lib/Module/Build Modified Files: Base.pm Log Message: Handle some YAML escaping better Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.528 retrieving revision 1.529 diff -u -d -r1.528 -r1.529 --- Base.pm 27 Nov 2005 09:30:32 -0000 1.528 +++ Base.pm 29 Nov 2005 05:03:09 -0000 1.529 @@ -2847,6 +2847,19 @@ } } +sub _yaml_quote_string { + # XXX doesn't handle embedded newlines + + my ($self, $string) = @_; + if ($string !~ /\"/) { + $string =~ s{\\}{\\\\}g; + return qq{"$string"}; + } else { + $string =~ s{([\\'])}{\\$1}g; + return qq{'$string'}; + } +} + sub _write_minimal_metadata { my $self = shift; my $p = $self->{properties}; @@ -2855,6 +2868,9 @@ my $fh = IO::File->new("> $file") or die "Can't open $file: $!"; + my @author = map $self->_yaml_quote_string($_), @{$self->dist_author}; + my $abstract = $self->_yaml_quote_string($self->dist_abstract); + # XXX Add the meta_add & meta_merge stuff print $fh <<"EOF"; @@ -2862,8 +2878,8 @@ name: $p->{dist_name} version: $p->{dist_version} author: -@{[ join "\n", map " - $_", @{$self->dist_author} ]} -abstract: @{[ $self->dist_abstract ]} +@{[ join "\n", map " - $_", @author ]} +abstract: $abstract license: $p->{license} generated_by: Module::Build version $Module::Build::VERSION, without YAML.pm EOF |
From: Ken W. <kwi...@us...> - 2005-11-29 05:03:17
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16078/t Modified Files: metadata.t Log Message: Handle some YAML escaping better Index: metadata.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/metadata.t,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- metadata.t 5 Nov 2005 15:58:13 -0000 1.9 +++ metadata.t 29 Nov 2005 05:03:09 -0000 1.10 @@ -3,7 +3,7 @@ use lib 't/lib'; use strict; -use Test::More tests => 43; +use Test::More tests => 46; use File::Spec (); @@ -562,6 +562,14 @@ is_deeply($mb->find_dist_packages, {}); +{ + # Put our YAML escaper through a few tests. This isn't part of the M::B API. + my $yq = sub {Module::Build->_yaml_quote_string(@_)}; + like $yq->(''), qr{^ (['"]) \1 $}x; + is $yq->('Foo "bar" baz'), q{'Foo "bar" baz'}; + is $yq->("Foo 'bar' baz"), q{"Foo 'bar' baz"}; +} + ############################################################ # cleanup chdir( $cwd ) or die "Can't chdir to '$cwd': $!"; |
From: Randy W. S. <si...@us...> - 2005-11-27 09:32:58
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24026/t Modified Files: xs.t Log Message: Add tests for a distro with a flat directory structure and that does not define the "module_name" property (i.e. it uses "dist_name"). Index: xs.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/xs.t,v retrieving revision 1.33 retrieving revision 1.34 diff -u -d -r1.33 -r1.34 --- xs.t 21 Nov 2005 06:24:58 -0000 1.33 +++ xs.t 27 Nov 2005 09:32:50 -0000 1.34 @@ -26,7 +26,7 @@ } elsif ( !$have_c_compiler ) { plan skip_all => 'C_support enabled, but no compiler found'; } else { - plan tests => 14; + plan tests => 22; } } @@ -90,14 +90,14 @@ eval {$mb->dispatch('test')}; is $@, ''; +eval {$mb->dispatch('clean')}; +is $@, ''; + SKIP: { - skip( "skipping a couple Unixish-only tests", 2 ) + skip( "skipping a Unixish-only tests", 1 ) unless $mb->os_type eq 'Unix'; - eval {$mb->dispatch('clean')}; - is $@, ''; - local $mb->{config}{ld} = "FOO=BAR $mb->{config}{ld}"; eval {$mb->dispatch('build')}; is $@, ''; @@ -114,5 +114,129 @@ chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; $dist->remove; + +######################################## + +# Try a XS distro with a deep namespace + +$dist = DistGen->new( name => 'Simple::With::Deep::Namespace', + dir => $tmp, xs => 1 ); +$dist->regen; +chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; + +$mb = Module::Build->new_from_context; +is $@, ''; + +$mb->dispatch('build'); +is $@, ''; + +$mb->dispatch('test'); +is $@, ''; + +$mb->dispatch('realclean'); +is $@, ''; + +# cleanup +chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; +$dist->remove; + + +######################################## + +# Try a XS distro using a flat directory structure +# and a 'dist_name' instead of a 'module_name' + +$dist = DistGen->new( name => 'Dist-Name', dir => $tmp, xs => 1 ); + +$dist->remove_file('lib/Dist-Name.pm'); +$dist->remove_file('lib/Dist-Name.xs'); + +$dist->change_file('Build.PL', <<"---"); +use strict; +use Module::Build; + +my \$builder = Module::Build->new( + dist_name => 'Dist-Name', + dist_version_from => 'Simple.pm', + pm_files => { 'Simple.pm' => 'lib/Simple.pm' }, + xs_files => { 'Simple.xs' => 'lib/Simple.xs' }, +); + +\$builder->create_build_script(); +--- +$dist->add_file('Simple.xs', <<"---"); +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +MODULE = Simple PACKAGE = Simple + +SV * +ok() + CODE: + RETVAL = newSVpv( "ok", 0 ); + OUTPUT: + RETVAL +--- + +$dist->add_file( 'Simple.pm', <<"---" ); +package Simple; + +use base qw( Exporter DynaLoader ); + +use vars qw( \$VERSION \@EXPORT_OK ); +\$VERSION = '0.01'; +\@EXPORT_OK = qw( ok ); + +bootstrap Simple \$VERSION; + +1; + +__END__ + +=head1 NAME + +Simple - Perl extension for blah blah blah + +=head1 DESCRIPTION + +Stub documentation for Simple. + +=head1 AUTHOR + +A. U. Thor, a.u.thor\@a.galaxy.far.far.away + +=cut +--- +$dist->change_file('t/basic.t', <<"---"); +use Test::More tests => 2; +use strict; + +use Simple; +ok( 1 ); + +ok( Simple::ok() eq 'ok' ); +--- + +$dist->regen; +chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; + + +$mb = Module::Build->new_from_context; +is $@, ''; + +$mb->dispatch('build'); +is $@, ''; + +$mb->dispatch('test'); +is $@, ''; + +$mb->dispatch('realclean'); +is $@, ''; + +# cleanup +chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; +$dist->remove; + use File::Path; rmtree( $tmp ); |
From: Randy W. S. <si...@us...> - 2005-11-27 09:30:42
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23727/lib/Module/Build Modified Files: Base.pm Log Message: Make sure "module_name" is defined when linking files, inferring it from the filename if necessary. Also, centralize code that derives various paths and info needed for creating output files. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.527 retrieving revision 1.528 diff -u -d -r1.527 -r1.528 --- Base.pm 22 Nov 2005 11:31:46 -0000 1.527 +++ Base.pm 27 Nov 2005 09:30:32 -0000 1.528 @@ -2285,7 +2285,7 @@ foreach my $pod ( keys %$pods ) { my ($name, $path) = File::Basename::fileparse($pods->{$pod}, - qr{\.(?:pm|plx?|pod)}); + qr{\.(?:pm|plx?|pod)$}); my @dirs = File::Spec->splitdir( File::Spec->canonpath( $path ) ); pop( @dirs ) if $dirs[-1] eq File::Spec->curdir; @@ -3402,25 +3402,28 @@ sub link_c { my ($self, $to, $file_base) = @_; - my $b = $self->_cbuilder; - my ($cf, $p) = ($self->config, $self->{properties}); # For convenience + my $p = $self->{properties}; # For convenience - my $obj_file = "$file_base$cf->{obj_ext}"; + my $spec = $self->_infer_xs_spec($file_base); - my $lib_file = $b->lib_file($obj_file); - $lib_file = File::Spec->catfile($to, File::Basename::basename($lib_file)); - $self->add_to_cleanup($lib_file); + $self->add_to_cleanup($spec->{lib_file}); my $objects = $p->{objects} || []; - return $lib_file if $self->up_to_date([$obj_file, @$objects], $lib_file); + return $spec->{lib_file} + if $self->up_to_date([$spec->{obj_file}, @$objects], + $spec->{lib_file}); - $b->link(module_name => $self->module_name, - objects => [$obj_file, @$objects], - lib_file => $lib_file, - extra_linker_flags => $p->{extra_linker_flags}); - - return $lib_file; + my $module_name = $self->module_name; + $module_name ||= $spec->{module_name}; + + $self->_cbuilder->link( + module_name => $module_name, + objects => [$spec->{obj_file}, @$objects], + lib_file => $spec->{lib_file}, + extra_linker_flags => $p->{extra_linker_flags} ); + + return $spec->{lib_file}; } sub compile_xs { @@ -3495,46 +3498,84 @@ return $self->do_system($perl, @$args); } +# Infer various data from the path of the input filename +# that is needed to create output files. +# The input filename is expected to be of the form: +# lib/Module/Name.ext or Module/Name.ext +sub _infer_xs_spec { + my $self = shift; + my $file = shift; + + my $cf = $self->{config}; + + my %spec; + + my( $v, $d, $f ) = File::Spec->splitpath( $file ); + my @d = File::Spec->splitdir( $d ); + (my $file_base = $f) =~ s/\.[^.]+$//i; + + $spec{base_name} = $file_base; + + $spec{src_dir} = File::Spec->catpath( $v, $d, '' ); + + # the module name + shift( @d ) while @d && ($d[0] eq 'lib' || $d[0] eq ''); + pop( @d ) while @d && $d[-1] eq ''; + $spec{module_name} = join( '::', (@d, $file_base) ); + + $spec{archdir} = File::Spec->catdir($self->blib, 'arch', 'auto', + @d, $file_base); + + $spec{bs_file} = File::Spec->catfile($spec{archdir}, "${file_base}.bs"); + + $spec{lib_file} = File::Spec->catfile($spec{archdir}, + "${file_base}.$cf->{dlext}"); + + $spec{c_file} = File::Spec->catfile( $spec{src_dir}, + "${file_base}.c" ); + + $spec{obj_file} = File::Spec->catfile( $spec{src_dir}, + "${file_base}$cf->{obj_ext}" ); + + return \%spec; +} + sub process_xs { my ($self, $file) = @_; my $cf = $self->config; # For convenience + my $spec = $self->_infer_xs_spec($file); + # File name, minus the suffix (my $file_base = $file) =~ s/\.[^.]+$//; - my $c_file = "$file_base.c"; # .xs -> .c - $self->add_to_cleanup($c_file); - - unless ($self->up_to_date($file, $c_file)) { - $self->compile_xs($file, outfile => $c_file); + $self->add_to_cleanup($spec->{c_file}); + + unless ($self->up_to_date($file, $spec->{c_file})) { + $self->compile_xs($file, outfile => $spec->{c_file}); } - + # .c -> .o my $v = $self->dist_version; - $self->compile_c($c_file, defines => {VERSION => qq{"$v"}, XS_VERSION => qq{"$v"}}); + $self->compile_c($spec->{c_file}, + defines => {VERSION => qq{"$v"}, XS_VERSION => qq{"$v"}}); + + # archdir + File::Path::mkpath($spec->{archdir}, 0, 0777) unless -d $spec->{archdir}; - # The .bs and .a files don't go in blib/lib/, they go in blib/arch/auto/. - # Unfortunately we have to pre-compute the whole path. - my $archdir; - { - my @dirs = File::Spec->splitdir($file_base); - $archdir = File::Spec->catdir($self->blib,'arch','auto', @dirs[1..$#dirs]); - } - # .xs -> .bs - $self->add_to_cleanup("$file_base.bs"); - unless ($self->up_to_date($file, "$file_base.bs")) { + $self->add_to_cleanup($spec->{bs_file}); + unless ($self->up_to_date($file, $spec->{bs_file})) { require ExtUtils::Mkbootstrap; - $self->log_info("ExtUtils::Mkbootstrap::Mkbootstrap('$file_base')\n"); - ExtUtils::Mkbootstrap::Mkbootstrap($file_base); # Original had $BSLOADLIBS - what's that? - {my $fh = IO::File->new(">> $file_base.bs")} # create - utime((time)x2, "$file_base.bs"); # touch + $self->log_info("ExtUtils::Mkbootstrap::Mkbootstrap('$spec->{bs_file}')\n"); + ExtUtils::Mkbootstrap::Mkbootstrap($spec->{bs_file}); # Original had $BSLOADLIBS - what's that? + {my $fh = IO::File->new(">> $spec->{bs_file}")} # create + utime((time)x2, $spec->{bs_file}); # touch } - $self->copy_if_modified("$file_base.bs", $archdir, 1); - + # .o -> .(a|bundle) - $self->link_c($archdir, $file_base); + $self->link_c($spec->{archdir}, $file_base); } sub do_system { |
From: Ken W. <kwi...@us...> - 2005-11-27 02:53:39
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24002/lib/Module/Build Modified Files: Cookbook.pm Log Message: Add an 'Examples on CPAN' section to the cookbook Index: Cookbook.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Cookbook.pm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Cookbook.pm 3 Nov 2005 01:08:31 -0000 1.16 +++ Cookbook.pm 27 Nov 2005 02:53:30 -0000 1.17 @@ -276,6 +276,38 @@ See also L<"Adding new file types to the build process"> for how to create the stuff in F<blib/conf/> in the first place. +=head1 EXAMPLES ON CPAN + +Several distributions on CPAN are making good use of various features +of Module::Build. They can serve as real-world examples for others. + +=head2 SVN-Notify-Mirror + +L<http://search.cpan.org/~jpeacock/SVN-Notify-Mirror/> + +John Peacock, author of the C<SVN-Notify-Mirror> distribution, says: + +=over 4 + +=item 1. Using C<auto_features>, I check to see whether two optional +modules are available - SVN::Notify::Config and Net::SSH; + +=item 2. If the S::N::Config module is loaded, I automatically +generate testfiles for it during Build (using the C<PL_files> +property). + +=item 3. If the C<ssh_feature> is available, I ask if the user wishes +to perform the ssh tests (since it requires a little preliminary +setup); + +=item 4. Only if the user has C<ssh_feature> and answers yes to the +testing, do I generate a test file. + +I'm sure I could not have handled this complexity with EU::MM, but it +was very easy to do with M::B. + +=back 4 + =head1 AUTHOR |
From: Ken W. <kwi...@us...> - 2005-11-27 02:53:38
|
Update of /cvsroot/module-build/Module-Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24002 Modified Files: Changes Log Message: Add an 'Examples on CPAN' section to the cookbook Index: Changes =================================================================== RCS file: /cvsroot/module-build/Module-Build/Changes,v retrieving revision 1.398 retrieving revision 1.399 diff -u -d -r1.398 -r1.399 --- Changes 15 Nov 2005 09:49:48 -0000 1.398 +++ Changes 27 Nov 2005 02:53:30 -0000 1.399 @@ -11,6 +11,10 @@ list of all prerequisites, the versions required, and the versions actually installed. [David Wheeler] + - Added an "Examples on CPAN" section to the cookbook, with an + initial entry pointing to John Peacock's SVN-Notify-Mirror + distribution. + - Add an invoked_action() method to return the name of the original action invoked by the user. |
From: Randy W. S. <si...@us...> - 2005-11-22 11:32:04
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9204/lib/Module/Build Modified Files: Base.pm Log Message: Fix buglet that stripped off everything after first dot (".") in a filename when generating html filename. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.526 retrieving revision 1.527 diff -u -d -r1.526 -r1.527 --- Base.pm 22 Nov 2005 10:51:14 -0000 1.526 +++ Base.pm 22 Nov 2005 11:31:46 -0000 1.527 @@ -2284,7 +2284,8 @@ foreach my $pod ( keys %$pods ) { - my ($name, $path) = File::Basename::fileparse($pods->{$pod}, qr{\..*}); + my ($name, $path) = File::Basename::fileparse($pods->{$pod}, + qr{\.(?:pm|plx?|pod)}); my @dirs = File::Spec->splitdir( File::Spec->canonpath( $path ) ); pop( @dirs ) if $dirs[-1] eq File::Spec->curdir; |
From: Randy W. S. <si...@us...> - 2005-11-22 11:07:41
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3831/t Modified Files: common.pl ppm.t Log Message: Add tests to ensure that html documents are built in the ppm distro when they are not built during a normal build. Index: ppm.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/ppm.t,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- ppm.t 21 Nov 2005 06:24:58 -0000 1.1 +++ ppm.t 22 Nov 2005 11:07:23 -0000 1.2 @@ -8,7 +8,7 @@ unless ( eval {require Archive::Tar} ) { plan skip_all => "Archive::Tar not installed; can't test archives."; } else { - plan tests => 9; + plan tests => 12; } @@ -118,6 +118,42 @@ ok $tar->contains_file('blib/html/site/lib/Simple.html'); ok $tar->contains_file('blib/html/bin/hello.html'); +$tar->clear; +undef( $tar ); + +$mb->dispatch('realclean'); +$dist->clean; + + +# Make sure html documents are generated for the ppm distro even when +# they would not be built during a normal build. +$mb = Module::Build->new_from_context( + verbose => 0, + quiet => 1, + + installdirs => 'site', + config => { + html_reset(), + installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'), + installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'), + }, +); + +$mb->dispatch('ppmdist'); +is $@, ''; + +$tar = Archive::Tar->new; +$tar->read( $tarfile, 1 ); + +ok $tar->contains_file('blib/html/site/lib/Simple.html'); +ok $tar->contains_file('blib/html/bin/hello.html'); + +$tar->clear; + +$mb->dispatch('realclean'); +$dist->clean; + + chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; $dist->remove; Index: common.pl =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/common.pl,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- common.pl 20 Oct 2005 16:45:19 -0000 1.14 +++ common.pl 22 Nov 2005 11:07:23 -0000 1.15 @@ -61,4 +61,32 @@ return; } + +# A hash of all Config.pm settings related to installing +# manpages with values set to an empty string. +sub manpage_reset { + return ( + installman1dir => '', + installman3dir => '', + installsiteman1dir => '', + installsiteman3dir => '', + installvendorman1dir => '', + installvendorman3dir => '', + ); +} + +# A hash of all Config.pm settings related to installing +# html documents with values set to an empty string. +sub html_reset { + return ( + installhtmldir => '', + installhtml1dir => '', + installhtml3dir => '', + installsitehtml1dir => '', + installsitehtml3dir => '', + installvendorhtml1dir => '', + installvendorhtml3dir => '', + ); +} + 1; |
From: Randy W. S. <si...@us...> - 2005-11-22 10:51:30
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32679/lib/Module/Build Modified Files: Base.pm Log Message: Make htmlify_pods() honor the installdirs setting to the degree which ActivePerl does (site & vendor are equiv; core is separate). Also, provide a rough implementation for separating the method of html generation between the html action and the ppmdist action. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.525 retrieving revision 1.526 diff -u -d -r1.525 -r1.526 --- Base.pm 21 Nov 2005 06:24:58 -0000 1.525 +++ Base.pm 22 Nov 2005 10:51:14 -0000 1.526 @@ -589,7 +589,6 @@ __PACKAGE__->add_property(build_elements => [qw(PL support pm xs pod script)]); __PACKAGE__->add_property(build_script => 'Build'); __PACKAGE__->add_property(config_dir => '_build'); -__PACKAGE__->add_property(html_css => ($^O =~ /Win32/) ? 'Active.css' : ''); __PACKAGE__->add_property(include_dirs => []); __PACKAGE__->add_property(installdirs => 'site'); __PACKAGE__->add_property(metafile => 'META.yml'); @@ -597,6 +596,11 @@ __PACKAGE__->add_property(use_rcfile => 1); { + my $Is_ActivePerl = eval {require ActivePerl::DocTools}; + __PACKAGE__->add_property(html_css => $Is_ActivePerl ? 'Active.css' : ''); +} + +{ my @prereq_action_types = qw(requires build_requires conflicts recommends); foreach my $type (@prereq_action_types) { __PACKAGE__->add_property($type => {}); @@ -2247,14 +2251,13 @@ } -# XXX This is wrong, wrong, wrong. -# 1) It assumes installation into site directories -# 2) If it's an ActiveState perl install, we need to run +# 1) If it's an ActiveState perl install, we need to run # ActivePerl::DocTools->UpdateTOC; -# 3) Links to other modules are not being generated +# 2) Links to other modules are not being generated sub htmlify_pods { my $self = shift; my $type = shift; + my $htmldir = shift || File::Spec->catdir($self->blib, "${type}html"); require Module::Build::PodParser; require Pod::Html; @@ -2265,19 +2268,19 @@ exclude => [ qr/\.(?:bat|com|html)$/ ] ); next unless %$pods; # nothing to do - my $podpath = join ':', - map $_->[1], - grep -e $_->[0], - map [File::Spec->catdir($self->blib, $_), $_], - qw( script lib ); - - my $htmldir = File::Spec->catdir($self->blib, "${type}html"); unless ( -d $htmldir ) { File::Path::mkpath($htmldir, 0, 0755) or die "Couldn't mkdir $htmldir: $!"; } - my @rootdirs = ($type eq 'bin') ? qw(bin) : qw(site lib); + my @rootdirs = ($type eq 'bin') ? qw(bin) : + $self->installdirs eq 'core' ? qw(lib) : qw(site lib); + + my $podpath = join ':', + map $_->[1], + grep -e $_->[0], + map [File::Spec->catdir($self->blib, $_), $_], + qw( script lib ); foreach my $pod ( keys %$pods ) { @@ -2297,7 +2300,9 @@ } my $path2root = join( '/', ('..') x (@rootdirs+@dirs) ); - my $htmlroot = "$path2root/site"; + my $htmlroot = join( '/', + ($path2root, + $self->installdirs eq 'core' ? () : qw(site) ) ); my $fh = IO::File->new($infile); my $abstract = Module::Build::PodParser->new(fh => $fh)->get_abstract(); @@ -2450,11 +2455,6 @@ $self->add_to_cleanup($file); } - -# TODO: This action should ideally generate html & manpages regardless -# of whether they would normally be generated on this platform so that -# they can be distributed in the ppm. However, this might throw things -# off if it is not immediately cleaned up. sub ACTION_ppmdist { my ($self) = @_; @@ -2472,11 +2472,13 @@ script => 'script', bindoc => 'man1', libdoc => 'man3', - binhtml => 'html', - libhtml => 'html', + binhtml => undef, + libhtml => undef, ); foreach my $type ($self->install_types) { + next if exists( $types{$type} ) && !defined( $types{$type} ); + my $dir = File::Spec->catdir( $self->blib, $type ); next unless -e $dir; @@ -2494,6 +2496,11 @@ } } + foreach my $type ( qw(bin lib) ) { + local $self->{properties}{html_css} = 'Active.css'; + $self->htmlify_pods( $type, File::Spec->catdir($ppm, 'blib', 'html') ); + } + # create a tarball; # the directory tar'ed must be blib so we need to do a chdir first my $start_wd = $self->cwd; |
From: Randy W. S. <si...@us...> - 2005-11-22 10:40:52
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30588/lib/Module/Build Modified Files: Authoring.pod Log Message: Fix broken link. Index: Authoring.pod =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Authoring.pod,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Authoring.pod 16 Nov 2005 00:07:42 -0000 1.23 +++ Authoring.pod 22 Nov 2005 10:40:43 -0000 1.24 @@ -700,7 +700,7 @@ C<'foo'>, then you must also define a method called C<process_foo_files()>. -See also L<Module::Build::Cookbook/"Adding new elements to the build process">. +See also L<Module::Build::Cookbook/"Adding new file types to the build process">. =item add_to_cleanup(@files) |
From: Randy W. S. <si...@us...> - 2005-11-21 06:25:11
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24399/lib/Module/Build Modified Files: Base.pm Log Message: Add tests for contents of the ppm distros we create to ensure everything is in the right place. May need platform tweaks. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.524 retrieving revision 1.525 diff -u -d -r1.524 -r1.525 --- Base.pm 21 Nov 2005 03:29:42 -0000 1.524 +++ Base.pm 21 Nov 2005 06:24:58 -0000 1.525 @@ -2450,6 +2450,11 @@ $self->add_to_cleanup($file); } + +# TODO: This action should ideally generate html & manpages regardless +# of whether they would normally be generated on this platform so that +# they can be distributed in the ppm. However, this might throw things +# off if it is not immediately cleaned up. sub ACTION_ppmdist { my ($self) = @_; |
From: Randy W. S. <si...@us...> - 2005-11-21 06:25:11
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24399/t Modified Files: manifypods.t xs.t Added Files: ppm.t Log Message: Add tests for contents of the ppm distros we create to ensure everything is in the right place. May need platform tweaks. Index: manifypods.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/manifypods.t,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- manifypods.t 21 Nov 2005 03:29:42 -0000 1.18 +++ manifypods.t 21 Nov 2005 06:24:58 -0000 1.19 @@ -157,7 +157,7 @@ ok !$mb2->get_action_docs('foo'); # Make sure those docs are the correct ones -foreach ('ppd', 'disttest') { +foreach ('testcover', 'disttest') { my $docs = $mb2->get_action_docs($_); like $docs, qr/=item $_/; unlike $docs, qr/\n=/, $docs; --- NEW FILE: ppm.t --- #!/usr/bin/perl -w use lib 't/lib'; use strict; use Test::More; unless ( eval {require Archive::Tar} ) { plan skip_all => "Archive::Tar not installed; can't test archives."; } else { plan tests => 9; } use File::Spec (); my $common_pl = File::Spec->catfile( 't', 'common.pl' ); require $common_pl; use Cwd (); my $cwd = Cwd::cwd; my $tmp = File::Spec->catdir( $cwd, 't', '_tmp' ); use DistGen; my $dist = DistGen->new( dir => $tmp, xs => 1 ); $dist->add_file( 'hello', <<'---' ); #!perl -w print "Hello, World!\n"; __END__ =pod =head1 NAME hello =head1 DESCRIPTION Says "Hello" =cut --- $dist->change_file( 'Build.PL', <<"---" ); use Module::Build; my \$build = new Module::Build( module_name => @{[$dist->name]}, license => 'perl', scripts => [ 'hello' ], ); \$build->create_build_script; --- $dist->regen; chdir( $dist->dirname ) or die "Can't chdir to '@{[$dist->dirname]}': $!"; use File::Spec::Functions qw(catdir); use Module::Build; my @installstyle = qw(lib perl5); my $mb = Module::Build->new_from_context( verbose => 0, quiet => 1, installdirs => 'site', config => { installsiteman1dir => catdir($tmp, 'site', 'man', 'man1'), installsiteman3dir => catdir($tmp, 'site', 'man', 'man3'), installsitehtml1dir => catdir($tmp, 'site', 'html'), installsitehtml3dir => catdir($tmp, 'site', 'html'), }, ); $mb->dispatch('ppd', args => {codebase => '/path/to/codebase-xs'}); (my $dist_filename = $dist->name) =~ s/::/-/g; my $ppd = slurp($dist_filename . '.ppd'); my $perl_version = Module::Build::PPMMaker->_ppd_version($mb->perl_version); my $varchname = Module::Build::PPMMaker->_varchname($mb->config); # This test is quite a hack since with XML you don't really want to # do a strict string comparison, but absent an XML parser it's the # best we can do. is $ppd, <<"---"; <SOFTPKG NAME="$dist_filename" VERSION="0,01,0,0"> <TITLE>@{[$dist->name]}</TITLE> <ABSTRACT>Perl extension for blah blah blah</ABSTRACT> <AUTHOR>A. U. Thor, a.u.thor\@a.galaxy.far.far.away</AUTHOR> <IMPLEMENTATION> <PERLCORE VERSION="$perl_version" /> <OS NAME="$^O" /> <ARCHITECTURE NAME="$varchname" /> <CODEBASE HREF="/path/to/codebase-xs" /> </IMPLEMENTATION> </SOFTPKG> --- $mb->dispatch('ppmdist'); is $@, ''; my $tar = Archive::Tar->new; my $tarfile = $mb->ppm_name . '.tar.gz'; $tar->read( $tarfile, 1 ); ok $tar->contains_file('blib/arch/auto/Simple/Simple.' . $mb->config('dlext')); ok $tar->contains_file('blib/lib/Simple.pm'); ok $tar->contains_file('blib/script/hello'); ok $tar->contains_file('blib/man3/Simple.' . $mb->config('man3ext')); ok $tar->contains_file('blib/man1/hello.' . $mb->config('man1ext')); ok $tar->contains_file('blib/html/site/lib/Simple.html'); ok $tar->contains_file('blib/html/bin/hello.html'); chdir( $cwd ) or die "Can''t chdir to '$cwd': $!"; $dist->remove; use File::Path; rmtree( $tmp ); Index: xs.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/xs.t,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -r1.32 -r1.33 --- xs.t 20 Oct 2005 16:45:19 -0000 1.32 +++ xs.t 21 Nov 2005 06:24:58 -0000 1.33 @@ -26,7 +26,7 @@ } elsif ( !$have_c_compiler ) { plan skip_all => 'C_support enabled, but no compiler found'; } else { - plan tests => 15; + plan tests => 14; } } @@ -90,32 +90,6 @@ eval {$mb->dispatch('test')}; is $@, ''; -{ - $mb->dispatch('ppd', args => {codebase => '/path/to/codebase-xs'}); - - (my $dist_filename = $dist->name) =~ s/::/-/g; - my $ppd = slurp($dist_filename . '.ppd'); - - my $perl_version = Module::Build::PPMMaker->_ppd_version($mb->perl_version); - my $varchname = Module::Build::PPMMaker->_varchname($mb->config); - - # This test is quite a hack since with XML you don't really want to - # do a strict string comparison, but absent an XML parser it's the - # best we can do. - is $ppd, <<"EOF"; -<SOFTPKG NAME="$dist_filename" VERSION="0,01,0,0"> - <TITLE>@{[$dist->name]}</TITLE> - <ABSTRACT>Perl extension for blah blah blah</ABSTRACT> - <AUTHOR>A. U. Thor, a.u.thor\@a.galaxy.far.far.away</AUTHOR> - <IMPLEMENTATION> - <PERLCORE VERSION="$perl_version" /> - <OS NAME="$^O" /> - <ARCHITECTURE NAME="$varchname" /> - <CODEBASE HREF="/path/to/codebase-xs" /> - </IMPLEMENTATION> -</SOFTPKG> -EOF -} SKIP: { skip( "skipping a couple Unixish-only tests", 2 ) |
From: Randy W. S. <si...@us...> - 2005-11-21 03:36:20
|
Update of /cvsroot/module-build/Module-Build/lib/Module In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28763/lib/Module Modified Files: Build.pm Log Message: Support for level 3 and level 4 headings are not supported by all Pod modules, notably the modules we use for create_readme. Index: Build.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build.pm,v retrieving revision 1.201 retrieving revision 1.202 diff -u -d -r1.201 -r1.202 --- Build.pm 17 Nov 2005 01:38:06 -0000 1.201 +++ Build.pm 21 Nov 2005 03:36:13 -0000 1.202 @@ -806,7 +806,9 @@ C<PREFIX>'s worldview. -=head3 Why PREFIX is not recommended +=over 4 + +=item Why PREFIX is not recommended =over 4 @@ -856,7 +858,7 @@ =back -=head3 Alternatives to PREFIX +=item Alternatives to PREFIX Module::Build offers L</install_base> as a simple, predictable, and user-configurable alternative to ExtUtils::MakeMaker's C<PREFIX>. @@ -890,6 +892,8 @@ See L</INSTALL PATHS> for details on other installation options available and how to configure them. +=back + =head1 MOTIVATIONS |
From: Randy W. S. <si...@us...> - 2005-11-21 03:29:50
|
Update of /cvsroot/module-build/Module-Build/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27422/t Modified Files: basic.t destinations.t install.t manifypods.t Log Message: Access hash type properties through their accessors when possible. Index: manifypods.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/manifypods.t,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- manifypods.t 14 Nov 2005 05:47:58 -0000 1.17 +++ manifypods.t 21 Nov 2005 03:29:42 -0000 1.18 @@ -95,8 +95,8 @@ sep => $mb->manpage_separator, dir1 => 'man1', dir3 => 'man3', - ext1 => $mb->{config}{man1ext}, - ext3 => $mb->{config}{man3ext}, + ext1 => $mb->config('man1ext'), + ext3 => $mb->config('man3ext'), ); my %distro = ( Index: install.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/install.t,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- install.t 14 Nov 2005 05:47:58 -0000 1.28 +++ install.t 21 Nov 2005 03:29:42 -0000 1.29 @@ -187,9 +187,12 @@ { # Make sure 'install_path' overrides 'install_base' - my $mb = Module::Build->new( module_name => $dist->name, - install_base => File::Spec->catdir('', 'foo'), - install_path => {lib => File::Spec->catdir('', 'bar')}); + my $mb = Module::Build->new( module_name => $dist->name, + install_base => File::Spec->catdir('', 'foo'), + install_path => { + lib => File::Spec->catdir('', 'bar') + } + ); ok $mb; is $mb->install_destination('lib'), File::Spec->catdir('', 'bar'); } Index: basic.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/basic.t,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -r1.47 -r1.48 --- basic.t 20 Oct 2005 09:26:42 -0000 1.47 +++ basic.t 21 Nov 2005 03:29:42 -0000 1.48 @@ -150,8 +150,8 @@ is $@, ''; my $mb = Module::Build->resume; - is $mb->config->{cc}, $Config{cc}; - is $mb->config->{foocakes}, 'barcakes'; + is $mb->config('cc'), $Config{cc}; + is $mb->config('foocakes'), 'barcakes'; # Test args(). is $mb->args('foo'), 1; Index: destinations.t =================================================================== RCS file: /cvsroot/module-build/Module-Build/t/destinations.t,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- destinations.t 14 Nov 2005 05:47:58 -0000 1.35 +++ destinations.t 21 Nov 2005 03:29:42 -0000 1.36 @@ -60,8 +60,6 @@ ); isa_ok( $mb, 'Module::Build::Base' ); -my $install_sets = $mb->install_sets; - # Get us into a known state. $mb->install_base(undef); $mb->prefix(undef); @@ -139,7 +137,7 @@ $mb->prefix( $prefix ); is( $mb->{properties}{prefix}, $prefix ); - test_prefix($prefix, $install_sets->{site}); + test_prefix($prefix, $mb->install_sets('site')); } |
From: Randy W. S. <si...@us...> - 2005-11-21 03:29:50
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27422/lib/Module/Build Modified Files: Base.pm Log Message: Access hash type properties through their accessors when possible. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.523 retrieving revision 1.524 diff -u -d -r1.523 -r1.524 --- Base.pm 21 Nov 2005 02:01:37 -0000 1.523 +++ Base.pm 21 Nov 2005 03:29:42 -0000 1.524 @@ -180,7 +180,7 @@ sub _set_install_paths { my $self = shift; - my $c = $self->{config}; + my $c = $self->config; my $p = $self->{properties}; my @libstyle = $c->{installstyle} ? @@ -323,7 +323,7 @@ sub find_perl_interpreter { return $^X if File::Spec->file_name_is_absolute($^X); my $proto = shift; - my $c = ref($proto) ? $proto->{config} : \%Config::Config; + my $c = ref($proto) ? $proto->config : \%Config::Config; my $exe = $c->{exe_ext}; my $thisperl = $^X; @@ -1098,7 +1098,7 @@ } } -sub _startperl { shift()->{config}{startperl} } +sub _startperl { shift()->config('startperl') } # Return any directories in @INC which are not in the default @INC for # this perl. For example, stuff passed in with -I or loaded with "use lib". @@ -2045,7 +2045,7 @@ sub fix_shebang_line { # Adapted from fixin() in ExtUtils::MM_Unix 1.35 my ($self, @files) = @_; - my $c = $self->{config}; + my $c = $self->config; my ($does_shbang) = $c->{sharpbang} =~ /^\s*\#\!/; for my $file (@files) { @@ -2125,8 +2125,8 @@ my $self = shift; my $type = shift; return ( $self->install_destination($type) && - ( $self->install_path->{$type} || - $self->install_sets->{$self->installdirs}{$type} ) + ( $self->install_path($type) || + $self->install_sets($self->installdirs)->{$type} ) ) ? 1 : 0; } @@ -2166,8 +2166,9 @@ File::Path::mkpath( $mandir, 0, 0777 ); foreach my $file (keys %$files) { - my $manpage = $self->man1page_name( $file ) . '.' . $self->{config}{man1ext}; - my $outfile = File::Spec->catfile( $mandir, $manpage); + my $manpage = $self->man1page_name( $file ) . '.' . + $self->config( 'man1ext' ); + my $outfile = File::Spec->catfile($mandir, $manpage); next if $self->up_to_date( $file, $outfile ); $self->log_info("Manifying $file -> $outfile\n"); $parser->parse_from_file( $file, $outfile ); @@ -2186,7 +2187,8 @@ File::Path::mkpath( $mandir, 0, 0777 ); while (my ($file, $relfile) = each %$files) { - my $manpage = $self->man3page_name( $relfile ) . '.' . $self->{config}{man3ext}; + my $manpage = $self->man3page_name( $relfile ) . '.' . + $self->config( 'man3ext' ); my $outfile = File::Spec->catfile( $mandir, $manpage); next if $self->up_to_date( $file, $outfile ); $self->log_info("Manifying $file -> $outfile\n"); @@ -2615,7 +2617,7 @@ die "Can't load Pod::Readme or Pod::Text to create README"; if ( my $docfile = $self->_main_docfile ) { $self->log_info("Creating README using " . ref($parser) . "\n"); - $parser->parse_from_file($self->_main_docfile, 'README', @_); + $parser->parse_from_file($docfile, 'README', @_); $self->_add_to_manifest('MANIFEST', 'README'); } else { $self->log_warn(<<EOF); @@ -2821,24 +2823,6 @@ } } -sub meta_add { - my ($self, %add) = @_; - my $m = $self->{properties}{meta_add}; - while (my($k, $v) = each %add) { - $m->{$k} = $v; - } - return $m; -} - -sub meta_merge { - my ($self, %merge) = @_; - my $m = $self->{properties}{meta_merge}; - while (my($k, $v) = each %merge) { - $self->_hash_merge($m, $k, $v); - } - return $m; -} - sub _hash_merge { my ($self, $h, $k, $v) = @_; if (ref $h->{$k} eq 'ARRAY') { @@ -2977,11 +2961,11 @@ }; - while (my($k, $v) = each %{$p->{meta_add}}) { + while (my($k, $v) = each %{$self->meta_add}) { $node->{$k} = $v; } - while (my($k, $v) = each %{$p->{meta_merge}}) { + while (my($k, $v) = each %{$self->meta_merge}) { $self->_hash_merge($node, $k, $v); } @@ -3190,10 +3174,10 @@ my ($self, $type) = @_; my $installdirs = $self->installdirs; - my $relpath = $self->install_sets->{$installdirs}{$type}; + my $relpath = $self->install_sets($installdirs)->{$type}; return $self->_prefixify($relpath, - $self->original_prefix->{$installdirs}, + $self->original_prefix($installdirs), $type, ); } @@ -3257,7 +3241,7 @@ sub install_destination { my ($self, $type) = @_; - return $self->install_path->{$type} if exists $self->install_path->{$type}; + return $self->install_path($type) if $self->install_path($type); if ( $self->install_base ) { my $relpath = $self->install_base_relpaths($type); @@ -3269,12 +3253,12 @@ return $relpath ? File::Spec->catdir($self->prefix, $relpath) : undef; } - return $self->install_sets->{ $self->installdirs }{$type}; + return $self->install_sets($self->installdirs)->{$type}; } sub install_types { my $self = shift; - my %types = (%{$self->install_path}, %{ $self->install_sets->{$self->installdirs} }); + my %types = (%{$self->install_path}, %{ $self->install_sets($self->installdirs) }); return sort keys %types; } @@ -3370,7 +3354,7 @@ unless $self->_mb_feature('C_support'); require ExtUtils::CBuilder; - return $p->{_cbuilder} = ExtUtils::CBuilder->new(config => $self->{config}); + return $p->{_cbuilder} = ExtUtils::CBuilder->new(config => $self->config); } sub have_c_compiler { @@ -3406,7 +3390,7 @@ sub link_c { my ($self, $to, $file_base) = @_; my $b = $self->_cbuilder; - my ($cf, $p) = ($self->{config}, $self->{properties}); # For convenience + my ($cf, $p) = ($self->config, $self->{properties}); # For convenience my $obj_file = "$file_base$cf->{obj_ext}"; @@ -3452,7 +3436,7 @@ } my $typemaps = join ' ', map qq{-typemap "$_"}, @typemaps; - my $cf = $self->{config}; + my $cf = $self->config; my $perl = $self->{properties}{perl}; my $command = (qq{$perl "-I$cf->{installarchlib}" "-I$cf->{installprivlib}" "$xsubpp" -noprototypes } . @@ -3500,7 +3484,7 @@ sub process_xs { my ($self, $file) = @_; - my $cf = $self->{config}; # For convenience + my $cf = $self->config; # For convenience # File name, minus the suffix (my $file_base = $file) =~ s/\.[^.]+$//; |
From: Randy W. S. <si...@us...> - 2005-11-21 02:01:46
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14212/lib/Module/Build Modified Files: Base.pm Log Message: Define properties as containing hash values. And sort some property lists. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.522 retrieving revision 1.523 diff -u -d -r1.522 -r1.523 --- Base.pm 21 Nov 2005 01:21:09 -0000 1.522 +++ Base.pm 21 Nov 2005 02:01:37 -0000 1.523 @@ -584,22 +584,16 @@ } # Add the default properties. -__PACKAGE__->add_property(module_name => ''); -__PACKAGE__->add_property(build_script => 'Build'); -__PACKAGE__->add_property(config_dir => '_build'); __PACKAGE__->add_property(blib => 'blib'); -__PACKAGE__->add_property('mb_version'); -__PACKAGE__->add_property(build_elements => [qw(PL support pm xs pod script)]); -__PACKAGE__->add_property(installdirs => 'site'); -__PACKAGE__->add_property(install_path => {}); -__PACKAGE__->add_property(include_dirs => []); -__PACKAGE__->add_property(config => {}); -__PACKAGE__->add_property(recurse_into => []); __PACKAGE__->add_property(build_class => 'Module::Build'); +__PACKAGE__->add_property(build_elements => [qw(PL support pm xs pod script)]); +__PACKAGE__->add_property(build_script => 'Build'); +__PACKAGE__->add_property(config_dir => '_build'); __PACKAGE__->add_property(html_css => ($^O =~ /Win32/) ? 'Active.css' : ''); -__PACKAGE__->add_property(meta_add => {}); -__PACKAGE__->add_property(meta_merge => {}); +__PACKAGE__->add_property(include_dirs => []); +__PACKAGE__->add_property(installdirs => 'site'); __PACKAGE__->add_property(metafile => 'META.yml'); +__PACKAGE__->add_property(recurse_into => []); __PACKAGE__->add_property(use_rcfile => 1); { @@ -610,44 +604,53 @@ __PACKAGE__->add_property(prereq_action_types => \@prereq_action_types); } +__PACKAGE__->add_property($_ => {}) for qw( + config + get_options + install_base_relpaths + install_path + install_sets + meta_add + meta_merge + original_prefix + prefix_relpaths +); + __PACKAGE__->add_property($_) for qw( - base_dir - dist_name - dist_version - dist_version_from - dist_author - dist_abstract - license - pm_files - xs_files - pod_files - PL_files - scripts - script_files - test_files - recursive_test_files - perl - has_config_data - install_sets - install_base_relpaths - original_prefix - prefix_relpaths - install_base - destdir - debugger - verbose - c_source - autosplit - create_makefile_pl - create_readme - pollute - extra_compiler_flags - extra_linker_flags - bindoc_dirs - libdoc_dirs - get_options - quiet - prefix + PL_files + autosplit + base_dir + bindoc_dirs + c_source + create_makefile_pl + create_readme + debugger + destdir + dist_abstract + dist_author + dist_name + dist_version + dist_version_from + extra_compiler_flags + extra_linker_flags + has_config_data + install_base + libdoc_dirs + license + mb_version + module_name + perl + pm_files + pod_files + pollute + prefix + quiet + recursive_test_files + script_files + scripts + test_files + verbose + xs_files ); @@ -1316,16 +1319,16 @@ (my $tr_opt = $opt) =~ tr/-/_/; return $tr_opt if grep $tr_opt =~ /^(?:no_?)?$_$/, qw( - install_path - html_css - meta_add - meta_merge - test_files - install_base create_makefile_pl create_readme extra_compiler_flags extra_linker_flags + html_css + install_base + install_path + meta_add + meta_merge + test_files use_rcfile ); # normalize only selected option names @@ -1353,12 +1356,12 @@ $opt = $self->_translate_option($opt); my @bool_opts = qw( - verbose create_readme pollute quiet - use_rcfile uninst + use_rcfile + verbose ); # inverted boolean options; eg --noverbose or --no-verbose |
From: Randy W. S. <si...@us...> - 2005-11-21 01:21:17
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8299/lib/Module/Build Modified Files: Base.pm Log Message: Extend property accessors for hashes to allow easy access to elements. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.521 retrieving revision 1.522 diff -u -d -r1.521 -r1.522 --- Base.pm 19 Nov 2005 04:36:48 -0000 1.521 +++ Base.pm 21 Nov 2005 01:21:09 -0000 1.522 @@ -342,8 +342,6 @@ return; } -sub base_dir { shift()->{properties}{base_dir} } - sub _is_interactive { return -t STDIN && (-t STDOUT || !(-f STDOUT || -c STDOUT)) ; # Pipe? } @@ -516,17 +514,44 @@ $valid_properties{$class}{$property} = $default; - if (my $type = ref $default) { + my $type = ref $default; + if ($type) { push @{$additive_properties{$class}->{$type}}, $property; } unless ($class->can($property)) { no strict 'refs'; - *{"$class\::$property"} = sub { - my $self = shift; - $self->{properties}{$property} = shift if @_; - return $self->{properties}{$property}; - }; + if ( $type eq 'HASH' ) { + *{"$class\::$property"} = sub { + my $self = shift; + my $x = ( $property eq 'config' ) ? $self : $self->{properties}; + return $x->{$property} unless @_; + + if ( defined($_[0]) && !ref($_[0]) ) { + if ( @_ == 1 ) { + return exists( $x->{$property}{$_[0]} ) ? + $x->{$property}{$_[0]} : undef; + } elsif ( @_ % 2 == 0 ) { + my %args = @_; + while ( my($k, $v) = each %args ) { + $x->{$property}{$k} = $v; + } + } else { + die "Unexpected arguments for property '$property'\n"; + } + } else { + $x->{$property} = $_[0]; + } + }; + + } else { + *{"$class\::$property"} = sub { + my $self = shift; + $self->{properties}{$property} = shift if @_; + return $self->{properties}{$property}; + } + } + } return $class; } @@ -834,13 +859,6 @@ $self->{phash}{$_}->write() foreach qw(notes cleanup features auto_features config_data runtime_params); } -sub config { shift()->{config} } - -sub requires { shift()->{properties}{requires} } -sub recommends { shift()->{properties}{recommends} } -sub build_requires { shift()->{properties}{build_requires} } -sub conflicts { shift()->{properties}{conflicts} } - sub check_autofeatures { my ($self) = @_; my $features = $self->auto_features; |
From: Randy W. S. <si...@us...> - 2005-11-19 04:36:57
|
Update of /cvsroot/module-build/Module-Build/lib/Module/Build In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28108/lib/Module/Build Modified Files: Base.pm Log Message: The 'ppmdist' action requires a specific directory structure which differs somewhat from ours. We rename a few directories and combine html directories all in a temporary directory, create the tarball, & cleanup. Index: Base.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build/Base.pm,v retrieving revision 1.520 retrieving revision 1.521 diff -u -d -r1.520 -r1.521 --- Base.pm 15 Nov 2005 09:49:48 -0000 1.520 +++ Base.pm 19 Nov 2005 04:36:48 -0000 1.521 @@ -2429,10 +2429,53 @@ sub ACTION_ppmdist { my ($self) = @_; - - $self->depends_on('build', 'ppd'); - $self->add_to_cleanup($self->ppm_name); - $self->make_tarball($self->blib, $self->ppm_name); + + $self->depends_on( 'build' ); + + my $ppm = $self->ppm_name; + $self->delete_filetree( $ppm ); + $self->log_info( "Creating $ppm\n" ); + $self->add_to_cleanup( $ppm, "$ppm.tar.gz" ); + + my %types = ( # translate types/dirs to those expected by ppm + lib => 'lib', + arch => 'arch', + bin => 'bin', + script => 'script', + bindoc => 'man1', + libdoc => 'man3', + binhtml => 'html', + libhtml => 'html', + ); + + foreach my $type ($self->install_types) { + my $dir = File::Spec->catdir( $self->blib, $type ); + next unless -e $dir; + + my $files = $self->rscan_dir( $dir ); + foreach my $file ( @$files ) { + next unless -f $file; + my $rel_file = + File::Spec->abs2rel( File::Spec->rel2abs( $file ), + File::Spec->rel2abs( $dir ) ); + my $to_file = + File::Spec->catdir( $ppm, 'blib', + exists( $types{$type} ) ? $types{$type} : $type, + $rel_file ); + $self->copy_if_modified( from => $file, to => $to_file ); + } + } + + # create a tarball; + # the directory tar'ed must be blib so we need to do a chdir first + my $start_wd = $self->cwd; + chdir( $ppm ) or die "Can't chdir to $ppm"; + $self->make_tarball( 'blib', File::Spec->catfile( $start_wd, $ppm ) ); + chdir( $start_wd ) or die "Can't chdir to $start_wd"; + + $self->depends_on( 'ppd' ); + + $self->delete_filetree( $ppm ); } sub ACTION_dist { |
From: Ken W. <kwi...@us...> - 2005-11-17 01:38:20
|
Update of /cvsroot/module-build/Module-Build/lib/Module In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1545/lib/Module Modified Files: Build.pm Log Message: Remove this old and somewhat meaningless text Index: Build.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build.pm,v retrieving revision 1.200 retrieving revision 1.201 diff -u -d -r1.200 -r1.201 --- Build.pm 17 Nov 2005 01:33:29 -0000 1.200 +++ Build.pm 17 Nov 2005 01:38:06 -0000 1.201 @@ -255,16 +255,6 @@ 'lib/something.PL' => ['/lib/something', '/lib/else'], 'lib/funny.PL' => [] } -Note that in contrast to MakeMaker, the C<build> action only -(currently) handles C<.pm>, C<.pod>, C<.PL>, and C<.xs> files. They -must all be in the C<lib/> directory, in the directory structure that -they should have when installed. We also handle C<.c> files that can -be in the place of your choosing - see the C<c_source> argument to -C<new()>. - -The C<.xs> support is currently in alpha. Please let me know whether -it works for you. - =item config_data ... |
From: Ken W. <kwi...@us...> - 2005-11-17 01:33:42
|
Update of /cvsroot/module-build/Module-Build/lib/Module In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv733/lib/Module Modified Files: Build.pm Log Message: Small edits to doc doc Index: Build.pm =================================================================== RCS file: /cvsroot/module-build/Module-Build/lib/Module/Build.pm,v retrieving revision 1.199 retrieving revision 1.200 diff -u -d -r1.199 -r1.200 --- Build.pm 16 Nov 2005 05:44:13 -0000 1.199 +++ Build.pm 17 Nov 2005 01:33:29 -0000 1.200 @@ -162,7 +162,7 @@ =item General Usage (L<Module::Build>) -This is the document your are currently reading. It describes basic +This is the document you are currently reading. It describes basic usage and background information. Its main purpose is to assist the user who wants to learn how to invoke and control C<Module::Build> scripts at the command line. @@ -170,7 +170,8 @@ =item Authoring Reference (L<Module::Build::Authoring>) This document describes the C<Module::Build> API for authors who are -writting F<Build.PL> scripts for a distribution. It describes the +writing F<Build.PL> scripts for a distribution or controlling +C<Module::Build> processes programmatically. It describes the methods available as well as providing general information on subclassing C<Module::Build> to alter and extend its behavior. Also, there is a section on controlling the Build process from other |