Re: [PATCH] Re: replacing inuse Win files (was Re: Help with aCwd.pm build error)

2006-02-12 Thread demerphq
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 

Re: [PATCH] Re: replacing inuse Win files (was Re: Help with aCwd.pm build error)

2006-02-03 Thread demerphq
On 2/3/06, Ken Williams [EMAIL PROTECTED] wrote:

 On Feb 1, 2006, at 11:09 PM, Randy W. Sims wrote:

 
  If Schwern will give the nod, Ken, do you want to add this to the MB
  project? Or anyone else interested in maintainership?

 I'd be happy to host it in M::B's space, but I'm afraid I can donate
 approximately zero tuits to helping maintain it.

If needed Ill volunteer take over maintenance of this (my cpan id is
YVES) with Max (cpanid:CORION) as co-maintainer on the *nixy side.
I've cc'ed him on this mail. We'd be happy if other maintainers were
added I should think, especially if they were handling VMS. :-)

BTW, regardless of who takes over, the uninstall behaviour needs a
similar patch to what we did for install.

cheers,
Yves

--
perl -Mre=debug -e /just|another|perl|hacker/


Re: [PATCH] Re: replacing inuse Win files (was Re: Help with aCwd.pm build error)

2006-02-03 Thread Ken Williams


On Feb 3, 2006, at 3:04 AM, demerphq wrote:


If needed Ill volunteer take over maintenance of this (my cpan id is
YVES) with Max (cpanid:CORION) as co-maintainer on the *nixy side.
I've cc'ed him on this mail. We'd be happy if other maintainers were
added I should think, especially if they were handling VMS. :-)


There was also someone else who stepped forward at some point (or maybe 
everyone else stepped back) to take it over a few months ago, but I 
guess it hasn't happened and I'll be danged if I can't remember who it 
was.  Schwern, you remember?


 -Ken



Re: [PATCH] Re: replacing inuse Win files (was Re: Help with aCwd.pm build error)

2006-02-02 Thread Ken Williams


On Feb 1, 2006, at 11:09 PM, Randy W. Sims wrote:



If Schwern will give the nod, Ken, do you want to add this to the MB 
project? Or anyone else interested in maintainership?


I'd be happy to host it in M::B's space, but I'm afraid I can donate 
approximately zero tuits to helping maintain it.


 -Ken



Re: [PATCH] Re: replacing inuse Win files (was Re: Help with aCwd.pm build error)

2006-02-01 Thread demerphq
On 2/2/06, Randy W. Sims [EMAIL PROTECTED] wrote:
 Randy W. Sims wrote:
  Ken Williams wrote:

  So, does this mean that someone with this EU::MM::Install would be able to 
  upgrade Cwd on windows now?
 ...
  If the answer is yes, could we get this into EU::MM standalone release
  too?
 
  Better would be for someone to take over EU::Install which is what
  Schwern wanted to happen, and release it standalone. The current version
  of MakeMaker is already setup for this scenario:

 EU::Install, EU::Installed,  EU::Packlist seem to fit together well
 enough, so I packaged them together. All tests pass.

 If this is a good arrangement, we just need the cvs logs for the 3
 modules and their test files. Tests borrow some of MakeMakers
 scaffolding; this might could be made more independent if necessary.

   http://thepierianspring.org/perl/ExtUtils-Install-1.35.tar.gz

 If Schwern will give the nod, Ken, do you want to add this to the MB
 project? Or anyone else interested in maintainership?

Assuming you mean as a standalone package maintained by the MB project
Id say that would be fine and I'd be happy to assist in any further
issues relating to it and Win32.

cheers,
yves


--
perl -Mre=debug -e /just|another|perl|hacker/