On 2/12/06, demerphq [EMAIL PROTECTED] wrote:
Hi, the attached patch cleans up and enhances the original handling of
the install at reboot stuff. Its against the seperated out bundle you
mention above.
Er, i forgot the patch. Sorry.
Yves
--
perl -Mre=debug -e /just|another|perl|hacker/
diff -wur ExtUtils-Install-1.35/META.yml ExtUtils-Install/META.yml
--- ExtUtils-Install-1.35/META.yml 2006-02-02 05:45:59.0 +0100
+++ ExtUtils-Install/META.yml 2006-02-12 17:48:13.0 +0100
@@ -1,8 +1,8 @@
---
name: ExtUtils-Install
-version: 1.35
+version: 1.36
author:
- - Michael G Schwern [EMAIL PROTECTED]
+ - 'Michael G Schwern [EMAIL PROTECTED]'
abstract: install files from here to there
license: perl
resources:
@@ -30,7 +30,7 @@
provides:
ExtUtils::Install:
file: lib/ExtUtils/Install.pm
-version: 1.35
+version: 1.36
ExtUtils::Install::Warn:
file: lib/ExtUtils/Install.pm
ExtUtils::Installed:
diff -wur ExtUtils-Install-1.35/lib/ExtUtils/Install.pm ExtUtils-Install/lib/ExtUtils/Install.pm
--- ExtUtils-Install-1.35/lib/ExtUtils/Install.pm 2006-02-02 05:22:08.0 +0100
+++ ExtUtils-Install/lib/ExtUtils/Install.pm 2006-02-12 19:46:13.140625000 +0100
@@ -1,8 +1,8 @@
package ExtUtils::Install;
use 5.00503;
-use vars qw(@ISA @EXPORT $VERSION);
-$VERSION = '1.35';
+use vars qw(@ISA @EXPORT $VERSION $MUST_REBOOT);
+$VERSION = '1.36';
use Exporter;
use Carp ();
@@ -11,6 +11,10 @@
@EXPORT = ('install','uninstall','pm_to_blib', 'install_default');
$Is_VMS = $^O eq 'VMS';
$Is_MacPerl = $^O eq 'MacOS';
+$Is_Win32 = $^O eq 'MSWin32';
+
+# used by win32 stuff only currently
+my $Has_APIFile; # when defined tells whether Win32API::File is installed
my $Inc_uninstall_warn_handler;
@@ -22,6 +26,17 @@
my $Curdir = File::Spec-curdir;
my $Updir = File::Spec-updir;
+sub _chmod($$;$) {
+my ( $mode, $item, $verbose )[EMAIL PROTECTED];
+$verbose ||= 0;
+if (chmod $mode, $item) {
+print chmod($mode, $item)\n if $verbose 1;
+} else {
+my $err=$!;
+warn Failed chmod($mode, $item): $err\n
+if -e $item;
+}
+}
=head1 NAME
@@ -47,6 +62,27 @@
ExtUtils::MakeMaker handles the installation and deinstallation of
perl modules. They are not designed as general purpose tools.
+=begin DeveloperNotes
+
+On some operating systems such as Win32 installation may not be possible
+until after a reboot has occured. This can have varying consequences:
+removing an old DLL does not impact programs using the new one, but if
+a new DLL cannot be installed properly until reboot then anything
+depending on it must wait. The package variable
+
+ $ExtUtils::Install::MUST_REBOOT
+
+is used to store this status.
+
+If this variable is true then such an operation has occured and
+anything depending on this module cannot proceed until a reboot
+has occured.
+
+If this value is defined but false then such an operation has
+ocurred, but should not impact later operations.
+
+=end DeveloperNotes
+
=head2 Functions
=over 4
@@ -80,7 +116,7 @@
sub install {
my($from_to,$verbose,$nonono,$inc_uninstall) = @_;
-$verbose ||= 0;
+$verbose ||= $ENV{DEBUG_EUMM} || 0;
$nonono ||= 0;
use Cwd qw(cwd);
@@ -91,9 +127,7 @@
use File::Path qw(mkpath);
use File::Compare qw(compare);
-my $win32_special=!$nonono
- $^O eq 'MSWin32'
- eval { require Win32API::File; 1 };
+my $win32_special;
my(%from_to) = %$from_to;
my(%pack, $dir, $warn_permissions);
my($packlist) = ExtUtils::Packlist-new();
@@ -173,24 +207,48 @@
}
if ($diff){
- if ($win32_special -f $targetfile !unlink $targetfile) {
- print Can't remove existing '$targetfile': $!\n;
+ if ( !$nonono $Is_Win32
+ -f $targetfile
+ !unlink $targetfile )
+ {
+ my $error=$!;
+
+ $Has_APIFile= eval { require Win32API::File; 1 } || 0
+ if ! defined $Has_APIFile;
+
+Carp::croak(
+Cannot unlink $targetfile: $error\n,
+If you install Win32API::File I can use ,
+it to try to complete the install at reboot\n
+) if ! $Has_APIFile;
+
+ print Can't remove existing '$targetfile': $error\n;
+
+ # make a temporary file name to use for installation.
+ # if we can rename then the temp file will used for the
+ # old file, if we can't then the file will be installed as
+ # the temp name, and renamed into the correct name at boot
my $tmp= AAA;
++$tmp while -e $targetfile.$tmp;
$tmp= $targetfile.$tmp;
if ( rename $targetfile, $tmp ) {
+ _chmod(0666, $tmp, $verbose);
print However