stas 2004/08/15 03:08:30
Modified: . Changes lib/ModPerl BuildMM.pm todo release Log: pod manpages are now glued to all .pm files for which .pod exists Revision Changes Path 1.447 +3 -0 modperl-2.0/Changes Index: Changes =================================================================== RCS file: /home/cvs/modperl-2.0/Changes,v retrieving revision 1.446 retrieving revision 1.447 diff -u -u -r1.446 -r1.447 --- Changes 15 Aug 2004 00:20:34 -0000 1.446 +++ Changes 15 Aug 2004 10:08:30 -0000 1.447 @@ -12,6 +12,9 @@ =item 1.99_15-dev +pod manpages are now glued to all .pm files for which .pod exists +[Stas] + Apache::RequestIO::sendfile() now indicates which file it has failed to open on failure. [Stas] 1.19 +71 -14 modperl-2.0/lib/ModPerl/BuildMM.pm Index: BuildMM.pm =================================================================== RCS file: /home/cvs/modperl-2.0/lib/ModPerl/BuildMM.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -u -u -r1.18 -r1.19 --- BuildMM.pm 1 Aug 2004 19:44:00 -0000 1.18 +++ BuildMM.pm 15 Aug 2004 10:08:30 -0000 1.19 @@ -21,6 +21,7 @@ use Cwd (); use File::Spec::Functions qw(catdir catfile splitdir); use File::Basename; +use File::Find; use Apache::Build (); use ModPerl::MM; @@ -170,7 +171,8 @@ my $self = shift; my $string = $self->MM::top_targets; - ModPerl::MM::add_dep_after(\$string, "pure_all", pm_to_blib => 'glue_pods'); + ModPerl::MM::add_dep_after(\$string, "pure_all", + linkext => 'glue_pods'); return $string; } @@ -182,21 +184,72 @@ my @targets = (); - # add the code to glue the existing pods to the .pm files in blib - my @target = ('glue_pods:'); + # reasons for glueing pods to the respective .pm files: + # - manpages will get installed over the mp1 manpages and vice + # versa. glueing pods avoids creation of manpages, but may be we + # could just tell make to skip manpages creation? + # if pods are installed directly they need to be also redirected, + # some into Apache2/ others (e.g. Apache2) not + + # add the code to glue the existing pods to the .pm files in blib. + # create a dependency on pm_to_blib subdirs linkext targets to + # allow 'make -j' + my @target = ('glue_pods: pm_to_blib subdirs linkext'); if (-d $doc_root) { - while (my ($pm, $blib) = each %{$self->{PM}}) { - my $pod = catdir( - (splitdir($blib))[-2 .. -1]); - $pod =~ s/\.pm/\.pod/; - my $podpath = catfile $doc_root, $pod; - next unless -r $podpath; - - push @target, - '$(FULLPERL) -I$(INST_LIB) ' . - "-I$apache_test_dir -MModPerl::BuildMM " . - "-e ModPerl::BuildMM::glue_pod $pm $podpath $blib"; + my $build = build_config(); + + # those living in modperl-2.0/lib are already nicely mapped + my %pms = %{ $self->{PM} }; + + my $cwd = Cwd::getcwd(); + my $blib_dir = catdir qw(blib lib); + $blib_dir = catdir $blib_dir, "Apache2" + if $build->{MP_INST_APACHE2}; + + # those autogenerated under WrapXS/ + # those living under xs/ + # those living under ModPerl-Registry/lib/ + my @src = ('WrapXS', 'xs', catdir(qw(ModPerl-Registry lib))); + + for my $base (@src) { + chdir $base; + my @files = (); + find({ no_chdir => 1, + wanted => sub { push @files, $_ if /.pm$/ }, + }, "."); + chdir $cwd; + + for (@files) { + my $pm = catfile $base, $_; + my $blib; + if ($base =~ /^(xs|WrapXS)/) { + my @segm = splitdir $_; + splice @segm, -2, 1; # xs/APR/Const/Const.pm + splice @segm, -2, 1 if /APR.pm/; # odd case + $blib = catfile $blib_dir, @segm; + } + else { + $blib = catfile $blib_dir, $_; + } + $pms{$pm} = $blib; + } + } + + while (my($pm, $blib) = each %pms) { + my @segm = splitdir $blib; + for my $i (1..2) { + # try APR.pm and APR/Bucket.pm + my $pod = catdir(@segm[-$i .. -1]); + $pod =~ s/\.pm/\.pod/; + my $podpath = catfile $doc_root, $pod; + next unless -r $podpath; + + push @target, + '$(FULLPERL) -I$(INST_LIB) ' . + "-I$apache_test_dir -MModPerl::BuildMM " . + "-e ModPerl::BuildMM::glue_pod $pm $podpath $blib"; + } } push @target, $self->{NOECHO} . '$(TOUCH) $@'; @@ -221,6 +274,9 @@ die "expecting 3 arguments: pm, pod, dst" unless @ARGV == 3; my($pm, $pod, $dst) = @ARGV; + die "glue_pod: can't find $pm" unless -e $pm; + die "glue_pod: can't find $dst" unless -e $dst; + # have we already glued the doc? exit 0 unless -s $pm == -s $dst; @@ -232,6 +288,7 @@ chmod $rw_mode, $dst or die "Can't chmod $rw_mode $dst: $!"; open my $pod_fh, "<$pod" or die "Can't open $pod: $!"; open my $dst_fh, ">>$dst" or die "Can't open $dst: $!"; + print $dst_fh "\n"; # must add one line separation print $dst_fh (<$pod_fh>); close $pod_fh; close $dst_fh; 1.47 +0 -11 modperl-2.0/todo/release Index: release =================================================================== RCS file: /home/cvs/modperl-2.0/todo/release,v retrieving revision 1.46 retrieving revision 1.47 diff -u -u -r1.46 -r1.47 --- release 15 Aug 2004 07:55:52 -0000 1.46 +++ release 15 Aug 2004 10:08:30 -0000 1.47 @@ -48,17 +48,6 @@ the issues and thinks he knows how to fix it, he just needs the time. owner: geoff -* it looks like glue_pod is not working anymore, consider dropping it - completely and simply install .pod files along with .pm ones. In - which case we need to arrange for Makefile.PL to traverse into - docs/api/ and grab those pod files. See how the Template package - does that. - - in any case we now have .pod manpages for non-existing .pm files, so - in case we don't install .pod files as is, we may need to make a - special case for those .pod files. So it's probably better to just - install all .pod files w/o glueing them to .pm files. - * some autogenerated record accessors shouldn't be get/set but only get (e.g. Apache->server->is_virtual(1) is wrong). Need to add a new flag supported by MapUtil and map files, where we can say which