List Info

Thread: Module-Build-0.2801




Module-Build-0.2801
user name
2006-12-26 07:37:03
With this patch, Module-Build-0.2801 passes all its tests on
OS/2.

Enjoy,
Ilya

Base.pm: support deletion/overwrite of read-only files;
t/ppm.t: was supposing that the name of the generated DLL is
the
	 module name;
t/lib/MBTest.pm: was thinking that ony Win32 has executable
extensions...

--- ./lib/Module/Build/Base.pm.orig	Sat May 20 22:11:16 2006
+++ ./lib/Module/Build/Base.pm	Mon Dec 25 22:45:22 2006
 -2307,7
+2307,8  eval 'exec $interpreter $arg -S $0 ${1
     
     rename("$file.new", $file)
       or die "Can't rename $file.new to $file:
$!";
-    
+
+    chmod 0666, "$file.bak";
     unlink "$file.bak"
       or $self->log_warn("Couldn't clean up
$file.bak, leaving it there");
     
 -3960,7
+3961,12  sub copy_if_modified {
   File::Path::mkpath(File::Basename::dirname($to_path), 0,
0777);
   
   $self->log_info("$file -> $to_pathn") if
$args;
-  File::Copy::copy($file, $to_path) or die "Can't
copy('$file', '$to_path'): $!";
+  if ($^O eq 'os2') {		# copy will not overwrite; 0x1 =
overwrite
+    chmod 0666, $to_path;
+    File::Copy::syscopy($file, $to_path, 0x1) or die
"Can't copy('$file', '$to_path'): $!";
+  } else {
+    File::Copy::copy($file, $to_path) or die "Can't
copy('$file', '$to_path'): $!";
+  }
   # mode is read-only + (executable if source is
executable)
   my $mode = 0444 | ( $self->is_executable($file) ? 0111
: 0 );
   chmod( $mode, $to_path );
--- ./t/ppm.t.orig	Sat May 20 22:11:16 2006
+++ ./t/ppm.t	Mon Dec 25 23:20:52 2006
 -123,7
+123,9  $tar->read( $tarfile, 1 );
 
 my $files = { map { $_ => 1 } $tar->list_files };
 
-exists_ok($files, 'blib/arch/auto/Simple/Simple.' .
$mb->config('dlext'));
+my $fname = 'Simple';
+$fname = DynaLoader::mod2fname [$fname] if defined
&DynaLoader::mod2fname;
+exists_ok($files, "blib/arch/auto/Simple/$fname."
. $mb->config('dlext'));
 exists_ok($files, 'blib/lib/Simple.pm');
 exists_ok($files, 'blib/script/hello');
 
--- ./t/tilde.t.orig	Sat May 20 22:11:16 2006
+++ ./t/tilde.t	Mon Dec 25 23:26:52 2006
 -46,8
+46,8  sub run_sample {
     $mb = run_sample( install_base => '~/foo' );
     is( $mb->install_base,     
"$ENV/foo" );
 
-    $mb = run_sample( install_base => '~~' );
-    is( $mb->install_base,      '~~' );
+    $mb = run_sample( install_base => '~~' ); # On os2,
all users are equal
+    is( $mb->install_base, $^O eq 'os2' ? $ENV :
'~~' );
 
     $mb = run_sample( install_base => 'foo~' );
     is( $mb->install_base,      'foo~' );
--- ./t/lib/MBTest.pm.orig	Sat May 20 22:11:16 2006
+++ ./t/lib/MBTest.pm	Mon Dec 25 22:40:40 2006
 -80,7
+80,7  sub find_in_path {
   my path = split $Config, $ENV;
   my exe_ext = $^O eq 'MSWin32' ? ('', # may have
extension already
     split($Config, $ENV ||
'.com;.exe;.bat')) :
-    ('');
+    ($^O eq 'os2' ? ('', qw(.exe .com .pl .cmd .bat .sh
.ksh)) : '');
   foreach (path) {
     my $fullpath = File::Spec->catfile($_, $thing);
     foreach my $ext ( exe_ext ) {
Module-Build-0.2801
user name
2006-12-27 04:59:44
Hi Ilya,

Thanks for this patch.  I've applied almost all of these in
modified  
forms:

  - In t/tilde.t, I think the test is silly and I'm just
removing it.

  - In fix_shebang_line(), I've changed to use
delete_filepath()  
instead of unlink().

  - In t/lib/MBTest.pm I (ex|ab)stracted out an exe_exts()
function.

  - In t/ppm.t I applied your patch verbatim

For the copy_if_modified() chunk, would it be worth
abstracting out a  
copy_file() method or something, which could be overridden
in  
Platform/os2.pm ?  Or would that seem like overkill?  I do
sort of  
wince whenever I see $^O checks in Build/Base.pm.

Latest version is at http:
//svn.perl.org/modules/Module-Build/trunk/  
for your perusal if desired.  Note that the latest release
is  
actually 0.2806.

  -Ken

On Dec 26, 2006, at 1:37 AM, Ilya Zakharevich wrote:

> With this patch, Module-Build-0.2801 passes all its
tests on OS/2.
>
> Enjoy,
> Ilya
>
> Base.pm: support deletion/overwrite of read-only files;
> t/ppm.t: was supposing that the name of the generated
DLL is the
> 	 module name;
> t/lib/MBTest.pm: was thinking that ony Win32 has
executable  
> extensions...

Module-Build-0.2801
user name
2006-12-27 08:44:49
On Tue, Dec 26, 2006 at 10:59:44PM -0600, Ken Williams
wrote:
> For the copy_if_modified() chunk, would it be worth
abstracting out a 
> copy_file() method or something, which could be
overridden in Platform/os2.pm ? 
>  Or would that seem like overkill?  I do sort of wince
whenever I see $^O 
> checks in Build/Base.pm.

I share the general sentiment.  However, onw should know
some measure;
for the simplest tasks, having overridable methods looks
like an overkill.

On the gripping hand, the need *is* there; but IMO, the
stuff belongs
to File::Copy: there should be a way to specify disposition
of a
target: what to do if it exists, and what to do if it is
read-only.

[Likewise for file rename, but there there is a whole MATRIX
of
possible choices: what to do if the target
exists/is-read-only, and
what to do if the source is read-only (so will refuse
renaming).]

Thanks for your other edits too,
Ilya
Module-Build-0.2801
user name
2006-12-28 03:11:41
On Dec 27, 2006, at 2:44 AM, Ilya Zakharevich wrote:

> On Tue, Dec 26, 2006 at 10:59:44PM -0600, Ken Williams
wrote:
>> For the copy_if_modified() chunk, would it be worth
abstracting out a
>> copy_file() method or something, which could be
overridden in  
>> Platform/os2.pm ?
>>  Or would that seem like overkill?  I do sort of
wince whenever I  
>> see $^O
>> checks in Build/Base.pm.
>
> I share the general sentiment.  However, onw should
know some measure;
> for the simplest tasks, having overridable methods
looks like an  
> overkill.
>
> On the gripping hand, the need *is* there; but IMO, the
stuff belongs
> to File::Copy: there should be a way to specify
disposition of a
> target: what to do if it exists, and what to do if it
is read-only.

Yeah, that's sort of what I was thinking too.  I'll just
commit the  
copy_if_modified() patch as you wrote it, then.

  -Ken

[1-4]

about | contact  Other archives ( Real Estate discussion Medical topics )