Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 194 lines (168 sloc) 5.846 kb
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
1 #!./perl -w
be61d08 Rafael Garcia-Suarez Make installman work with -Duserelocatableinc and DESTDIR
rgs authored
2 BEGIN {
9e6fc21 Merge common code from installperl and installman into install_lib.pl
Nicholas Clark authored
3 @INC = qw(lib);
ae5391a Florian Ragwitz Stop installing manpages for XS::APItest*
rafl authored
4
9e6fc21 Merge common code from installperl and installman into install_lib.pl
Nicholas Clark authored
5 # This needs to be at BEGIN time, before any use of Config
6 require './install_lib.pl';
be61d08 Rafael Garcia-Suarez Make installman work with -Duserelocatableinc and DESTDIR
rgs authored
7 }
9e6fc21 Merge common code from installperl and installman into install_lib.pl
Nicholas Clark authored
8 use strict;
be61d08 Rafael Garcia-Suarez Make installman work with -Duserelocatableinc and DESTDIR
rgs authored
9
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
10 use Getopt::Long;
3301e5d Some tidying in installman.
Nicholas Clark authored
11 require File::Path;
354f3b5 PATCH for 5.004_62 : Add .packlist handling classes to ExtUtils
Alan Burlison authored
12 use ExtUtils::Packlist;
a274383 Michael G. Schwern Using Pod::Man instead of pod2man
schwern authored
13 use Pod::Man;
d026567 Various installman cleanups.
Nicholas Clark authored
14 use vars qw(%opts $packlist);
791b4ad [ID 20010621.002] UnixWare 7.1.1 and Perl-5.6.1 problems
0000-Admin authored
15
d6a39ee installman should use the data in pod.lst to track dual-life pods in lib...
Nicholas Clark authored
16 require './Porting/pod_lib.pl';
1cb2462 Avoid installman warning about "no documentation in pod/perldoc.pod"
Nicholas Clark authored
17 my %man1 = (map {($_->[0], $_->[1])} @{get_pod_metadata()->{master}});
d6a39ee installman should use the data in pod.lst to track dual-life pods in lib...
Nicholas Clark authored
18
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
19 $ENV{SHELL} = 'sh' if $^O eq 'os2';
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
20
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
21 my $patchlevel = substr($],3,2);
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
22 die "Patchlevel of perl ($patchlevel)",
cceca5e propagate PERL_VERSION everywhere, add to pod
Gurusamy Sarathy authored
23 "and patchlevel of config.sh ($Config{'PERL_VERSION'}) don't match\n"
24 if $patchlevel != $Config{'PERL_VERSION'};
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
25
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
26 my $usage =
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
27 "Usage: installman --man1dir=/usr/wherever --man1ext=1
b5f0501 Abigail More silencing of installman.
Abigail authored
28 --man3dir=/usr/wherever --man3ext=3
eabd589 Abigail Re: [PATCH] More silencing of installman.
Abigail authored
29 --notify --verbose --silent --help
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
30 Defaults are:
31 man1dir = $Config{'installman1dir'};
32 man1ext = $Config{'man1ext'};
33 man3dir = $Config{'installman3dir'};
34 man3ext = $Config{'man3ext'};
eabd589 Abigail Re: [PATCH] More silencing of installman.
Abigail authored
35 --notify (or -n) just lists commands that would be executed.
36 --verbose (or -V) report all progress.
37 --silent (or -S) be silent. Only report errors.\n";
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
38
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
39 GetOptions( \%opts,
d026567 Various installman cleanups.
Nicholas Clark authored
40 qw( man1dir=s man1ext=s man3dir=s man3ext=s
ae5391a Florian Ragwitz Stop installing manpages for XS::APItest*
rafl authored
41 destdir:s notify n help silent S verbose V))
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
42 || die $usage;
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
43 die $usage if $opts{help};
02bc0c0 Rafael Garcia-Suarez Remove old Pod::Man parser creation.
rgs authored
44 $opts{destdir} //= '';
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
45
3cc5758 A couple more installman tidy ups.
Nicholas Clark authored
46 foreach my $pre (qw(man1 man3)) {
47 $opts{"${pre}dir"} //= $opts{destdir} . $Config{"install${pre}dir"};
48 $opts{"${pre}ext"} //= $Config{"${pre}ext"};
49 }
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
50 $opts{silent} ||= $opts{S};
51 $opts{notify} ||= $opts{n};
4ad019e Abigail no-install target a la make -n.
Abigail authored
52 $opts{verbose} ||= $opts{V} || $opts{notify};
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
53
54 #Sanity checks
55
ae5391a Florian Ragwitz Stop installing manpages for XS::APItest*
rafl authored
56 -x "./perl$Config{exe_ext}"
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
57 or warn "./perl$Config{exe_ext} not found! Have you run make?\n";
5a9231b DESTDIR in perl-5.8.1 package?
Michael Schroeder authored
58 -d "$opts{destdir}$Config{'installprivlib'}"
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
59 || warn "Perl library directory $Config{'installprivlib'} not found.
60 Have you run make install?. (Installing anyway.)\n";
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
61 -x "t/perl$Config{exe_ext}" || warn "WARNING: You've never run 'make test'!!!",
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
62 " (Installing anyway.)\n";
63
1ef57a5 jhi Make consistent with installperl (and working in MPE/iX)
jhi authored
64 $packlist = ExtUtils::Packlist->new("$opts{destdir}$Config{installarchlib}/.packlist");
354f3b5 PATCH for 5.004_62 : Add .packlist handling classes to ExtUtils
Alan Burlison authored
65
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
66 # Install the main pod pages.
1cb2462 Avoid installman warning about "no documentation in pod/perldoc.pod"
Nicholas Clark authored
67 pod2man(\%man1, $opts{man1dir}, $opts{man1ext}, 'pod');
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
68
69 # Install the pods for library modules.
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
70 {
9bbb230 Move the common Pod scanning code from installman and buildtoc to pod_li...
Nicholas Clark authored
71 my $found = pods_to_install();
72 pod2man($found->{$_}, $opts{man3dir}, $opts{man3ext}, 'lib')
73 foreach qw(MODULE PRAGMA);
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
74 }
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
75
1fef88e Pod typos, pod2man bugs, and miscellaneous installation comments
Joseph S. Myers authored
76 # Install the pods embedded in the installed scripts
bf1ee2b jhi Skip the link= directives of utils.lst if no mandir
jhi authored
77 my $has_man1dir = $opts{man1dir} ne '' && -d $opts{man1dir};
3301e5d Some tidying in installman.
Nicholas Clark authored
78 my $fh = open_or_die('utils.lst');
79 while (<$fh>) {
21dae8a Re: [PATCH] Abstract "utility" information from installman
Simon Cozens authored
80 next if /^#/;
81 chomp;
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
82 my ($path, $leaf) = m|^(\S*/(\S+))|;
e1aae8e Add x2p/a2p.pod to the 'master' array returned by get_pod_metadata().
Nicholas Clark authored
83 # Have we already installed the manpage for this? (eg perldoc, a2p)
1cb2462 Avoid installman warning about "no documentation in pod/perldoc.pod"
Nicholas Clark authored
84 next if $man1{$leaf};
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
85 pod2man({$leaf, $path}, $opts{man1dir}, $opts{man1ext});
bf1ee2b jhi Skip the link= directives of utils.lst if no mandir
jhi authored
86 if ($has_man1dir) {
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
87 if (my ($link) = m|#.*link\s*=\s*\S+/(\S+)|) {
88 my $old = "$opts{man1dir}/$leaf.$opts{man1ext}";
89 my $new = "$opts{man1dir}/$link.$opts{man1ext}";
bf1ee2b jhi Skip the link= directives of utils.lst if no mandir
jhi authored
90 unlink($new);
91 link($old, $new);
3301e5d Some tidying in installman.
Nicholas Clark authored
92 $old =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
93 $new =~ s/^\Q$opts{destdir}\E// if $opts{destdir};
94 $packlist->{$new} = { from => $old, type => 'link' };
bf1ee2b jhi Skip the link= directives of utils.lst if no mandir
jhi authored
95 }
21dae8a Re: [PATCH] Abstract "utility" information from installman
Simon Cozens authored
96 }
97 }
3301e5d Some tidying in installman.
Nicholas Clark authored
98 close $fh or my_die("close 'utils.lst': $!");
1fef88e Pod typos, pod2man bugs, and miscellaneous installation comments
Joseph S. Myers authored
99
a274383 Michael G. Schwern Using Pod::Man instead of pod2man
schwern authored
100 sub pod2man {
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
101 my($modpods, $mandir, $manext, $where) = @_;
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
102 if ($mandir eq ' ' or $mandir eq '') {
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
103 if ($where) {
104 warn "Skipping installation of $where man pages.\n"
105 } else {
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
106 warn "Skipping installation of $_ man page.\n"
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
107 foreach values %$modpods;
108 }
109 return;
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
110 }
111
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
112 if ($opts{verbose}) {
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
113 if ($where) {
114 print "installing from $where\n";
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
115 } else {
45a365e In installman, move the call to File::Find::find() to the top level.
Nicholas Clark authored
116 print "installing $_\n"
117 foreach sort keys %$modpods;
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
118 }
119 }
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
120
3301e5d Some tidying in installman.
Nicholas Clark authored
121 File::Path::mkpath($mandir, $opts{verbose}, 0777) unless $opts{notify};
b3e335c In installman, pod2man() now takes a hashref instead of a list of script...
Nicholas Clark authored
122
123 foreach my $manpage (sort keys %$modpods) {
124 my $mod = $modpods->{$manpage};
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
125
63fae90 Debian patch that skips podless modules
Alexey Tourbin authored
126 # Skip files without pod docs
127 my $has_pod;
3301e5d Some tidying in installman.
Nicholas Clark authored
128 my $fh = open_or_die($mod);
129 while (my $line = <$fh>) {
130 if ($line =~ /^=head1\b/) {
131 ++$has_pod;
132 last;
133 }
134 }
135 close $fh or my_die("close '$mod': $!");
136 # Sadly it doesn't seem possible to re-use this handle for the call
137 # to parse_from_file() below, as Pod::Man relies on source_filename(),
138 # which Pod::Simple only sets accurately if it opens the file itself.
63fae90 Debian patch that skips podless modules
Alexey Tourbin authored
139
140 unless ($has_pod)
141 {
142 warn "no documentation in $mod\n";
143 next;
144 }
145
4fabb59 cygwin update (from Eric Fifer <EFifer@sanwaint.com>)
Gurusamy Sarathy authored
146 if ($^O eq 'os2' || $^O eq 'amigaos' || $^O eq 'uwin' || $^O eq 'cygwin') {
107ea3f Refactor installman's use of File::Find::find() to converge with buildto...
Nicholas Clark authored
147 $manpage =~ s#::#.#g;
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
148 }
d026567 Various installman cleanups.
Nicholas Clark authored
149 my $tmp = "${mandir}/${manpage}.tmp";
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
150 $manpage = "${mandir}/${manpage}.${manext}";
a274383 Michael G. Schwern Using Pod::Man instead of pod2man
schwern authored
151
571afc3 Steve Peters Change installman to instantiate a new Pod::Man instance for each
smpeters authored
152 my $parser = Pod::Man->new( section => $manext,
153 official=> 1,
154 center => 'Perl Programmers Reference Guide'
155 );
5a9231b DESTDIR in perl-5.8.1 package?
Michael Schroeder authored
156 my $xmanpage = $manpage;
157 $xmanpage =~ s/^\Q$opts{'destdir'}\E// if $opts{'destdir'};
158 print " $xmanpage\n";
d026567 Various installman cleanups.
Nicholas Clark authored
159 if (!$opts{notify} && $parser->parse_from_file($mod, $tmp)) {
a274383 Michael G. Schwern Using Pod::Man instead of pod2man
schwern authored
160 if (-s $tmp) {
161 if (rename($tmp, $manpage)) {
5a9231b DESTDIR in perl-5.8.1 package?
Michael Schroeder authored
162 $packlist->{$xmanpage} = { type => 'file' };
a274383 Michael G. Schwern Using Pod::Man instead of pod2man
schwern authored
163 next;
164 }
165 }
166 unlink($tmp);
6d64b06 Hallvard Furuseth installman patch: Dont remove manpages unless the new one is good
hfuru authored
167 }
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
168 }
169 }
170
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
171 $packlist->write() unless $opts{notify};
172 print " Installation complete\n" if $opts{verbose};
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
173
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
174 sub rename {
f0512cd [PATCH @6820] installman under -w and strict (was Re: [PATCH] More silen...
Daniel Chetlin authored
175 my($from,$to) = @_;
55a105f [ID 20001004.003] installman "Ambiguous call resolved as CORE::"
nick@babyhippo.com authored
176 if (-f $to and not unlink($to)) {
72b3d9b install all README.foo with pod content as podfoo.pod
Gurusamy Sarathy authored
177 my($i);
178 for ($i = 1; $i < 50; $i++) {
179 last if CORE::rename($to, "$to.$i");
180 }
19f4563 James E Keenan [RT #36079] Convert ` to '.
jkeenan authored
181 warn("Cannot rename to '$to.$i': $!"), return 0
72b3d9b install all README.foo with pod content as podfoo.pod
Gurusamy Sarathy authored
182 if $i >= 50; # Give up!
cd8bccb Update OS/2 support, and first-pass general cleanup
Perl 5 Porters authored
183 }
55a105f [ID 20001004.003] installman "Ambiguous call resolved as CORE::"
nick@babyhippo.com authored
184 link($from,$to) || return 0;
185 unlink($from);
16d20bd This is my patch patch.1i for perl5.001.
Andy Dougherty authored
186 }
5a6ebf5 installman only needs match =head1 to identify files with Pod.
Nicholas Clark authored
187
188 # Local variables:
189 # cperl-indent-level: 4
190 # indent-tabs-mode: nil
191 # End:
192 #
193 # ex: set ts=8 sts=4 sw=4 et:
Something went wrong with that request. Please try again.