line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ExtUtils::Install; |
2
|
3
|
|
|
3
|
|
416490
|
use strict; |
|
3
|
|
|
|
|
26
|
|
|
3
|
|
|
|
|
112
|
|
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
18
|
use Config qw(%Config); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
137
|
|
5
|
3
|
|
|
3
|
|
16
|
use Cwd qw(cwd); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
174
|
|
6
|
3
|
|
|
3
|
|
23
|
use Exporter (); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
74
|
|
7
|
3
|
|
|
3
|
|
16
|
use File::Basename qw(dirname); |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
204
|
|
8
|
3
|
|
|
3
|
|
1731
|
use File::Copy; |
|
3
|
|
|
|
|
9683
|
|
|
3
|
|
|
|
|
189
|
|
9
|
3
|
|
|
3
|
|
24
|
use File::Path; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
184
|
|
10
|
3
|
|
|
3
|
|
32
|
use File::Spec; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
694
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @ISA = ('Exporter'); |
13
|
|
|
|
|
|
|
our @EXPORT = ('install','uninstall','pm_to_blib', 'install_default'); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our $MUST_REBOOT; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=pod |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 NAME |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
ExtUtils::Install - install files from here to there |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
=head1 SYNOPSIS |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
use ExtUtils::Install; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
install({ 'blib/lib' => 'some/install/dir' } ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
uninstall($packlist); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
pm_to_blib({ 'lib/Foo/Bar.pm' => 'blib/lib/Foo/Bar.pm' }); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 VERSION |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
2.18 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
our $VERSION = '2.18'; # <-- do not forget to update the POD section just above this line! |
40
|
|
|
|
|
|
|
$VERSION = eval $VERSION; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=pod |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head1 DESCRIPTION |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
Handles the installing and uninstalling of perl modules, scripts, man |
47
|
|
|
|
|
|
|
pages, etc... |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Both install() and uninstall() are specific to the way |
50
|
|
|
|
|
|
|
ExtUtils::MakeMaker handles the installation and deinstallation of |
51
|
|
|
|
|
|
|
perl modules. They are not designed as general purpose tools. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
On some operating systems such as Win32 installation may not be possible |
54
|
|
|
|
|
|
|
until after a reboot has occurred. This can have varying consequences: |
55
|
|
|
|
|
|
|
removing an old DLL does not impact programs using the new one, but if |
56
|
|
|
|
|
|
|
a new DLL cannot be installed properly until reboot then anything |
57
|
|
|
|
|
|
|
depending on it must wait. The package variable |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
$ExtUtils::Install::MUST_REBOOT |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
is used to store this status. |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
If this variable is true then such an operation has occurred and |
64
|
|
|
|
|
|
|
anything depending on this module cannot proceed until a reboot |
65
|
|
|
|
|
|
|
has occurred. |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
If this value is defined but false then such an operation has |
68
|
|
|
|
|
|
|
ocurred, but should not impact later operations. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=over |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=begin _private |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=item _chmod($$;$) |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Wrapper to chmod() for debugging and error trapping. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=item _warnonce(@) |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
Warns about something only once. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=item _choke(@) |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Dies with a special message. |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=back |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=end _private |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=cut |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
BEGIN { |
93
|
3
|
50
|
|
3
|
|
23
|
*_Is_VMS = $^O eq 'VMS' ? sub(){1} : sub(){0}; |
94
|
3
|
50
|
|
|
|
12
|
*_Is_Win32 = $^O eq 'MSWin32' ? sub(){1} : sub(){0}; |
95
|
3
|
50
|
|
|
|
9
|
*_Is_cygwin = $^O eq 'cygwin' ? sub(){1} : sub(){0}; |
96
|
3
|
50
|
33
|
|
|
17379
|
*_CanMoveAtBoot = ($^O eq 'MSWin32' || $^O eq 'cygwin') ? sub(){1} : sub(){0}; |
97
|
|
|
|
|
|
|
} |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
my $Inc_uninstall_warn_handler; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# install relative to here |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
my $INSTALL_ROOT = $ENV{PERL_INSTALL_ROOT}; |
104
|
|
|
|
|
|
|
my $INSTALL_QUIET = $ENV{PERL_INSTALL_QUIET}; |
105
|
|
|
|
|
|
|
$INSTALL_QUIET = 1 |
106
|
|
|
|
|
|
|
if (!exists $ENV{PERL_INSTALL_QUIET} and |
107
|
|
|
|
|
|
|
defined $ENV{MAKEFLAGS} and |
108
|
|
|
|
|
|
|
$ENV{MAKEFLAGS} =~ /\b(s|silent|quiet)\b/); |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
my $Curdir = File::Spec->curdir; |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
sub _estr(@) { |
113
|
0
|
|
|
0
|
|
0
|
return join "\n",'!' x 72,@_,'!' x 72,''; |
114
|
|
|
|
|
|
|
} |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
{my %warned; |
117
|
|
|
|
|
|
|
sub _warnonce(@) { |
118
|
0
|
|
|
0
|
|
0
|
my $first=shift; |
119
|
0
|
|
|
|
|
0
|
my $msg=_estr "WARNING: $first",@_; |
120
|
0
|
0
|
|
|
|
0
|
warn $msg unless $warned{$msg}++; |
121
|
|
|
|
|
|
|
}} |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
sub _choke(@) { |
124
|
0
|
|
|
0
|
|
0
|
my $first=shift; |
125
|
0
|
|
|
|
|
0
|
my $msg=_estr "ERROR: $first",@_; |
126
|
0
|
|
|
|
|
0
|
require Carp; |
127
|
0
|
|
|
|
|
0
|
Carp::croak($msg); |
128
|
|
|
|
|
|
|
} |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
sub _croak { |
131
|
0
|
|
|
0
|
|
0
|
require Carp; |
132
|
0
|
|
|
|
|
0
|
Carp::croak(@_); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
sub _confess { |
135
|
0
|
|
|
0
|
|
0
|
require Carp; |
136
|
0
|
|
|
|
|
0
|
Carp::confess(@_); |
137
|
|
|
|
|
|
|
} |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
sub _compare { |
140
|
17
|
|
|
17
|
|
790
|
require File::Compare; |
141
|
17
|
|
|
|
|
1174
|
File::Compare::compare(@_); |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
sub _chmod($$;$) { |
146
|
15
|
|
|
15
|
|
74
|
my ( $mode, $item, $verbose )=@_; |
147
|
15
|
|
50
|
|
|
213
|
$verbose ||= 0; |
148
|
15
|
100
|
|
|
|
249
|
if (chmod $mode, $item) { |
149
|
13
|
50
|
|
|
|
79
|
printf "chmod(0%o, %s)\n",$mode, $item if $verbose > 1; |
150
|
|
|
|
|
|
|
} else { |
151
|
2
|
|
|
|
|
38
|
my $err="$!"; |
152
|
2
|
50
|
|
|
|
36
|
_warnonce sprintf "WARNING: Failed chmod(0%o, %s): %s\n", |
153
|
|
|
|
|
|
|
$mode, $item, $err |
154
|
|
|
|
|
|
|
if -e $item; |
155
|
|
|
|
|
|
|
} |
156
|
|
|
|
|
|
|
} |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=begin _private |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=over |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
=item _move_file_at_boot( $file, $target, $moan ) |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
OS-Specific, Win32/Cygwin |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
Schedules a file to be moved/renamed/deleted at next boot. |
167
|
|
|
|
|
|
|
$file should be a filespec of an existing file |
168
|
|
|
|
|
|
|
$target should be a ref to an array if the file is to be deleted |
169
|
|
|
|
|
|
|
otherwise it should be a filespec for a rename. If the file is existing |
170
|
|
|
|
|
|
|
it will be replaced. |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Sets $MUST_REBOOT to 0 to indicate a deletion operation has occurred |
173
|
|
|
|
|
|
|
and sets it to 1 to indicate that a move operation has been requested. |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
returns 1 on success, on failure if $moan is false errors are fatal. |
176
|
|
|
|
|
|
|
If $moan is true then returns 0 on error and warns instead of dies. |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=end _private |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
=cut |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
{ |
183
|
|
|
|
|
|
|
my $Has_Win32API_File; |
184
|
|
|
|
|
|
|
sub _move_file_at_boot { #XXX OS-SPECIFIC |
185
|
0
|
|
|
0
|
|
0
|
my ( $file, $target, $moan )= @_; |
186
|
0
|
|
|
|
|
0
|
_confess("Panic: Can't _move_file_at_boot on this platform!") |
187
|
|
|
|
|
|
|
unless _CanMoveAtBoot; |
188
|
|
|
|
|
|
|
|
189
|
0
|
0
|
|
|
|
0
|
my $descr= ref $target |
190
|
|
|
|
|
|
|
? "'$file' for deletion" |
191
|
|
|
|
|
|
|
: "'$file' for installation as '$target'"; |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
# *note* _CanMoveAtBoot is only incidentally the same condition as below |
194
|
|
|
|
|
|
|
# this needs not hold true in the future. |
195
|
|
|
|
|
|
|
$Has_Win32API_File = (_Is_Win32 || _Is_cygwin) |
196
|
0
|
0
|
|
|
|
0
|
? (eval {require Win32API::File; 1} || 0) |
197
|
|
|
|
|
|
|
: 0 unless defined $Has_Win32API_File; |
198
|
0
|
0
|
|
|
|
0
|
if ( ! $Has_Win32API_File ) { |
199
|
|
|
|
|
|
|
|
200
|
0
|
|
|
|
|
0
|
my @msg=( |
201
|
|
|
|
|
|
|
"Cannot schedule $descr at reboot.", |
202
|
|
|
|
|
|
|
"Try installing Win32API::File to allow operations on locked files", |
203
|
|
|
|
|
|
|
"to be scheduled during reboot. Or try to perform the operation by", |
204
|
|
|
|
|
|
|
"hand yourself. (You may need to close other perl processes first)" |
205
|
|
|
|
|
|
|
); |
206
|
0
|
0
|
|
|
|
0
|
if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
207
|
0
|
|
|
|
|
0
|
return 0; |
208
|
|
|
|
|
|
|
} |
209
|
0
|
|
|
|
|
0
|
my $opts= Win32API::File::MOVEFILE_DELAY_UNTIL_REBOOT(); |
210
|
0
|
0
|
|
|
|
0
|
$opts= $opts | Win32API::File::MOVEFILE_REPLACE_EXISTING() |
211
|
|
|
|
|
|
|
unless ref $target; |
212
|
|
|
|
|
|
|
|
213
|
0
|
|
|
|
|
0
|
_chmod( 0666, $file ); |
214
|
0
|
0
|
|
|
|
0
|
_chmod( 0666, $target ) unless ref $target; |
215
|
|
|
|
|
|
|
|
216
|
0
|
0
|
|
|
|
0
|
if (Win32API::File::MoveFileEx( $file, $target, $opts )) { |
217
|
0
|
0
|
0
|
|
|
0
|
$MUST_REBOOT ||= ref $target ? 0 : 1; |
218
|
0
|
|
|
|
|
0
|
return 1; |
219
|
|
|
|
|
|
|
} else { |
220
|
0
|
|
|
|
|
0
|
my @msg=( |
221
|
|
|
|
|
|
|
"MoveFileEx $descr at reboot failed: $^E", |
222
|
|
|
|
|
|
|
"You may try to perform the operation by hand yourself. ", |
223
|
|
|
|
|
|
|
"(You may need to close other perl processes first).", |
224
|
|
|
|
|
|
|
); |
225
|
0
|
0
|
|
|
|
0
|
if ( $moan ) { _warnonce(@msg) } else { _choke(@msg) } |
|
0
|
|
|
|
|
0
|
|
|
0
|
|
|
|
|
0
|
|
226
|
|
|
|
|
|
|
} |
227
|
0
|
|
|
|
|
0
|
return 0; |
228
|
|
|
|
|
|
|
} |
229
|
|
|
|
|
|
|
} |
230
|
|
|
|
|
|
|
|
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
=begin _private |
233
|
|
|
|
|
|
|
|
234
|
|
|
|
|
|
|
|
235
|
|
|
|
|
|
|
=item _unlink_or_rename( $file, $tryhard, $installing ) |
236
|
|
|
|
|
|
|
|
237
|
|
|
|
|
|
|
OS-Specific, Win32/Cygwin |
238
|
|
|
|
|
|
|
|
239
|
|
|
|
|
|
|
Tries to get a file out of the way by unlinking it or renaming it. On |
240
|
|
|
|
|
|
|
some OS'es (Win32 based) DLL files can end up locked such that they can |
241
|
|
|
|
|
|
|
be renamed but not deleted. Likewise sometimes a file can be locked such |
242
|
|
|
|
|
|
|
that it cant even be renamed or changed except at reboot. To handle |
243
|
|
|
|
|
|
|
these cases this routine finds a tempfile name that it can either rename |
244
|
|
|
|
|
|
|
the file out of the way or use as a proxy for the install so that the |
245
|
|
|
|
|
|
|
rename can happen later (at reboot). |
246
|
|
|
|
|
|
|
|
247
|
|
|
|
|
|
|
$file : the file to remove. |
248
|
|
|
|
|
|
|
$tryhard : should advanced tricks be used for deletion |
249
|
|
|
|
|
|
|
$installing : we are not merely deleting but we want to overwrite |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
When $tryhard is not true if the unlink fails its fatal. When $tryhard |
252
|
|
|
|
|
|
|
is true then the file is attempted to be renamed. The renamed file is |
253
|
|
|
|
|
|
|
then scheduled for deletion. If the rename fails then $installing |
254
|
|
|
|
|
|
|
governs what happens. If it is false the failure is fatal. If it is true |
255
|
|
|
|
|
|
|
then an attempt is made to schedule installation at boot using a |
256
|
|
|
|
|
|
|
temporary file to hold the new file. If this fails then a fatal error is |
257
|
|
|
|
|
|
|
thrown, if it succeeds it returns the temporary file name (which will be |
258
|
|
|
|
|
|
|
a derivative of the original in the same directory) so that the caller can |
259
|
|
|
|
|
|
|
use it to install under. In all other cases of success returns $file. |
260
|
|
|
|
|
|
|
On failure throws a fatal error. |
261
|
|
|
|
|
|
|
|
262
|
|
|
|
|
|
|
=end _private |
263
|
|
|
|
|
|
|
|
264
|
|
|
|
|
|
|
=cut |
265
|
|
|
|
|
|
|
|
266
|
|
|
|
|
|
|
|
267
|
|
|
|
|
|
|
|
268
|
|
|
|
|
|
|
sub _unlink_or_rename { #XXX OS-SPECIFIC |
269
|
7
|
|
|
7
|
|
64
|
my ( $file, $tryhard, $installing )= @_; |
270
|
|
|
|
|
|
|
|
271
|
|
|
|
|
|
|
# this chmod was originally unconditional. However, its not needed on |
272
|
|
|
|
|
|
|
# POSIXy systems since permission to unlink a file is specified by the |
273
|
|
|
|
|
|
|
# directory rather than the file; and in fact it screwed up hard- and |
274
|
|
|
|
|
|
|
# symlinked files. Keep it for other platforms in case its still |
275
|
|
|
|
|
|
|
# needed there. |
276
|
7
|
50
|
|
|
|
158
|
if ($^O =~ /^(dos|os2|MSWin32|VMS)$/) { |
277
|
0
|
|
|
|
|
0
|
_chmod( 0666, $file ); |
278
|
|
|
|
|
|
|
} |
279
|
7
|
|
|
|
|
24
|
my $unlink_count = 0; |
280
|
7
|
|
|
|
|
440
|
while (unlink $file) { $unlink_count++; } |
|
7
|
|
|
|
|
129
|
|
281
|
7
|
50
|
|
|
|
68
|
return $file if $unlink_count > 0; |
282
|
0
|
|
|
|
|
0
|
my $error="$!"; |
283
|
|
|
|
|
|
|
|
284
|
0
|
|
|
|
|
0
|
_choke("Cannot unlink '$file': $!") |
285
|
|
|
|
|
|
|
unless _CanMoveAtBoot && $tryhard; |
286
|
|
|
|
|
|
|
|
287
|
0
|
|
|
|
|
0
|
my $tmp= "AAA"; |
288
|
0
|
|
|
|
|
0
|
++$tmp while -e "$file.$tmp"; |
289
|
0
|
|
|
|
|
0
|
$tmp= "$file.$tmp"; |
290
|
|
|
|
|
|
|
|
291
|
0
|
|
|
|
|
0
|
warn "WARNING: Unable to unlink '$file': $error\n", |
292
|
|
|
|
|
|
|
"Going to try to rename it to '$tmp'.\n"; |
293
|
|
|
|
|
|
|
|
294
|
0
|
0
|
|
|
|
0
|
if ( rename $file, $tmp ) { |
|
|
0
|
|
|
|
|
|
295
|
0
|
|
|
|
|
0
|
warn "Rename successful. Scheduling '$tmp'\nfor deletion at reboot.\n"; |
296
|
|
|
|
|
|
|
# when $installing we can set $moan to true. |
297
|
|
|
|
|
|
|
# IOW, if we cant delete the renamed file at reboot its |
298
|
|
|
|
|
|
|
# not the end of the world. The other cases are more serious |
299
|
|
|
|
|
|
|
# and need to be fatal. |
300
|
0
|
|
|
|
|
0
|
_move_file_at_boot( $tmp, [], $installing ); |
301
|
0
|
|
|
|
|
0
|
return $file; |
302
|
|
|
|
|
|
|
} elsif ( $installing ) { |
303
|
0
|
|
|
|
|
0
|
_warnonce("Rename failed: $!. Scheduling '$tmp'\nfor". |
304
|
|
|
|
|
|
|
" installation as '$file' at reboot.\n"); |
305
|
0
|
|
|
|
|
0
|
_move_file_at_boot( $tmp, $file ); |
306
|
0
|
|
|
|
|
0
|
return $tmp; |
307
|
|
|
|
|
|
|
} else { |
308
|
0
|
|
|
|
|
0
|
_choke("Rename failed:$!", "Cannot proceed."); |
309
|
|
|
|
|
|
|
} |
310
|
|
|
|
|
|
|
|
311
|
|
|
|
|
|
|
} |
312
|
|
|
|
|
|
|
|
313
|
|
|
|
|
|
|
|
314
|
|
|
|
|
|
|
=pod |
315
|
|
|
|
|
|
|
|
316
|
|
|
|
|
|
|
=back |
317
|
|
|
|
|
|
|
|
318
|
|
|
|
|
|
|
=head2 Functions |
319
|
|
|
|
|
|
|
|
320
|
|
|
|
|
|
|
=begin _private |
321
|
|
|
|
|
|
|
|
322
|
|
|
|
|
|
|
=over |
323
|
|
|
|
|
|
|
|
324
|
|
|
|
|
|
|
=item _get_install_skip |
325
|
|
|
|
|
|
|
|
326
|
|
|
|
|
|
|
Handles loading the INSTALL.SKIP file. Returns an array of patterns to use. |
327
|
|
|
|
|
|
|
|
328
|
|
|
|
|
|
|
=cut |
329
|
|
|
|
|
|
|
|
330
|
|
|
|
|
|
|
|
331
|
|
|
|
|
|
|
|
332
|
|
|
|
|
|
|
sub _get_install_skip { |
333
|
19
|
|
|
19
|
|
53
|
my ( $skip, $verbose )= @_; |
334
|
19
|
50
|
|
|
|
58
|
if ($ENV{EU_INSTALL_IGNORE_SKIP}) { |
335
|
0
|
0
|
|
|
|
0
|
print "EU_INSTALL_IGNORE_SKIP is set, ignore skipfile settings\n" |
336
|
|
|
|
|
|
|
if $verbose>2; |
337
|
0
|
|
|
|
|
0
|
return []; |
338
|
|
|
|
|
|
|
} |
339
|
19
|
50
|
|
|
|
48
|
if ( ! defined $skip ) { |
340
|
19
|
50
|
|
|
|
42
|
print "Looking for install skip list\n" |
341
|
|
|
|
|
|
|
if $verbose>2; |
342
|
19
|
|
|
|
|
117
|
for my $file ( 'INSTALL.SKIP', $ENV{EU_INSTALL_SITE_SKIPFILE} ) { |
343
|
38
|
100
|
|
|
|
111
|
next unless $file; |
344
|
19
|
50
|
|
|
|
44
|
print "\tChecking for $file\n" |
345
|
|
|
|
|
|
|
if $verbose>2; |
346
|
19
|
50
|
|
|
|
223
|
if (-e $file) { |
347
|
0
|
|
|
|
|
0
|
$skip= $file; |
348
|
0
|
|
|
|
|
0
|
last; |
349
|
|
|
|
|
|
|
} |
350
|
|
|
|
|
|
|
} |
351
|
|
|
|
|
|
|
} |
352
|
19
|
50
|
33
|
|
|
119
|
if ($skip && !ref $skip) { |
|
|
50
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
353
|
0
|
0
|
|
|
|
0
|
print "Reading skip patterns from '$skip'.\n" |
354
|
|
|
|
|
|
|
if $verbose; |
355
|
0
|
0
|
|
|
|
0
|
if (open my $fh,$skip ) { |
356
|
0
|
|
|
|
|
0
|
my @patterns; |
357
|
0
|
|
|
|
|
0
|
while (<$fh>) { |
358
|
0
|
|
|
|
|
0
|
chomp; |
359
|
0
|
0
|
|
|
|
0
|
next if /^\s*(?:#|$)/; |
360
|
0
|
0
|
|
|
|
0
|
print "\tSkip pattern: $_\n" if $verbose>3; |
361
|
0
|
|
|
|
|
0
|
push @patterns, $_; |
362
|
|
|
|
|
|
|
} |
363
|
0
|
|
|
|
|
0
|
$skip= \@patterns; |
364
|
|
|
|
|
|
|
} else { |
365
|
0
|
|
|
|
|
0
|
warn "Can't read skip file:'$skip':$!\n"; |
366
|
0
|
|
|
|
|
0
|
$skip=[]; |
367
|
|
|
|
|
|
|
} |
368
|
|
|
|
|
|
|
} elsif ( UNIVERSAL::isa($skip,'ARRAY') ) { |
369
|
0
|
0
|
|
|
|
0
|
print "Using array for skip list\n" |
370
|
|
|
|
|
|
|
if $verbose>2; |
371
|
|
|
|
|
|
|
} elsif ($verbose) { |
372
|
0
|
0
|
|
|
|
0
|
print "No skip list found.\n" |
373
|
|
|
|
|
|
|
if $verbose>1; |
374
|
0
|
|
|
|
|
0
|
$skip= []; |
375
|
|
|
|
|
|
|
} |
376
|
19
|
50
|
|
|
|
45
|
warn "Got @{[0+@$skip]} skip patterns.\n" |
|
0
|
|
|
|
|
0
|
|
377
|
|
|
|
|
|
|
if $verbose>3; |
378
|
19
|
|
|
|
|
42
|
return $skip |
379
|
|
|
|
|
|
|
} |
380
|
|
|
|
|
|
|
|
381
|
|
|
|
|
|
|
=pod |
382
|
|
|
|
|
|
|
|
383
|
|
|
|
|
|
|
=item _have_write_access |
384
|
|
|
|
|
|
|
|
385
|
|
|
|
|
|
|
Abstract a -w check that tries to use POSIX::access() if possible. |
386
|
|
|
|
|
|
|
|
387
|
|
|
|
|
|
|
=cut |
388
|
|
|
|
|
|
|
|
389
|
|
|
|
|
|
|
{ |
390
|
|
|
|
|
|
|
my $has_posix; |
391
|
|
|
|
|
|
|
sub _have_write_access { |
392
|
36
|
|
|
36
|
|
75
|
my $dir=shift; |
393
|
36
|
100
|
|
|
|
130
|
unless (defined $has_posix) { |
394
|
|
|
|
|
|
|
$has_posix = (!_Is_cygwin && !_Is_Win32 |
395
|
3
|
|
50
|
|
|
7
|
&& eval { local $^W; require POSIX; 1} ) || 0; |
396
|
|
|
|
|
|
|
} |
397
|
36
|
50
|
|
|
|
164
|
if ($has_posix) { |
398
|
36
|
|
|
|
|
602
|
return POSIX::access($dir, POSIX::W_OK()); |
399
|
|
|
|
|
|
|
} else { |
400
|
0
|
|
|
|
|
0
|
return -w $dir; |
401
|
|
|
|
|
|
|
} |
402
|
|
|
|
|
|
|
} |
403
|
|
|
|
|
|
|
} |
404
|
|
|
|
|
|
|
|
405
|
|
|
|
|
|
|
=pod |
406
|
|
|
|
|
|
|
|
407
|
|
|
|
|
|
|
=item _can_write_dir(C<$dir>) |
408
|
|
|
|
|
|
|
|
409
|
|
|
|
|
|
|
Checks whether a given directory is writable, taking account |
410
|
|
|
|
|
|
|
the possibility that the directory might not exist and would have to |
411
|
|
|
|
|
|
|
be created first. |
412
|
|
|
|
|
|
|
|
413
|
|
|
|
|
|
|
Returns a list, containing: C<($writable, $determined_by, @create)> |
414
|
|
|
|
|
|
|
|
415
|
|
|
|
|
|
|
C<$writable> says whether the directory is (hypothetically) writable |
416
|
|
|
|
|
|
|
|
417
|
|
|
|
|
|
|
C<$determined_by> is the directory the status was determined from. It will be |
418
|
|
|
|
|
|
|
either the C<$dir>, or one of its parents. |
419
|
|
|
|
|
|
|
|
420
|
|
|
|
|
|
|
C<@create> is a list of directories that would probably have to be created |
421
|
|
|
|
|
|
|
to make the requested directory. It may not actually be correct on |
422
|
|
|
|
|
|
|
relative paths with C<..> in them. But for our purposes it should work ok |
423
|
|
|
|
|
|
|
|
424
|
|
|
|
|
|
|
=cut |
425
|
|
|
|
|
|
|
|
426
|
|
|
|
|
|
|
|
427
|
|
|
|
|
|
|
sub _can_write_dir { |
428
|
36
|
|
|
36
|
|
865
|
my $dir=shift; |
429
|
|
|
|
|
|
|
return |
430
|
36
|
50
|
33
|
|
|
366
|
unless defined $dir and length $dir; |
431
|
|
|
|
|
|
|
|
432
|
36
|
|
|
|
|
826
|
my ($vol, $dirs, $file) = File::Spec->splitpath($dir,1); |
433
|
36
|
|
|
|
|
308
|
my @dirs = File::Spec->splitdir($dirs); |
434
|
36
|
100
|
|
|
|
791
|
unshift @dirs, File::Spec->curdir |
435
|
|
|
|
|
|
|
unless File::Spec->file_name_is_absolute($dir); |
436
|
|
|
|
|
|
|
|
437
|
36
|
|
|
|
|
140
|
my $path=''; |
438
|
36
|
|
|
|
|
67
|
my @make; |
439
|
36
|
|
|
|
|
97
|
while (@dirs) { |
440
|
60
|
|
|
|
|
89
|
if (_Is_VMS) { |
441
|
|
|
|
|
|
|
$dir = File::Spec->catdir($vol,@dirs); |
442
|
|
|
|
|
|
|
} |
443
|
|
|
|
|
|
|
else { |
444
|
60
|
|
|
|
|
427
|
$dir = File::Spec->catdir(@dirs); |
445
|
60
|
50
|
33
|
|
|
396
|
$dir = File::Spec->catpath($vol,$dir,'') |
446
|
|
|
|
|
|
|
if defined $vol and length $vol; |
447
|
|
|
|
|
|
|
} |
448
|
60
|
50
|
|
|
|
134
|
next if ( $dir eq $path ); |
449
|
60
|
100
|
|
|
|
690
|
if ( ! -e $dir ) { |
450
|
24
|
|
|
|
|
86
|
unshift @make,$dir; |
451
|
24
|
|
|
|
|
47
|
next; |
452
|
|
|
|
|
|
|
} |
453
|
36
|
50
|
|
|
|
125
|
if ( _have_write_access($dir) ) { |
454
|
36
|
|
|
|
|
367
|
return 1,$dir,@make |
455
|
|
|
|
|
|
|
} else { |
456
|
0
|
|
|
|
|
0
|
return 0,$dir,@make |
457
|
|
|
|
|
|
|
} |
458
|
|
|
|
|
|
|
} continue { |
459
|
24
|
|
|
|
|
62
|
pop @dirs; |
460
|
|
|
|
|
|
|
} |
461
|
0
|
|
|
|
|
0
|
return 0; |
462
|
|
|
|
|
|
|
} |
463
|
|
|
|
|
|
|
|
464
|
|
|
|
|
|
|
=pod |
465
|
|
|
|
|
|
|
|
466
|
|
|
|
|
|
|
=item _mkpath($dir,$show,$mode,$verbose,$dry_run) |
467
|
|
|
|
|
|
|
|
468
|
|
|
|
|
|
|
Wrapper around File::Path::mkpath() to handle errors. |
469
|
|
|
|
|
|
|
|
470
|
|
|
|
|
|
|
If $verbose is true and >1 then additional diagnostics will be produced, also |
471
|
|
|
|
|
|
|
this will force $show to true. |
472
|
|
|
|
|
|
|
|
473
|
|
|
|
|
|
|
If $dry_run is true then the directory will not be created but a check will be |
474
|
|
|
|
|
|
|
made to see whether it would be possible to write to the directory, or that |
475
|
|
|
|
|
|
|
it would be possible to create the directory. |
476
|
|
|
|
|
|
|
|
477
|
|
|
|
|
|
|
If $dry_run is not true dies if the directory can not be created or is not |
478
|
|
|
|
|
|
|
writable. |
479
|
|
|
|
|
|
|
|
480
|
|
|
|
|
|
|
=cut |
481
|
|
|
|
|
|
|
|
482
|
|
|
|
|
|
|
sub _mkpath { |
483
|
34
|
|
|
34
|
|
167
|
my ($dir,$show,$mode,$verbose,$dry_run)=@_; |
484
|
34
|
0
|
33
|
|
|
112
|
if ( $verbose && $verbose > 1 && ! -d $dir) { |
|
|
|
33
|
|
|
|
|
485
|
0
|
|
|
|
|
0
|
$show= 1; |
486
|
0
|
|
|
|
|
0
|
printf "mkpath(%s,%d,%#o)\n", $dir, $show, $mode; |
487
|
|
|
|
|
|
|
} |
488
|
34
|
100
|
|
|
|
131
|
if (!$dry_run) { |
489
|
28
|
50
|
|
|
|
56
|
if ( ! eval { File::Path::mkpath($dir,$show,$mode); 1 } ) { |
|
28
|
|
|
|
|
4188
|
|
|
28
|
|
|
|
|
136
|
|
490
|
0
|
|
|
|
|
0
|
_choke("Can't create '$dir'","$@"); |
491
|
|
|
|
|
|
|
} |
492
|
|
|
|
|
|
|
|
493
|
|
|
|
|
|
|
} |
494
|
34
|
|
|
|
|
121
|
my ($can,$root,@make)=_can_write_dir($dir); |
495
|
34
|
50
|
33
|
|
|
187
|
if (!$can) { |
|
|
50
|
|
|
|
|
|
496
|
0
|
0
|
|
|
|
0
|
my @msg=( |
497
|
|
|
|
|
|
|
"Can't create '$dir'", |
498
|
|
|
|
|
|
|
$root ? "Do not have write permissions on '$root'" |
499
|
|
|
|
|
|
|
: "Unknown Error" |
500
|
|
|
|
|
|
|
); |
501
|
0
|
0
|
|
|
|
0
|
if ($dry_run) { |
502
|
0
|
|
|
|
|
0
|
_warnonce @msg; |
503
|
|
|
|
|
|
|
} else { |
504
|
0
|
|
|
|
|
0
|
_choke @msg; |
505
|
|
|
|
|
|
|
} |
506
|
|
|
|
|
|
|
} elsif ($show and $dry_run) { |
507
|
0
|
|
|
|
|
0
|
print "$_\n" for @make; |
508
|
|
|
|
|
|
|
} |
509
|
|
|
|
|
|
|
|
510
|
|
|
|
|
|
|
} |
511
|
|
|
|
|
|
|
|
512
|
|
|
|
|
|
|
=pod |
513
|
|
|
|
|
|
|
|
514
|
|
|
|
|
|
|
=item _copy($from,$to,$verbose,$dry_run) |
515
|
|
|
|
|
|
|
|
516
|
|
|
|
|
|
|
Wrapper around File::Copy::copy to handle errors. |
517
|
|
|
|
|
|
|
|
518
|
|
|
|
|
|
|
If $verbose is true and >1 then additional diagnostics will be emitted. |
519
|
|
|
|
|
|
|
|
520
|
|
|
|
|
|
|
If $dry_run is true then the copy will not actually occur. |
521
|
|
|
|
|
|
|
|
522
|
|
|
|
|
|
|
Dies if the copy fails. |
523
|
|
|
|
|
|
|
|
524
|
|
|
|
|
|
|
=cut |
525
|
|
|
|
|
|
|
|
526
|
|
|
|
|
|
|
|
527
|
|
|
|
|
|
|
sub _copy { |
528
|
15
|
|
|
15
|
|
167
|
my ( $from, $to, $verbose, $dry_run)=@_; |
529
|
15
|
50
|
33
|
|
|
85
|
if ($verbose && $verbose>1) { |
530
|
0
|
|
|
|
|
0
|
printf "copy(%s,%s)\n", $from, $to; |
531
|
|
|
|
|
|
|
} |
532
|
15
|
100
|
|
|
|
67
|
if (!$dry_run) { |
533
|
13
|
50
|
|
|
|
200
|
File::Copy::copy($from,$to) |
534
|
|
|
|
|
|
|
or _croak( _estr "ERROR: Cannot copy '$from' to '$to': $!" ); |
535
|
|
|
|
|
|
|
} |
536
|
|
|
|
|
|
|
} |
537
|
|
|
|
|
|
|
|
538
|
|
|
|
|
|
|
=pod |
539
|
|
|
|
|
|
|
|
540
|
|
|
|
|
|
|
=item _chdir($from) |
541
|
|
|
|
|
|
|
|
542
|
|
|
|
|
|
|
Wrapper around chdir to catch errors. |
543
|
|
|
|
|
|
|
|
544
|
|
|
|
|
|
|
If not called in void context returns the cwd from before the chdir. |
545
|
|
|
|
|
|
|
|
546
|
|
|
|
|
|
|
dies on error. |
547
|
|
|
|
|
|
|
|
548
|
|
|
|
|
|
|
=cut |
549
|
|
|
|
|
|
|
|
550
|
|
|
|
|
|
|
sub _chdir { |
551
|
76
|
|
|
76
|
|
229
|
my ($dir)= @_; |
552
|
76
|
|
|
|
|
108
|
my $ret; |
553
|
76
|
100
|
|
|
|
210
|
if (defined wantarray) { |
554
|
19
|
|
|
|
|
57747
|
$ret= cwd; |
555
|
|
|
|
|
|
|
} |
556
|
76
|
50
|
|
|
|
1172
|
chdir $dir |
557
|
|
|
|
|
|
|
or _choke("Couldn't chdir to '$dir': $!"); |
558
|
76
|
|
|
|
|
3150
|
return $ret; |
559
|
|
|
|
|
|
|
} |
560
|
|
|
|
|
|
|
|
561
|
|
|
|
|
|
|
=pod |
562
|
|
|
|
|
|
|
|
563
|
|
|
|
|
|
|
=back |
564
|
|
|
|
|
|
|
|
565
|
|
|
|
|
|
|
=end _private |
566
|
|
|
|
|
|
|
|
567
|
|
|
|
|
|
|
=over |
568
|
|
|
|
|
|
|
|
569
|
|
|
|
|
|
|
=item B |
570
|
|
|
|
|
|
|
|
571
|
|
|
|
|
|
|
# deprecated forms |
572
|
|
|
|
|
|
|
install(\%from_to); |
573
|
|
|
|
|
|
|
install(\%from_to, $verbose, $dry_run, $uninstall_shadows, |
574
|
|
|
|
|
|
|
$skip, $always_copy, \%result); |
575
|
|
|
|
|
|
|
|
576
|
|
|
|
|
|
|
# recommended form as of 1.47 |
577
|
|
|
|
|
|
|
install([ |
578
|
|
|
|
|
|
|
from_to => \%from_to, |
579
|
|
|
|
|
|
|
verbose => 1, |
580
|
|
|
|
|
|
|
dry_run => 0, |
581
|
|
|
|
|
|
|
uninstall_shadows => 1, |
582
|
|
|
|
|
|
|
skip => undef, |
583
|
|
|
|
|
|
|
always_copy => 1, |
584
|
|
|
|
|
|
|
result => \%install_results, |
585
|
|
|
|
|
|
|
]); |
586
|
|
|
|
|
|
|
|
587
|
|
|
|
|
|
|
|
588
|
|
|
|
|
|
|
Copies each directory tree of %from_to to its corresponding value |
589
|
|
|
|
|
|
|
preserving timestamps and permissions. |
590
|
|
|
|
|
|
|
|
591
|
|
|
|
|
|
|
There are two keys with a special meaning in the hash: "read" and |
592
|
|
|
|
|
|
|
"write". These contain packlist files. After the copying is done, |
593
|
|
|
|
|
|
|
install() will write the list of target files to $from_to{write}. If |
594
|
|
|
|
|
|
|
$from_to{read} is given the contents of this file will be merged into |
595
|
|
|
|
|
|
|
the written file. The read and the written file may be identical, but |
596
|
|
|
|
|
|
|
on AFS it is quite likely that people are installing to a different |
597
|
|
|
|
|
|
|
directory than the one where the files later appear. |
598
|
|
|
|
|
|
|
|
599
|
|
|
|
|
|
|
If $verbose is true, will print out each file removed. Default is |
600
|
|
|
|
|
|
|
false. This is "make install VERBINST=1". $verbose values going |
601
|
|
|
|
|
|
|
up to 5 show increasingly more diagnostics output. |
602
|
|
|
|
|
|
|
|
603
|
|
|
|
|
|
|
If $dry_run is true it will only print what it was going to do |
604
|
|
|
|
|
|
|
without actually doing it. Default is false. |
605
|
|
|
|
|
|
|
|
606
|
|
|
|
|
|
|
If $uninstall_shadows is true any differing versions throughout @INC |
607
|
|
|
|
|
|
|
will be uninstalled. This is "make install UNINST=1" |
608
|
|
|
|
|
|
|
|
609
|
|
|
|
|
|
|
As of 1.37_02 install() supports the use of a list of patterns to filter out |
610
|
|
|
|
|
|
|
files that shouldn't be installed. If $skip is omitted or undefined then |
611
|
|
|
|
|
|
|
install will try to read the list from INSTALL.SKIP in the CWD. This file is |
612
|
|
|
|
|
|
|
a list of regular expressions and is just like the MANIFEST.SKIP file used |
613
|
|
|
|
|
|
|
by L. |
614
|
|
|
|
|
|
|
|
615
|
|
|
|
|
|
|
A default site INSTALL.SKIP may be provided by setting then environment |
616
|
|
|
|
|
|
|
variable EU_INSTALL_SITE_SKIPFILE, this will only be used when there isn't a |
617
|
|
|
|
|
|
|
distribution specific INSTALL.SKIP. If the environment variable |
618
|
|
|
|
|
|
|
EU_INSTALL_IGNORE_SKIP is true then no install file filtering will be |
619
|
|
|
|
|
|
|
performed. |
620
|
|
|
|
|
|
|
|
621
|
|
|
|
|
|
|
If $skip is undefined then the skip file will be autodetected and used if it |
622
|
|
|
|
|
|
|
is found. If $skip is a reference to an array then it is assumed the array |
623
|
|
|
|
|
|
|
contains the list of patterns, if $skip is a true non reference it is |
624
|
|
|
|
|
|
|
assumed to be the filename holding the list of patterns, any other value of |
625
|
|
|
|
|
|
|
$skip is taken to mean that no install filtering should occur. |
626
|
|
|
|
|
|
|
|
627
|
|
|
|
|
|
|
B |
628
|
|
|
|
|
|
|
|
629
|
|
|
|
|
|
|
As of version 1.47 the following additions were made to the install interface. |
630
|
|
|
|
|
|
|
Note that the new argument style and use of the %result hash is recommended. |
631
|
|
|
|
|
|
|
|
632
|
|
|
|
|
|
|
The $always_copy parameter which when true causes files to be updated |
633
|
|
|
|
|
|
|
regardless as to whether they have changed, if it is defined but false then |
634
|
|
|
|
|
|
|
copies are made only if the files have changed, if it is undefined then the |
635
|
|
|
|
|
|
|
value of the environment variable EU_INSTALL_ALWAYS_COPY is used as default. |
636
|
|
|
|
|
|
|
|
637
|
|
|
|
|
|
|
The %result hash will be populated with the various keys/subhashes reflecting |
638
|
|
|
|
|
|
|
the install. Currently these keys and their structure are: |
639
|
|
|
|
|
|
|
|
640
|
|
|
|
|
|
|
install => { $target => $source }, |
641
|
|
|
|
|
|
|
install_fail => { $target => $source }, |
642
|
|
|
|
|
|
|
install_unchanged => { $target => $source }, |
643
|
|
|
|
|
|
|
|
644
|
|
|
|
|
|
|
install_filtered => { $source => $pattern }, |
645
|
|
|
|
|
|
|
|
646
|
|
|
|
|
|
|
uninstall => { $uninstalled => $source }, |
647
|
|
|
|
|
|
|
uninstall_fail => { $uninstalled => $source }, |
648
|
|
|
|
|
|
|
|
649
|
|
|
|
|
|
|
where C<$source> is the filespec of the file being installed. C<$target> is where |
650
|
|
|
|
|
|
|
it is being installed to, and C<$uninstalled> is any shadow file that is in C<@INC> |
651
|
|
|
|
|
|
|
or C<$ENV{PERL5LIB}> or other standard locations, and C<$pattern> is the pattern that |
652
|
|
|
|
|
|
|
caused a source file to be skipped. In future more keys will be added, such as to |
653
|
|
|
|
|
|
|
show created directories, however this requires changes in other modules and must |
654
|
|
|
|
|
|
|
therefore wait. |
655
|
|
|
|
|
|
|
|
656
|
|
|
|
|
|
|
These keys will be populated before any exceptions are thrown should there be an |
657
|
|
|
|
|
|
|
error. |
658
|
|
|
|
|
|
|
|
659
|
|
|
|
|
|
|
Note that all updates of the %result are additive, the hash will not be |
660
|
|
|
|
|
|
|
cleared before use, thus allowing status results of many installs to be easily |
661
|
|
|
|
|
|
|
aggregated. |
662
|
|
|
|
|
|
|
|
663
|
|
|
|
|
|
|
B |
664
|
|
|
|
|
|
|
|
665
|
|
|
|
|
|
|
If there is only one argument and it is a reference to an array then |
666
|
|
|
|
|
|
|
the array is assumed to contain a list of key-value pairs specifying |
667
|
|
|
|
|
|
|
the options. In this case the option "from_to" is mandatory. This style |
668
|
|
|
|
|
|
|
means that you do not have to supply a cryptic list of arguments and can |
669
|
|
|
|
|
|
|
use a self documenting argument list that is easier to understand. |
670
|
|
|
|
|
|
|
|
671
|
|
|
|
|
|
|
This is now the recommended interface to install(). |
672
|
|
|
|
|
|
|
|
673
|
|
|
|
|
|
|
B |
674
|
|
|
|
|
|
|
|
675
|
|
|
|
|
|
|
If all actions were successful install will return a hashref of the results |
676
|
|
|
|
|
|
|
as described above for the $result parameter. If any action is a failure |
677
|
|
|
|
|
|
|
then install will die, therefore it is recommended to pass in the $result |
678
|
|
|
|
|
|
|
parameter instead of using the return value. If the result parameter is |
679
|
|
|
|
|
|
|
provided then the returned hashref will be the passed in hashref. |
680
|
|
|
|
|
|
|
|
681
|
|
|
|
|
|
|
=cut |
682
|
|
|
|
|
|
|
|
683
|
|
|
|
|
|
|
sub install { #XXX OS-SPECIFIC |
684
|
19
|
|
|
19
|
1
|
45374
|
my($from_to,$verbose,$dry_run,$uninstall_shadows,$skip,$always_copy,$result) = @_; |
685
|
19
|
100
|
100
|
|
|
192
|
if (@_==1 and eval { 1+@$from_to }) { |
|
13
|
|
|
|
|
81
|
|
686
|
12
|
|
|
|
|
103
|
my %opts = @$from_to; |
687
|
|
|
|
|
|
|
$from_to = $opts{from_to} |
688
|
12
|
50
|
|
|
|
57
|
or _confess("from_to is a mandatory parameter"); |
689
|
12
|
|
|
|
|
25
|
$verbose = $opts{verbose}; |
690
|
12
|
|
|
|
|
24
|
$dry_run = $opts{dry_run}; |
691
|
12
|
|
|
|
|
21
|
$uninstall_shadows = $opts{uninstall_shadows}; |
692
|
12
|
|
|
|
|
20
|
$skip = $opts{skip}; |
693
|
12
|
|
|
|
|
24
|
$always_copy = $opts{always_copy}; |
694
|
12
|
|
|
|
|
30
|
$result = $opts{result}; |
695
|
|
|
|
|
|
|
} |
696
|
|
|
|
|
|
|
|
697
|
19
|
|
100
|
|
|
191
|
$result ||= {}; |
698
|
19
|
|
50
|
|
|
228
|
$verbose ||= 0; |
699
|
19
|
|
100
|
|
|
103
|
$dry_run ||= 0; |
700
|
|
|
|
|
|
|
|
701
|
19
|
|
|
|
|
113
|
$skip= _get_install_skip($skip,$verbose); |
702
|
|
|
|
|
|
|
$always_copy = $ENV{EU_INSTALL_ALWAYS_COPY} |
703
|
|
|
|
|
|
|
|| $ENV{EU_ALWAYS_COPY} |
704
|
19
|
50
|
50
|
|
|
218
|
|| 0 |
705
|
|
|
|
|
|
|
unless defined $always_copy; |
706
|
|
|
|
|
|
|
|
707
|
19
|
|
|
|
|
116
|
my(%from_to) = %$from_to; |
708
|
19
|
|
|
|
|
44
|
my(%pack, $dir, %warned); |
709
|
19
|
|
|
|
|
1161
|
require ExtUtils::Packlist; |
710
|
19
|
|
|
|
|
339
|
my($packlist) = ExtUtils::Packlist->new(); |
711
|
|
|
|
|
|
|
|
712
|
19
|
|
|
|
|
73
|
local(*DIR); |
713
|
19
|
|
|
|
|
60
|
for (qw/read write/) { |
714
|
38
|
|
|
|
|
81
|
$pack{$_}=$from_to{$_}; |
715
|
38
|
|
|
|
|
87
|
delete $from_to{$_}; |
716
|
|
|
|
|
|
|
} |
717
|
19
|
|
|
|
|
64
|
my $tmpfile = install_rooted_file($pack{"read"}); |
718
|
19
|
100
|
|
|
|
678
|
$packlist->read($tmpfile) if (-f $tmpfile); |
719
|
19
|
|
|
|
|
61271
|
my $cwd = cwd(); |
720
|
19
|
|
|
|
|
292
|
my @found_files; |
721
|
|
|
|
|
|
|
my %check_dirs; |
722
|
19
|
|
|
|
|
412
|
require File::Find; |
723
|
|
|
|
|
|
|
|
724
|
19
|
|
|
|
|
557
|
my $blib_lib = File::Spec->catdir('blib', 'lib'); |
725
|
19
|
|
|
|
|
233
|
my $blib_arch = File::Spec->catdir('blib', 'arch'); |
726
|
|
|
|
|
|
|
|
727
|
|
|
|
|
|
|
# File::Find seems to always be Unixy except on MacPerl :( |
728
|
19
|
50
|
|
|
|
394
|
my $current_directory = $^O eq 'MacOS' ? $Curdir : '.'; |
729
|
|
|
|
|
|
|
|
730
|
19
|
|
|
|
|
242
|
MOD_INSTALL: foreach my $source (sort keys %from_to) { |
731
|
|
|
|
|
|
|
#copy the tree to the target directory without altering |
732
|
|
|
|
|
|
|
#timestamp and permission and remember for the .packlist |
733
|
|
|
|
|
|
|
#file. The packlist file contains the absolute paths of the |
734
|
|
|
|
|
|
|
#install locations. AFS users may call this a bug. We'll have |
735
|
|
|
|
|
|
|
#to reconsider how to add the means to satisfy AFS users also. |
736
|
|
|
|
|
|
|
|
737
|
|
|
|
|
|
|
#October 1997: we want to install .pm files into archlib if |
738
|
|
|
|
|
|
|
#there are any files in arch. So we depend on having ./blib/arch |
739
|
|
|
|
|
|
|
#hardcoded here. |
740
|
|
|
|
|
|
|
|
741
|
19
|
|
|
|
|
452
|
my $targetroot = install_rooted_dir($from_to{$source}); |
742
|
|
|
|
|
|
|
|
743
|
19
|
50
|
66
|
|
|
320
|
if ($source eq $blib_lib and |
|
|
|
33
|
|
|
|
|
744
|
|
|
|
|
|
|
exists $from_to{$blib_arch} and |
745
|
|
|
|
|
|
|
directory_not_empty($blib_arch) |
746
|
|
|
|
|
|
|
){ |
747
|
0
|
|
|
|
|
0
|
$targetroot = install_rooted_dir($from_to{$blib_arch}); |
748
|
0
|
|
|
|
|
0
|
print "Files found in $blib_arch: installing files in $blib_lib into architecture dependent library tree\n"; |
749
|
|
|
|
|
|
|
} |
750
|
|
|
|
|
|
|
|
751
|
19
|
50
|
|
|
|
476
|
next unless -d $source; |
752
|
19
|
|
|
|
|
152
|
_chdir($source); |
753
|
|
|
|
|
|
|
# 5.5.3's File::Find missing no_chdir option |
754
|
|
|
|
|
|
|
# XXX OS-SPECIFIC |
755
|
|
|
|
|
|
|
File::Find::find(sub { |
756
|
76
|
|
|
76
|
|
1161
|
my ($mode,$size,$atime,$mtime) = (stat)[2,7,8,9]; |
757
|
|
|
|
|
|
|
|
758
|
76
|
100
|
|
|
|
6154
|
return if !-f _; |
759
|
19
|
|
|
|
|
73
|
my $origfile = $_; |
760
|
|
|
|
|
|
|
|
761
|
19
|
50
|
|
|
|
105
|
return if $origfile eq ".exists"; |
762
|
19
|
|
|
|
|
242
|
my $targetdir = File::Spec->catdir($targetroot, $File::Find::dir); |
763
|
19
|
|
|
|
|
160
|
my $targetfile = File::Spec->catfile($targetdir, $origfile); |
764
|
19
|
|
|
|
|
91
|
my $sourcedir = File::Spec->catdir($source, $File::Find::dir); |
765
|
19
|
|
|
|
|
125
|
my $sourcefile = File::Spec->catfile($sourcedir, $origfile); |
766
|
|
|
|
|
|
|
|
767
|
19
|
|
|
|
|
122
|
for my $pat (@$skip) { |
768
|
0
|
0
|
|
|
|
0
|
if ( $sourcefile=~/$pat/ ) { |
769
|
0
|
0
|
|
|
|
0
|
print "Skipping $targetfile (filtered)\n" |
770
|
|
|
|
|
|
|
if $verbose>1; |
771
|
0
|
|
|
|
|
0
|
$result->{install_filtered}{$sourcefile} = $pat; |
772
|
0
|
|
|
|
|
0
|
return; |
773
|
|
|
|
|
|
|
} |
774
|
|
|
|
|
|
|
} |
775
|
|
|
|
|
|
|
# we have to do this for back compat with old File::Finds |
776
|
|
|
|
|
|
|
# and because the target is relative |
777
|
19
|
|
|
|
|
49
|
my $save_cwd = _chdir($cwd); |
778
|
19
|
|
|
|
|
75
|
my $diff = 0; |
779
|
|
|
|
|
|
|
# XXX: I wonder how useful this logic is actually -- demerphq |
780
|
19
|
100
|
100
|
|
|
880
|
if ( $always_copy or !-f $targetfile or -s $targetfile != $size) { |
|
|
|
100
|
|
|
|
|
781
|
12
|
|
|
|
|
44
|
$diff++; |
782
|
|
|
|
|
|
|
} else { |
783
|
|
|
|
|
|
|
# we might not need to copy this file |
784
|
7
|
|
|
|
|
141
|
$diff = _compare($sourcefile, $targetfile); |
785
|
|
|
|
|
|
|
} |
786
|
19
|
100
|
|
|
|
2082
|
$check_dirs{$targetdir}++ |
787
|
|
|
|
|
|
|
unless -w $targetfile; |
788
|
|
|
|
|
|
|
|
789
|
19
|
|
|
|
|
321
|
push @found_files, |
790
|
|
|
|
|
|
|
[ $diff, $File::Find::dir, $origfile, |
791
|
|
|
|
|
|
|
$mode, $size, $atime, $mtime, |
792
|
|
|
|
|
|
|
$targetdir, $targetfile, $sourcedir, $sourcefile, |
793
|
|
|
|
|
|
|
|
794
|
|
|
|
|
|
|
]; |
795
|
|
|
|
|
|
|
#restore the original directory we were in when File::Find |
796
|
|
|
|
|
|
|
#called us so that it doesn't get horribly confused. |
797
|
19
|
|
|
|
|
179
|
_chdir($save_cwd); |
798
|
19
|
|
|
|
|
3676
|
}, $current_directory ); |
799
|
19
|
|
|
|
|
558
|
_chdir($cwd); |
800
|
|
|
|
|
|
|
} |
801
|
19
|
|
|
|
|
177
|
foreach my $targetdir (sort keys %check_dirs) { |
802
|
7
|
|
|
|
|
82
|
_mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); |
803
|
|
|
|
|
|
|
} |
804
|
19
|
|
|
|
|
91
|
foreach my $found (@found_files) { |
805
|
19
|
|
|
|
|
185
|
my ($diff, $ffd, $origfile, $mode, $size, $atime, $mtime, |
806
|
|
|
|
|
|
|
$targetdir, $targetfile, $sourcedir, $sourcefile)= @$found; |
807
|
|
|
|
|
|
|
|
808
|
19
|
|
|
|
|
47
|
my $realtarget= $targetfile; |
809
|
19
|
100
|
|
|
|
85
|
if ($diff) { |
810
|
|
|
|
|
|
|
eval { |
811
|
12
|
100
|
|
|
|
276
|
if (-f $targetfile) { |
|
|
100
|
|
|
|
|
|
812
|
5
|
50
|
|
|
|
64
|
print "_unlink_or_rename($targetfile)\n" if $verbose>1; |
813
|
5
|
50
|
|
|
|
98
|
$targetfile= _unlink_or_rename( $targetfile, 'tryhard', 'install' ) |
814
|
|
|
|
|
|
|
unless $dry_run; |
815
|
|
|
|
|
|
|
} elsif ( ! -d $targetdir ) { |
816
|
2
|
|
|
|
|
18
|
_mkpath( $targetdir, 0, 0755, $verbose, $dry_run ); |
817
|
|
|
|
|
|
|
} |
818
|
12
|
|
|
|
|
501
|
print "Installing $targetfile\n"; |
819
|
|
|
|
|
|
|
|
820
|
12
|
|
|
|
|
292
|
_copy( $sourcefile, $targetfile, $verbose, $dry_run, ); |
821
|
|
|
|
|
|
|
|
822
|
|
|
|
|
|
|
|
823
|
|
|
|
|
|
|
#XXX OS-SPECIFIC |
824
|
12
|
50
|
|
|
|
4317
|
print "utime($atime,$mtime,$targetfile)\n" if $verbose>1; |
825
|
12
|
50
|
|
|
|
230
|
utime($atime,$mtime + _Is_VMS,$targetfile) unless $dry_run>1; |
826
|
|
|
|
|
|
|
|
827
|
|
|
|
|
|
|
|
828
|
12
|
50
|
|
|
|
76
|
$mode = 0444 | ( $mode & 0111 ? 0111 : 0 ); |
829
|
12
|
50
|
|
|
|
46
|
$mode = $mode | 0222 |
830
|
|
|
|
|
|
|
if $realtarget ne $targetfile; |
831
|
12
|
|
|
|
|
158
|
_chmod( $mode, $targetfile, $verbose ); |
832
|
12
|
|
|
|
|
153
|
$result->{install}{$targetfile} = $sourcefile; |
833
|
12
|
|
|
|
|
63
|
1 |
834
|
12
|
50
|
|
|
|
39
|
} or do { |
835
|
0
|
|
|
|
|
0
|
$result->{install_fail}{$targetfile} = $sourcefile; |
836
|
0
|
|
|
|
|
0
|
die $@; |
837
|
|
|
|
|
|
|
}; |
838
|
|
|
|
|
|
|
} else { |
839
|
7
|
|
|
|
|
126
|
$result->{install_unchanged}{$targetfile} = $sourcefile; |
840
|
7
|
50
|
|
|
|
55
|
print "Skipping $targetfile (unchanged)\n" if $verbose; |
841
|
|
|
|
|
|
|
} |
842
|
|
|
|
|
|
|
|
843
|
19
|
100
|
|
|
|
101
|
if ( $uninstall_shadows ) { |
844
|
8
|
50
|
|
|
|
167
|
inc_uninstall($sourcefile,$ffd, $verbose, |
845
|
|
|
|
|
|
|
$dry_run, |
846
|
|
|
|
|
|
|
$realtarget ne $targetfile ? $realtarget : "", |
847
|
|
|
|
|
|
|
$result); |
848
|
|
|
|
|
|
|
} |
849
|
|
|
|
|
|
|
|
850
|
|
|
|
|
|
|
# Record the full pathname. |
851
|
17
|
|
|
|
|
315
|
$packlist->{$targetfile}++; |
852
|
|
|
|
|
|
|
} |
853
|
|
|
|
|
|
|
|
854
|
17
|
50
|
|
|
|
56
|
if ($pack{'write'}) { |
855
|
17
|
|
|
|
|
1507
|
$dir = install_rooted_dir(dirname($pack{'write'})); |
856
|
17
|
|
|
|
|
100
|
_mkpath( $dir, 0, 0755, $verbose, $dry_run ); |
857
|
17
|
50
|
|
|
|
49
|
print "Writing $pack{'write'}\n" if $verbose; |
858
|
17
|
100
|
|
|
|
140
|
$packlist->write(install_rooted_file($pack{'write'})) unless $dry_run; |
859
|
|
|
|
|
|
|
} |
860
|
|
|
|
|
|
|
|
861
|
17
|
|
|
|
|
106
|
_do_cleanup($verbose); |
862
|
17
|
|
|
|
|
604
|
return $result; |
863
|
|
|
|
|
|
|
} |
864
|
|
|
|
|
|
|
|
865
|
|
|
|
|
|
|
=begin _private |
866
|
|
|
|
|
|
|
|
867
|
|
|
|
|
|
|
=item _do_cleanup |
868
|
|
|
|
|
|
|
|
869
|
|
|
|
|
|
|
Standardize finish event for after another instruction has occurred. |
870
|
|
|
|
|
|
|
Handles converting $MUST_REBOOT to a die for instance. |
871
|
|
|
|
|
|
|
|
872
|
|
|
|
|
|
|
=end _private |
873
|
|
|
|
|
|
|
|
874
|
|
|
|
|
|
|
=cut |
875
|
|
|
|
|
|
|
|
876
|
|
|
|
|
|
|
sub _do_cleanup { |
877
|
17
|
|
|
17
|
|
51
|
my ($verbose) = @_; |
878
|
17
|
50
|
|
|
|
87
|
if ($MUST_REBOOT) { |
|
|
50
|
|
|
|
|
|
879
|
0
|
|
|
|
|
0
|
die _estr "Operation not completed! ", |
880
|
|
|
|
|
|
|
"You must reboot to complete the installation.", |
881
|
|
|
|
|
|
|
"Sorry."; |
882
|
|
|
|
|
|
|
} elsif (defined $MUST_REBOOT & $verbose) { |
883
|
0
|
|
|
|
|
0
|
warn _estr "Installation will be completed at the next reboot.\n", |
884
|
|
|
|
|
|
|
"However it is not necessary to reboot immediately.\n"; |
885
|
|
|
|
|
|
|
} |
886
|
|
|
|
|
|
|
} |
887
|
|
|
|
|
|
|
|
888
|
|
|
|
|
|
|
=begin _undocumented |
889
|
|
|
|
|
|
|
|
890
|
|
|
|
|
|
|
=item install_rooted_file( $file ) |
891
|
|
|
|
|
|
|
|
892
|
|
|
|
|
|
|
Returns $file, or catfile($INSTALL_ROOT,$file) if $INSTALL_ROOT |
893
|
|
|
|
|
|
|
is defined. |
894
|
|
|
|
|
|
|
|
895
|
|
|
|
|
|
|
=item install_rooted_dir( $dir ) |
896
|
|
|
|
|
|
|
|
897
|
|
|
|
|
|
|
Returns $dir, or catdir($INSTALL_ROOT,$dir) if $INSTALL_ROOT |
898
|
|
|
|
|
|
|
is defined. |
899
|
|
|
|
|
|
|
|
900
|
|
|
|
|
|
|
=end _undocumented |
901
|
|
|
|
|
|
|
|
902
|
|
|
|
|
|
|
=cut |
903
|
|
|
|
|
|
|
|
904
|
|
|
|
|
|
|
|
905
|
|
|
|
|
|
|
sub install_rooted_file { |
906
|
34
|
50
|
|
34
|
1
|
112
|
if (defined $INSTALL_ROOT) { |
907
|
0
|
|
|
|
|
0
|
File::Spec->catfile($INSTALL_ROOT, $_[0]); |
908
|
|
|
|
|
|
|
} else { |
909
|
34
|
|
|
|
|
165
|
$_[0]; |
910
|
|
|
|
|
|
|
} |
911
|
|
|
|
|
|
|
} |
912
|
|
|
|
|
|
|
|
913
|
|
|
|
|
|
|
|
914
|
|
|
|
|
|
|
sub install_rooted_dir { |
915
|
36
|
50
|
|
36
|
1
|
150
|
if (defined $INSTALL_ROOT) { |
916
|
0
|
|
|
|
|
0
|
File::Spec->catdir($INSTALL_ROOT, $_[0]); |
917
|
|
|
|
|
|
|
} else { |
918
|
36
|
|
|
|
|
196
|
$_[0]; |
919
|
|
|
|
|
|
|
} |
920
|
|
|
|
|
|
|
} |
921
|
|
|
|
|
|
|
|
922
|
|
|
|
|
|
|
=begin _undocumented |
923
|
|
|
|
|
|
|
|
924
|
|
|
|
|
|
|
=item forceunlink( $file, $tryhard ) |
925
|
|
|
|
|
|
|
|
926
|
|
|
|
|
|
|
Tries to delete a file. If $tryhard is true then we will use whatever |
927
|
|
|
|
|
|
|
devious tricks we can to delete the file. Currently this only applies to |
928
|
|
|
|
|
|
|
Win32 in that it will try to use Win32API::File to schedule a delete at |
929
|
|
|
|
|
|
|
reboot. A wrapper for _unlink_or_rename(). |
930
|
|
|
|
|
|
|
|
931
|
|
|
|
|
|
|
=end _undocumented |
932
|
|
|
|
|
|
|
|
933
|
|
|
|
|
|
|
=cut |
934
|
|
|
|
|
|
|
|
935
|
|
|
|
|
|
|
|
936
|
|
|
|
|
|
|
sub forceunlink { |
937
|
2
|
|
|
2
|
1
|
23
|
my ( $file, $tryhard )= @_; #XXX OS-SPECIFIC |
938
|
2
|
|
|
|
|
44
|
_unlink_or_rename( $file, $tryhard, not("installing") ); |
939
|
|
|
|
|
|
|
} |
940
|
|
|
|
|
|
|
|
941
|
|
|
|
|
|
|
=begin _undocumented |
942
|
|
|
|
|
|
|
|
943
|
|
|
|
|
|
|
=item directory_not_empty( $dir ) |
944
|
|
|
|
|
|
|
|
945
|
|
|
|
|
|
|
Returns 1 if there is an .exists file somewhere in a directory tree. |
946
|
|
|
|
|
|
|
Returns 0 if there is not. |
947
|
|
|
|
|
|
|
|
948
|
|
|
|
|
|
|
=end _undocumented |
949
|
|
|
|
|
|
|
|
950
|
|
|
|
|
|
|
=cut |
951
|
|
|
|
|
|
|
|
952
|
|
|
|
|
|
|
sub directory_not_empty ($) { |
953
|
0
|
|
|
0
|
1
|
0
|
my($dir) = @_; |
954
|
0
|
|
|
|
|
0
|
my $files = 0; |
955
|
0
|
|
|
|
|
0
|
require File::Find; |
956
|
|
|
|
|
|
|
File::Find::find(sub { |
957
|
0
|
0
|
|
0
|
|
0
|
return if $_ eq ".exists"; |
958
|
0
|
0
|
|
|
|
0
|
if (-f) { |
959
|
0
|
|
|
|
|
0
|
$File::Find::prune++; |
960
|
0
|
|
|
|
|
0
|
$files = 1; |
961
|
|
|
|
|
|
|
} |
962
|
0
|
|
|
|
|
0
|
}, $dir); |
963
|
0
|
|
|
|
|
0
|
return $files; |
964
|
|
|
|
|
|
|
} |
965
|
|
|
|
|
|
|
|
966
|
|
|
|
|
|
|
=pod |
967
|
|
|
|
|
|
|
|
968
|
|
|
|
|
|
|
=item B I |
969
|
|
|
|
|
|
|
|
970
|
|
|
|
|
|
|
install_default(); |
971
|
|
|
|
|
|
|
install_default($fullext); |
972
|
|
|
|
|
|
|
|
973
|
|
|
|
|
|
|
Calls install() with arguments to copy a module from blib/ to the |
974
|
|
|
|
|
|
|
default site installation location. |
975
|
|
|
|
|
|
|
|
976
|
|
|
|
|
|
|
$fullext is the name of the module converted to a directory |
977
|
|
|
|
|
|
|
(ie. Foo::Bar would be Foo/Bar). If $fullext is not specified, it |
978
|
|
|
|
|
|
|
will attempt to read it from @ARGV. |
979
|
|
|
|
|
|
|
|
980
|
|
|
|
|
|
|
This is primarily useful for install scripts. |
981
|
|
|
|
|
|
|
|
982
|
|
|
|
|
|
|
B This function is not really useful because of the hard-coded |
983
|
|
|
|
|
|
|
install location with no way to control site vs core vs vendor |
984
|
|
|
|
|
|
|
directories and the strange way in which the module name is given. |
985
|
|
|
|
|
|
|
Consider its use discouraged. |
986
|
|
|
|
|
|
|
|
987
|
|
|
|
|
|
|
=cut |
988
|
|
|
|
|
|
|
|
989
|
|
|
|
|
|
|
sub install_default { |
990
|
0
|
0
|
|
0
|
1
|
0
|
@_ < 2 or _croak("install_default should be called with 0 or 1 argument"); |
991
|
0
|
0
|
|
|
|
0
|
my $FULLEXT = @_ ? shift : $ARGV[0]; |
992
|
0
|
0
|
|
|
|
0
|
defined $FULLEXT or die "Do not know to where to write install log"; |
993
|
0
|
|
|
|
|
0
|
my $INST_LIB = File::Spec->catdir($Curdir,"blib","lib"); |
994
|
0
|
|
|
|
|
0
|
my $INST_ARCHLIB = File::Spec->catdir($Curdir,"blib","arch"); |
995
|
0
|
|
|
|
|
0
|
my $INST_BIN = File::Spec->catdir($Curdir,'blib','bin'); |
996
|
0
|
|
|
|
|
0
|
my $INST_SCRIPT = File::Spec->catdir($Curdir,'blib','script'); |
997
|
0
|
|
|
|
|
0
|
my $INST_MAN1DIR = File::Spec->catdir($Curdir,'blib','man1'); |
998
|
0
|
|
|
|
|
0
|
my $INST_MAN3DIR = File::Spec->catdir($Curdir,'blib','man3'); |
999
|
|
|
|
|
|
|
|
1000
|
0
|
|
|
|
|
0
|
my @INST_HTML; |
1001
|
0
|
0
|
|
|
|
0
|
if($Config{installhtmldir}) { |
1002
|
0
|
|
|
|
|
0
|
my $INST_HTMLDIR = File::Spec->catdir($Curdir,'blib','html'); |
1003
|
0
|
|
|
|
|
0
|
@INST_HTML = ($INST_HTMLDIR => $Config{installhtmldir}); |
1004
|
|
|
|
|
|
|
} |
1005
|
|
|
|
|
|
|
|
1006
|
|
|
|
|
|
|
install({ |
1007
|
|
|
|
|
|
|
read => "$Config{sitearchexp}/auto/$FULLEXT/.packlist", |
1008
|
|
|
|
|
|
|
write => "$Config{installsitearch}/auto/$FULLEXT/.packlist", |
1009
|
|
|
|
|
|
|
$INST_LIB => (directory_not_empty($INST_ARCHLIB)) ? |
1010
|
|
|
|
|
|
|
$Config{installsitearch} : |
1011
|
|
|
|
|
|
|
$Config{installsitelib}, |
1012
|
|
|
|
|
|
|
$INST_ARCHLIB => $Config{installsitearch}, |
1013
|
|
|
|
|
|
|
$INST_BIN => $Config{installbin} , |
1014
|
|
|
|
|
|
|
$INST_SCRIPT => $Config{installscript}, |
1015
|
|
|
|
|
|
|
$INST_MAN1DIR => $Config{installman1dir}, |
1016
|
|
|
|
|
|
|
$INST_MAN3DIR => $Config{installman3dir}, |
1017
|
0
|
0
|
|
|
|
0
|
@INST_HTML, |
1018
|
|
|
|
|
|
|
},1,0,0); |
1019
|
|
|
|
|
|
|
} |
1020
|
|
|
|
|
|
|
|
1021
|
|
|
|
|
|
|
|
1022
|
|
|
|
|
|
|
=item B |
1023
|
|
|
|
|
|
|
|
1024
|
|
|
|
|
|
|
uninstall($packlist_file); |
1025
|
|
|
|
|
|
|
uninstall($packlist_file, $verbose, $dont_execute); |
1026
|
|
|
|
|
|
|
|
1027
|
|
|
|
|
|
|
Removes the files listed in a $packlist_file. |
1028
|
|
|
|
|
|
|
|
1029
|
|
|
|
|
|
|
If $verbose is true, will print out each file removed. Default is |
1030
|
|
|
|
|
|
|
false. |
1031
|
|
|
|
|
|
|
|
1032
|
|
|
|
|
|
|
If $dont_execute is true it will only print what it was going to do |
1033
|
|
|
|
|
|
|
without actually doing it. Default is false. |
1034
|
|
|
|
|
|
|
|
1035
|
|
|
|
|
|
|
=cut |
1036
|
|
|
|
|
|
|
|
1037
|
|
|
|
|
|
|
sub uninstall { |
1038
|
0
|
|
|
0
|
1
|
0
|
my($fil,$verbose,$dry_run) = @_; |
1039
|
0
|
|
0
|
|
|
0
|
$verbose ||= 0; |
1040
|
0
|
|
0
|
|
|
0
|
$dry_run ||= 0; |
1041
|
|
|
|
|
|
|
|
1042
|
0
|
0
|
|
|
|
0
|
die _estr "ERROR: no packlist file found: '$fil'" |
1043
|
|
|
|
|
|
|
unless -f $fil; |
1044
|
|
|
|
|
|
|
# my $my_req = $self->catfile(qw(auto ExtUtils Install forceunlink.al)); |
1045
|
|
|
|
|
|
|
# require $my_req; # Hairy, but for the first |
1046
|
0
|
|
|
|
|
0
|
require ExtUtils::Packlist; |
1047
|
0
|
|
|
|
|
0
|
my ($packlist) = ExtUtils::Packlist->new($fil); |
1048
|
0
|
|
|
|
|
0
|
foreach (sort(keys(%$packlist))) { |
1049
|
0
|
|
|
|
|
0
|
chomp; |
1050
|
0
|
0
|
|
|
|
0
|
print "unlink $_\n" if $verbose; |
1051
|
0
|
0
|
|
|
|
0
|
forceunlink($_,'tryhard') unless $dry_run; |
1052
|
|
|
|
|
|
|
} |
1053
|
0
|
0
|
|
|
|
0
|
print "unlink $fil\n" if $verbose; |
1054
|
0
|
0
|
|
|
|
0
|
forceunlink($fil, 'tryhard') unless $dry_run; |
1055
|
0
|
|
|
|
|
0
|
_do_cleanup($verbose); |
1056
|
|
|
|
|
|
|
} |
1057
|
|
|
|
|
|
|
|
1058
|
|
|
|
|
|
|
=begin _undocumented |
1059
|
|
|
|
|
|
|
|
1060
|
|
|
|
|
|
|
=item inc_uninstall($filepath,$libdir,$verbose,$dry_run,$ignore,$results) |
1061
|
|
|
|
|
|
|
|
1062
|
|
|
|
|
|
|
Remove shadowed files. If $ignore is true then it is assumed to hold |
1063
|
|
|
|
|
|
|
a filename to ignore. This is used to prevent spurious warnings from |
1064
|
|
|
|
|
|
|
occurring when doing an install at reboot. |
1065
|
|
|
|
|
|
|
|
1066
|
|
|
|
|
|
|
We now only die when failing to remove a file that has precedence over |
1067
|
|
|
|
|
|
|
our own, when our install has precedence we only warn. |
1068
|
|
|
|
|
|
|
|
1069
|
|
|
|
|
|
|
$results is assumed to contain a hashref which will have the keys |
1070
|
|
|
|
|
|
|
'uninstall' and 'uninstall_fail' populated with keys for the files |
1071
|
|
|
|
|
|
|
removed and values of the source files they would shadow. |
1072
|
|
|
|
|
|
|
|
1073
|
|
|
|
|
|
|
=end _undocumented |
1074
|
|
|
|
|
|
|
|
1075
|
|
|
|
|
|
|
=cut |
1076
|
|
|
|
|
|
|
|
1077
|
|
|
|
|
|
|
sub inc_uninstall { |
1078
|
8
|
|
|
8
|
1
|
90
|
my($filepath,$libdir,$verbose,$dry_run,$ignore,$results) = @_; |
1079
|
8
|
|
|
|
|
28
|
my($dir); |
1080
|
8
|
|
50
|
|
|
184
|
$ignore||=""; |
1081
|
8
|
|
|
|
|
543
|
my $file = (File::Spec->splitpath($filepath))[2]; |
1082
|
8
|
|
|
|
|
39
|
my %seen_dir = (); |
1083
|
|
|
|
|
|
|
|
1084
|
|
|
|
|
|
|
my @PERL_ENV_LIB = split $Config{path_sep}, defined $ENV{'PERL5LIB'} |
1085
|
8
|
50
|
0
|
|
|
523
|
? $ENV{'PERL5LIB'} : $ENV{'PERLLIB'} || ''; |
1086
|
|
|
|
|
|
|
|
1087
|
|
|
|
|
|
|
my @dirs=( @PERL_ENV_LIB, |
1088
|
|
|
|
|
|
|
@INC, |
1089
|
8
|
|
|
|
|
383
|
@Config{qw(archlibexp |
1090
|
|
|
|
|
|
|
privlibexp |
1091
|
|
|
|
|
|
|
sitearchexp |
1092
|
|
|
|
|
|
|
sitelibexp)}); |
1093
|
|
|
|
|
|
|
|
1094
|
|
|
|
|
|
|
#warn join "\n","---",@dirs,"---"; |
1095
|
8
|
|
|
|
|
48
|
my $seen_ours; |
1096
|
8
|
|
|
|
|
57
|
foreach $dir ( @dirs ) { |
1097
|
64
|
|
|
|
|
325
|
my $canonpath = _Is_VMS ? $dir : File::Spec->canonpath($dir); |
1098
|
64
|
100
|
|
|
|
164
|
next if $canonpath eq $Curdir; |
1099
|
62
|
100
|
|
|
|
343
|
next if $seen_dir{$canonpath}++; |
1100
|
44
|
|
|
|
|
359
|
my $targetfile = File::Spec->catfile($canonpath,$libdir,$file); |
1101
|
44
|
100
|
|
|
|
762
|
next unless -f $targetfile; |
1102
|
|
|
|
|
|
|
|
1103
|
|
|
|
|
|
|
# The reason why we compare file's contents is, that we cannot |
1104
|
|
|
|
|
|
|
# know, which is the file we just installed (AFS). So we leave |
1105
|
|
|
|
|
|
|
# an identical file in place |
1106
|
10
|
|
|
|
|
32
|
my $diff = 0; |
1107
|
10
|
100
|
66
|
|
|
271
|
if ( -f $targetfile && -s _ == -s $filepath) { |
1108
|
|
|
|
|
|
|
# We have a good chance, we can skip this one |
1109
|
4
|
|
|
|
|
28
|
$diff = _compare($filepath,$targetfile); |
1110
|
|
|
|
|
|
|
} else { |
1111
|
6
|
|
|
|
|
33
|
$diff++; |
1112
|
|
|
|
|
|
|
} |
1113
|
10
|
50
|
66
|
|
|
849
|
print "#$file and $targetfile differ\n" if $diff && $verbose > 1; |
1114
|
|
|
|
|
|
|
|
1115
|
10
|
100
|
66
|
|
|
74
|
if (!$diff or $targetfile eq $ignore) { |
1116
|
4
|
|
|
|
|
19
|
$seen_ours = 1; |
1117
|
4
|
|
|
|
|
16
|
next; |
1118
|
|
|
|
|
|
|
} |
1119
|
6
|
50
|
|
|
|
39
|
if ($dry_run) { |
1120
|
0
|
|
|
|
|
0
|
$results->{uninstall}{$targetfile} = $filepath; |
1121
|
0
|
0
|
|
|
|
0
|
if ($verbose) { |
1122
|
0
|
|
0
|
|
|
0
|
$Inc_uninstall_warn_handler ||= ExtUtils::Install::Warn->new(); |
1123
|
0
|
|
|
|
|
0
|
$libdir =~ s|^\./||s ; # That's just cosmetics, no need to port. It looks prettier. |
1124
|
0
|
|
|
|
|
0
|
$Inc_uninstall_warn_handler->add( |
1125
|
|
|
|
|
|
|
File::Spec->catfile($libdir, $file), |
1126
|
|
|
|
|
|
|
$targetfile |
1127
|
|
|
|
|
|
|
); |
1128
|
|
|
|
|
|
|
} |
1129
|
|
|
|
|
|
|
# if not verbose, we just say nothing |
1130
|
|
|
|
|
|
|
} else { |
1131
|
6
|
50
|
|
|
|
38
|
print "Unlinking $targetfile (shadowing?)\n" if $verbose; |
1132
|
|
|
|
|
|
|
eval { |
1133
|
6
|
50
|
66
|
|
|
250
|
die "Fake die for testing" |
1134
|
|
|
|
|
|
|
if $ExtUtils::Install::Testing and |
1135
|
|
|
|
|
|
|
ucase(File::Spec->canonpath($ExtUtils::Install::Testing)) eq ucase($targetfile); |
1136
|
2
|
|
|
|
|
55
|
forceunlink($targetfile,'tryhard'); |
1137
|
2
|
|
|
|
|
18
|
$results->{uninstall}{$targetfile} = $filepath; |
1138
|
2
|
|
|
|
|
22
|
1; |
1139
|
6
|
100
|
|
|
|
18
|
} or do { |
1140
|
4
|
|
|
|
|
37
|
$results->{fail_uninstall}{$targetfile} = $filepath; |
1141
|
4
|
100
|
|
|
|
18
|
if ($seen_ours) { |
1142
|
2
|
|
|
|
|
79
|
warn "Failed to remove probably harmless shadow file '$targetfile'\n"; |
1143
|
|
|
|
|
|
|
} else { |
1144
|
2
|
|
|
|
|
139
|
die "$@\n"; |
1145
|
|
|
|
|
|
|
} |
1146
|
|
|
|
|
|
|
}; |
1147
|
|
|
|
|
|
|
} |
1148
|
|
|
|
|
|
|
} |
1149
|
|
|
|
|
|
|
} |
1150
|
|
|
|
|
|
|
|
1151
|
|
|
|
|
|
|
=begin _undocumented |
1152
|
|
|
|
|
|
|
|
1153
|
|
|
|
|
|
|
=item run_filter($cmd,$src,$dest) |
1154
|
|
|
|
|
|
|
|
1155
|
|
|
|
|
|
|
Filter $src using $cmd into $dest. |
1156
|
|
|
|
|
|
|
|
1157
|
|
|
|
|
|
|
=end _undocumented |
1158
|
|
|
|
|
|
|
|
1159
|
|
|
|
|
|
|
=cut |
1160
|
|
|
|
|
|
|
|
1161
|
|
|
|
|
|
|
sub run_filter { |
1162
|
0
|
|
|
0
|
1
|
0
|
my ($cmd, $src, $dest) = @_; |
1163
|
0
|
|
|
|
|
0
|
local(*CMD, *SRC); |
1164
|
0
|
0
|
|
|
|
0
|
open(CMD, "|$cmd >$dest") || die "Cannot fork: $!"; |
1165
|
0
|
0
|
|
|
|
0
|
open(SRC, $src) || die "Cannot open $src: $!"; |
1166
|
0
|
|
|
|
|
0
|
my $buf; |
1167
|
0
|
|
|
|
|
0
|
my $sz = 1024; |
1168
|
0
|
|
|
|
|
0
|
while (my $len = sysread(SRC, $buf, $sz)) { |
1169
|
0
|
|
|
|
|
0
|
syswrite(CMD, $buf, $len); |
1170
|
|
|
|
|
|
|
} |
1171
|
0
|
|
|
|
|
0
|
close SRC; |
1172
|
0
|
0
|
|
|
|
0
|
close CMD or die "Filter command '$cmd' failed for $src"; |
1173
|
|
|
|
|
|
|
} |
1174
|
|
|
|
|
|
|
|
1175
|
|
|
|
|
|
|
=pod |
1176
|
|
|
|
|
|
|
|
1177
|
|
|
|
|
|
|
=item B |
1178
|
|
|
|
|
|
|
|
1179
|
|
|
|
|
|
|
pm_to_blib(\%from_to); |
1180
|
|
|
|
|
|
|
pm_to_blib(\%from_to, $autosplit_dir); |
1181
|
|
|
|
|
|
|
pm_to_blib(\%from_to, $autosplit_dir, $filter_cmd); |
1182
|
|
|
|
|
|
|
|
1183
|
|
|
|
|
|
|
Copies each key of %from_to to its corresponding value efficiently. |
1184
|
|
|
|
|
|
|
If an $autosplit_dir is provided, all .pm files will be autosplit into it. |
1185
|
|
|
|
|
|
|
Any destination directories are created. |
1186
|
|
|
|
|
|
|
|
1187
|
|
|
|
|
|
|
$filter_cmd is an optional shell command to run each .pm file through |
1188
|
|
|
|
|
|
|
prior to splitting and copying. Input is the contents of the module, |
1189
|
|
|
|
|
|
|
output the new module contents. |
1190
|
|
|
|
|
|
|
|
1191
|
|
|
|
|
|
|
You can have an environment variable PERL_INSTALL_ROOT set which will |
1192
|
|
|
|
|
|
|
be prepended as a directory to each installed file (and directory). |
1193
|
|
|
|
|
|
|
|
1194
|
|
|
|
|
|
|
By default verbose output is generated, setting the PERL_INSTALL_QUIET |
1195
|
|
|
|
|
|
|
environment variable will silence this output. |
1196
|
|
|
|
|
|
|
|
1197
|
|
|
|
|
|
|
=cut |
1198
|
|
|
|
|
|
|
|
1199
|
|
|
|
|
|
|
sub pm_to_blib { |
1200
|
6
|
|
|
6
|
1
|
16854
|
my($fromto,$autodir,$pm_filter) = @_; |
1201
|
|
|
|
|
|
|
|
1202
|
6
|
100
|
|
|
|
32
|
_mkpath($autodir,0,0755) if defined $autodir; |
1203
|
6
|
|
|
|
|
35
|
while(my($from, $to) = each %$fromto) { |
1204
|
6
|
50
|
66
|
|
|
250
|
if( -f $to && -s $from == -s $to && -M $to < -M $from ) { |
|
|
|
66
|
|
|
|
|
1205
|
0
|
0
|
|
|
|
0
|
print "Skip $to (unchanged)\n" unless $INSTALL_QUIET; |
1206
|
0
|
|
|
|
|
0
|
next; |
1207
|
|
|
|
|
|
|
} |
1208
|
|
|
|
|
|
|
|
1209
|
|
|
|
|
|
|
# When a pm_filter is defined, we need to pre-process the source first |
1210
|
|
|
|
|
|
|
# to determine whether it has changed or not. Therefore, only perform |
1211
|
|
|
|
|
|
|
# the comparison check when there's no filter to be ran. |
1212
|
|
|
|
|
|
|
# -- RAM, 03/01/2001 |
1213
|
|
|
|
|
|
|
|
1214
|
6
|
|
33
|
|
|
28
|
my $need_filtering = defined $pm_filter && length $pm_filter && |
1215
|
|
|
|
|
|
|
$from =~ /\.pm$/; |
1216
|
|
|
|
|
|
|
|
1217
|
6
|
100
|
66
|
|
|
42
|
if (!$need_filtering && 0 == _compare($from,$to)) { |
1218
|
3
|
50
|
|
|
|
588
|
print "Skip $to (unchanged)\n" unless $INSTALL_QUIET; |
1219
|
3
|
|
|
|
|
38
|
next; |
1220
|
|
|
|
|
|
|
} |
1221
|
3
|
50
|
|
|
|
407
|
if (-f $to){ |
1222
|
|
|
|
|
|
|
# we wont try hard here. its too likely to mess things up. |
1223
|
0
|
|
|
|
|
0
|
forceunlink($to); |
1224
|
|
|
|
|
|
|
} else { |
1225
|
3
|
|
|
|
|
109
|
_mkpath(dirname($to),0,0755); |
1226
|
|
|
|
|
|
|
} |
1227
|
3
|
50
|
|
|
|
12
|
if ($need_filtering) { |
1228
|
0
|
|
|
|
|
0
|
run_filter($pm_filter, $from, $to); |
1229
|
0
|
|
|
|
|
0
|
print "$pm_filter <$from >$to\n"; |
1230
|
|
|
|
|
|
|
} else { |
1231
|
3
|
|
|
|
|
15
|
_copy( $from, $to ); |
1232
|
3
|
50
|
|
|
|
988
|
print "cp $from $to\n" unless $INSTALL_QUIET; |
1233
|
|
|
|
|
|
|
} |
1234
|
3
|
|
|
|
|
90
|
my($mode,$atime,$mtime) = (stat $from)[2,8,9]; |
1235
|
3
|
|
|
|
|
56
|
utime($atime,$mtime+_Is_VMS,$to); |
1236
|
3
|
50
|
|
|
|
30
|
_chmod(0444 | ( $mode & 0111 ? 0111 : 0 ),$to); |
1237
|
3
|
50
|
|
|
|
28
|
next unless $from =~ /\.pm$/; |
1238
|
3
|
50
|
|
|
|
16
|
_autosplit($to,$autodir) if defined $autodir; |
1239
|
|
|
|
|
|
|
} |
1240
|
|
|
|
|
|
|
} |
1241
|
|
|
|
|
|
|
|
1242
|
|
|
|
|
|
|
|
1243
|
|
|
|
|
|
|
=begin _private |
1244
|
|
|
|
|
|
|
|
1245
|
|
|
|
|
|
|
=item _autosplit |
1246
|
|
|
|
|
|
|
|
1247
|
|
|
|
|
|
|
From 1.0307 back, AutoSplit will sometimes leave an open filehandle to |
1248
|
|
|
|
|
|
|
the file being split. This causes problems on systems with mandatory |
1249
|
|
|
|
|
|
|
locking (ie. Windows). So we wrap it and close the filehandle. |
1250
|
|
|
|
|
|
|
|
1251
|
|
|
|
|
|
|
=end _private |
1252
|
|
|
|
|
|
|
|
1253
|
|
|
|
|
|
|
=cut |
1254
|
|
|
|
|
|
|
|
1255
|
|
|
|
|
|
|
sub _autosplit { #XXX OS-SPECIFIC |
1256
|
3
|
|
|
3
|
|
1122
|
require AutoSplit; |
1257
|
3
|
|
|
|
|
9778
|
my $retval = AutoSplit::autosplit(@_); |
1258
|
3
|
50
|
|
|
|
2071
|
close *AutoSplit::IN if defined *AutoSplit::IN{IO}; |
1259
|
|
|
|
|
|
|
|
1260
|
3
|
|
|
|
|
25
|
return $retval; |
1261
|
|
|
|
|
|
|
} |
1262
|
|
|
|
|
|
|
|
1263
|
|
|
|
|
|
|
|
1264
|
|
|
|
|
|
|
package ExtUtils::Install::Warn; |
1265
|
|
|
|
|
|
|
|
1266
|
0
|
|
|
0
|
|
|
sub new { bless {}, shift } |
1267
|
|
|
|
|
|
|
|
1268
|
|
|
|
|
|
|
sub add { |
1269
|
0
|
|
|
0
|
|
|
my($self,$file,$targetfile) = @_; |
1270
|
0
|
|
|
|
|
|
push @{$self->{$file}}, $targetfile; |
|
0
|
|
|
|
|
|
|
1271
|
|
|
|
|
|
|
} |
1272
|
|
|
|
|
|
|
|
1273
|
|
|
|
|
|
|
sub DESTROY { |
1274
|
0
|
0
|
|
0
|
|
|
unless(defined $INSTALL_ROOT) { |
1275
|
0
|
|
|
|
|
|
my $self = shift; |
1276
|
0
|
|
|
|
|
|
my($file,$i,$plural); |
1277
|
0
|
|
|
|
|
|
foreach $file (sort keys %$self) { |
1278
|
0
|
0
|
|
|
|
|
$plural = @{$self->{$file}} > 1 ? "s" : ""; |
|
0
|
|
|
|
|
|
|
1279
|
0
|
|
|
|
|
|
print "## Differing version$plural of $file found. You might like to\n"; |
1280
|
0
|
|
|
|
|
|
for (0..$#{$self->{$file}}) { |
|
0
|
|
|
|
|
|
|
1281
|
0
|
|
|
|
|
|
print "rm ", $self->{$file}[$_], "\n"; |
1282
|
0
|
|
|
|
|
|
$i++; |
1283
|
|
|
|
|
|
|
} |
1284
|
|
|
|
|
|
|
} |
1285
|
0
|
0
|
|
|
|
|
$plural = $i>1 ? "all those files" : "this file"; |
1286
|
|
|
|
|
|
|
my $inst = (_invokant() eq 'ExtUtils::MakeMaker') |
1287
|
0
|
0
|
0
|
|
|
|
? ( $Config::Config{make} || 'make' ).' install' |
1288
|
|
|
|
|
|
|
. ( ExtUtils::Install::_Is_VMS ? '/MACRO="UNINST"=1' : ' UNINST=1' ) |
1289
|
|
|
|
|
|
|
: './Build install uninst=1'; |
1290
|
0
|
|
|
|
|
|
print "## Running '$inst' will unlink $plural for you.\n"; |
1291
|
|
|
|
|
|
|
} |
1292
|
|
|
|
|
|
|
} |
1293
|
|
|
|
|
|
|
|
1294
|
|
|
|
|
|
|
=begin _private |
1295
|
|
|
|
|
|
|
|
1296
|
|
|
|
|
|
|
=item _invokant |
1297
|
|
|
|
|
|
|
|
1298
|
|
|
|
|
|
|
Does a heuristic on the stack to see who called us for more intelligent |
1299
|
|
|
|
|
|
|
error messages. Currently assumes we will be called only by Module::Build |
1300
|
|
|
|
|
|
|
or by ExtUtils::MakeMaker. |
1301
|
|
|
|
|
|
|
|
1302
|
|
|
|
|
|
|
=end _private |
1303
|
|
|
|
|
|
|
|
1304
|
|
|
|
|
|
|
=cut |
1305
|
|
|
|
|
|
|
|
1306
|
|
|
|
|
|
|
sub _invokant { |
1307
|
0
|
|
|
0
|
|
|
my @stack; |
1308
|
0
|
|
|
|
|
|
my $frame = 0; |
1309
|
0
|
|
|
|
|
|
while (my $file = (caller($frame++))[1]) { |
1310
|
0
|
|
|
|
|
|
push @stack, (File::Spec->splitpath($file))[2]; |
1311
|
|
|
|
|
|
|
} |
1312
|
|
|
|
|
|
|
|
1313
|
0
|
|
|
|
|
|
my $builder; |
1314
|
0
|
|
|
|
|
|
my $top = pop @stack; |
1315
|
0
|
0
|
0
|
|
|
|
if ($top =~ /^Build/i || exists($INC{'Module/Build.pm'})) { |
1316
|
0
|
|
|
|
|
|
$builder = 'Module::Build'; |
1317
|
|
|
|
|
|
|
} else { |
1318
|
0
|
|
|
|
|
|
$builder = 'ExtUtils::MakeMaker'; |
1319
|
|
|
|
|
|
|
} |
1320
|
0
|
|
|
|
|
|
return $builder; |
1321
|
|
|
|
|
|
|
} |
1322
|
|
|
|
|
|
|
|
1323
|
|
|
|
|
|
|
=pod |
1324
|
|
|
|
|
|
|
|
1325
|
|
|
|
|
|
|
=back |
1326
|
|
|
|
|
|
|
|
1327
|
|
|
|
|
|
|
=head1 ENVIRONMENT |
1328
|
|
|
|
|
|
|
|
1329
|
|
|
|
|
|
|
=over 4 |
1330
|
|
|
|
|
|
|
|
1331
|
|
|
|
|
|
|
=item B |
1332
|
|
|
|
|
|
|
|
1333
|
|
|
|
|
|
|
Will be prepended to each install path. |
1334
|
|
|
|
|
|
|
|
1335
|
|
|
|
|
|
|
=item B |
1336
|
|
|
|
|
|
|
|
1337
|
|
|
|
|
|
|
Will prevent the automatic use of INSTALL.SKIP as the install skip file. |
1338
|
|
|
|
|
|
|
|
1339
|
|
|
|
|
|
|
=item B |
1340
|
|
|
|
|
|
|
|
1341
|
|
|
|
|
|
|
If there is no INSTALL.SKIP file in the make directory then this value |
1342
|
|
|
|
|
|
|
can be used to provide a default. |
1343
|
|
|
|
|
|
|
|
1344
|
|
|
|
|
|
|
=item B |
1345
|
|
|
|
|
|
|
|
1346
|
|
|
|
|
|
|
If this environment variable is true then normal install processes will |
1347
|
|
|
|
|
|
|
always overwrite older identical files during the install process. |
1348
|
|
|
|
|
|
|
|
1349
|
|
|
|
|
|
|
Note that the alias EU_ALWAYS_COPY will be supported if EU_INSTALL_ALWAYS_COPY |
1350
|
|
|
|
|
|
|
is not defined until at least the 1.50 release. Please ensure you use the |
1351
|
|
|
|
|
|
|
correct EU_INSTALL_ALWAYS_COPY. |
1352
|
|
|
|
|
|
|
|
1353
|
|
|
|
|
|
|
=back |
1354
|
|
|
|
|
|
|
|
1355
|
|
|
|
|
|
|
=head1 AUTHOR |
1356
|
|
|
|
|
|
|
|
1357
|
|
|
|
|
|
|
Original author lost in the mists of time. Probably the same as Makemaker. |
1358
|
|
|
|
|
|
|
|
1359
|
|
|
|
|
|
|
Production release currently maintained by demerphq C, |
1360
|
|
|
|
|
|
|
extensive changes by Michael G. Schwern. |
1361
|
|
|
|
|
|
|
|
1362
|
|
|
|
|
|
|
Send bug reports via http://rt.cpan.org/. Please send your |
1363
|
|
|
|
|
|
|
generated Makefile along with your report. |
1364
|
|
|
|
|
|
|
|
1365
|
|
|
|
|
|
|
=head1 LICENSE |
1366
|
|
|
|
|
|
|
|
1367
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or |
1368
|
|
|
|
|
|
|
modify it under the same terms as Perl itself. |
1369
|
|
|
|
|
|
|
|
1370
|
|
|
|
|
|
|
See L |
1371
|
|
|
|
|
|
|
|
1372
|
|
|
|
|
|
|
|
1373
|
|
|
|
|
|
|
=cut |
1374
|
|
|
|
|
|
|
|
1375
|
|
|
|
|
|
|
1; |