Changeset 6324
- Timestamp:
- 02/14/10 21:29:00 (3 years ago)
- File:
-
- 1 edited
-
trunk/core/pseudo-install.pl (modified) (12 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/pseudo-install.pl
r6323 r6324 106 106 sub installModule { 107 107 my $module = shift; 108 $module =~ s#/+$##; #remove trailing slashes108 $module =~ s#/+$##; #remove trailing slashes 109 109 print "Processing $module\n"; 110 110 my $subdir = 'Plugins'; … … 166 166 my ( $moduleDir, $dir, $file ) = @_; 167 167 File::Path::mkpath($dir); 168 if ( -e "$moduleDir/$file" ) {168 if ( -e "$moduleDir/$file" ) { 169 169 File::Copy::copy( "$moduleDir/$file", $file ) 170 || die "Couldn't install $file: $!";170 || die "Couldn't install $file: $!"; 171 171 } 172 172 print "Copied $file\n"; … … 191 191 192 192 my $dest = _cleanPath( readlink( $path . $c ), $path ); 193 $dest =~ m#/([^/]*)$#; # Remove slashes193 $dest =~ m#/([^/]*)$#; # Remove slashes 194 194 unless ( $1 eq $c ) { 195 195 print STDERR <<HERE; … … 235 235 elsif (( $c eq 'TWiki' ) 236 236 or ( $c eq 'Plugins' && $path =~ m#/(Fosw|TW)iki/$# ) ) 237 { # Special case237 { # Special case 238 238 $path .= "$c/"; 239 239 print STDERR "mkdir $path\n"; … … 256 256 } 257 257 } 258 258 259 # Test special case when source is compressed or uncompressed 259 260 my $found = -f "$moduleDir/$file"; 260 unless( $found ) { 261 if( $file =~ /^(.+)(\.(?:un)?compressed|_src)(\..+)$/ && -f "$moduleDir/$1$3" ) { 262 symlink( _cleanPath("$moduleDir/$file" ), _cleanPath("$moduleDir/$1$3") ) 263 or die "Failed to link $moduleDir/$1$3 to moduleDir/$file: $!"; 261 unless ($found) { 262 if ( $file =~ /^(.+)(\.(?:un)?compressed|_src)(\..+)$/ 263 && -f "$moduleDir/$1$3" ) 264 { 265 symlink( _cleanPath("$moduleDir/$file"), 266 _cleanPath("$moduleDir/$1$3") ) 267 or die "Failed to link $moduleDir/$1$3 to moduleDir/$file: $!"; 264 268 print "Linked $file as $1$3\n"; 265 269 $found++; 266 } elsif ( my ($src, $ext) = $file =~ /^(.+)(\.[^\.]+)$/ ) { 267 for my $kind ( qw( .uncompressed .compressed _src ) ) { 268 if( -f "$moduleDir/$src$kind$ext" ) { 269 symlink( _cleanPath("$moduleDir/$src$kind$ext"), _cleanPath("$moduleDir/$file" ) ) 270 or die "Failed to link $moduleDir/$file to $moduleDir/$src$kind$ext: $!"; 270 } 271 elsif ( my ( $src, $ext ) = $file =~ /^(.+)(\.[^\.]+)$/ ) { 272 for my $kind (qw( .uncompressed .compressed _src )) { 273 if ( -f "$moduleDir/$src$kind$ext" ) { 274 symlink( 275 _cleanPath("$moduleDir/$src$kind$ext"), 276 _cleanPath("$moduleDir/$file") 277 ) 278 or die 279 "Failed to link $moduleDir/$file to $moduleDir/$src$kind$ext: $!"; 271 280 print "Linked $file as $src$kind$ext\n"; 272 281 $found++; … … 276 285 } 277 286 } 278 unless ( $found) {287 unless ($found) { 279 288 print STDERR "WARNING: Cannot find source file $moduleDir/#/$file\n"; 280 289 return; … … 288 297 # tree so it unlinks the directories, and not the leaf files. 289 298 # Special case when install created symlink to (un)?compressed version 290 if ( -l "$moduleDir/$file" ) {299 if ( -l "$moduleDir/$file" ) { 291 300 unlink "$moduleDir/$file"; 292 301 print "Unlinked $moduleDir/$file\n"; … … 319 328 if ( $force || ( !-e $localSiteCfg ) ) { 320 329 my $grep = 'grep'; 321 $grep = 'find' if ($^O eq 'MSWin32'); #let windows play too 322 my $localsite = `$grep "Foswiki::cfg" $foswikidir/lib/Foswiki.spec`; 323 if ($^O eq 'MSWin32') { 330 $grep = 'find' if ( $^O eq 'MSWin32' ); #let windows play too 331 my $localsite = `$grep "Foswiki::cfg" $foswikidir/lib/Foswiki.spec`; 332 if ( $^O eq 'MSWin32' ) { 333 324 334 #oh wow, windows find is retarded 325 335 $localsite =~ s|^(-------.*)$||m; 336 326 337 #prefer non-grep SEARCH 327 $localsite =~ s|^(.*)SearchAlgorithms::Forking(.*)$|$1SearchAlgorithms::PurePerl$2|m; 338 $localsite =~ 339 s|^(.*)SearchAlgorithms::Forking(.*)$|$1SearchAlgorithms::PurePerl$2|m; 340 328 341 #RscLite 329 342 $localsite =~ s|^(.*)RcsWrap(.*)$|$1RcsLite$2|m; … … 432 445 433 446 my @modules; 434 for my $arg ( @ARGV ) { 435 if ( $arg eq "all" ) { 436 foreach my $dir (@extensions_path) { 437 opendir D, $dir or next; 438 push @modules, 439 grep { /(?:Tag|Plugin|Contrib|Skin|AddOn)$/ && -d "$dir/$_" } readdir D; 447 for my $arg (@ARGV) { 448 if ( $arg eq "all" ) { 449 foreach my $dir (@extensions_path) { 450 opendir D, $dir or next; 451 push @modules, 452 grep { /(?:Tag|Plugin|Contrib|Skin|AddOn)$/ && -d "$dir/$_" } 453 readdir D; 440 454 closedir D; 441 455 } … … 445 459 local $/ = "\n"; 446 460 @modules = 447 map { /(\w+)$/; $1 }448 grep { /^!include/ } <F>;461 map { /(\w+)$/; $1 } 462 grep { /^!include/ } <F>; 449 463 close F; 450 464 push @modules, 'BuildContrib', 'TestFixturePlugin', 'UnitTestContrib' 451 if $arg eq 'developer';465 if $arg eq 'developer'; 452 466 } 453 467 else { … … 466 480 my $libDir = installModule($module); 467 481 if ($libDir) { 468 push( @installedModules, $module);482 push( @installedModules, $module ); 469 483 if ( ( !$installing || $autoenable ) && $module =~ /Plugin$/ ) { 470 484 enablePlugin( $module, $installing, $libDir ); … … 473 487 } 474 488 475 print ' '.(($#installedModules > 0) ? join( ", ", @installedModules ) : 'Nothing'). ' '. ( $installing ? 'i' : 'uni' ). "nstalled\n"; 489 print ' ' 490 . ( ( $#installedModules > 0 ) ? join( ", ", @installedModules ) : 'Nothing' ) 491 . ' ' 492 . ( $installing ? 'i' : 'uni' ) 493 . "nstalled\n";
Note: See TracChangeset
for help on using the changeset viewer.
