Changeset 5639 for branches/Release01x00/core/tools/extender.pl
- Timestamp:
- 11/25/09 15:51:48 (2 years ago)
- File:
-
- 1 edited
-
branches/Release01x00/core/tools/extender.pl (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/Release01x00/core/tools/extender.pl
r5638 r5639 34 34 use File::Copy; 35 35 use File::Path; 36 use Getopt::Std; 36 37 37 38 no warnings 'redefine'; 38 39 39 my $noconfirm = 0; 40 my $downloadOK = 0; 41 my $alreadyUnpacked = 0; 42 my $reuseOK = 0; 43 my $inactive = 0; 40 my $noconfirm; 41 my $downloadOK; 42 my $alreadyUnpacked; 43 my $reuseOK; 44 my $inactive; 45 my $noCPAN; 46 my $action; 44 47 my $session; 45 48 my %available; … … 58 61 $installationRoot = $1; 59 62 63 sub processParameters { 64 my %opts; 65 getopts('acdnru', \%opts); 66 $noconfirm = $opts{a}; 67 $noCPAN = $opts{c}; 68 $downloadOK = $opts{d}; 69 $reuseOK = $opts{r}; 70 $inactive = $opts{n}; 71 $alreadyUnpacked = $opts{u}; 72 if( @ARGV > 1 ) { 73 usage(); 74 die 'Too many parameters: ' . join(" ", @ARGV); 75 } 76 $action = $ARGV[0]; 77 $action ||= 'install'; # Default target is install 78 } 79 60 80 # Check if we were invoked from configure 61 81 # by looking at the call stack … … 67 87 } 68 88 } 69 return 0; 70 } 89 return; 90 } 91 71 92 my $check_perl_module = sub { 72 93 my $module = shift; 73 94 74 95 if ( $module =~ /^CPAN/ ) { 75 76 # Check how we were invoked as CPAN shouldn't 77 # be loaded from the configure 78 if (running_from_configure) { 79 print "Running from configure, disabling $module\n"; 96 if ($noCPAN) { 97 print "CPAN is disabled, disabling $module\n"; 80 98 return $available{$module} = 0; 81 99 } … … 100 118 } 101 119 120 processParameters(); 102 121 # read setlib.cfg 103 122 chdir('bin'); … … 126 145 } 127 146 &$check_perl_module('CPAN'); 128 129 $session->finish();130 undef $session;131 147 } 132 148 … … 581 597 $cmd .= ' -r' if $reuseOK; 582 598 $cmd .= ' -n' if $inactive; 599 $cmd .= ' -c' if $noCPAN; 583 600 $cmd .= ' install'; 584 601 local $| = 0; … … 794 811 $err = $@; 795 812 } 813 $session->finish(); 814 undef $session; 796 815 return ( !$err ); 797 816 } … … 852 871 print "Install $target, permissions $MANIFEST->{$file}->{perms}\n"; 853 872 unless ($inactive) { 854 if ( -e $target ) {873 if ( -e $target && ! -d _ ) { 855 874 # Save current permissions, remove write protect for Windows sake, 856 875 # Back up the file and then restore the original permissions … … 864 883 } 865 884 } 866 my @path = split( /[\/\\]+/, $target );885 my @path = split( /[\/\\]+/, $target, -1 ); # -1 allows directories 867 886 pop(@path); 868 887 if ( scalar(@path) ) { 869 888 File::Path::mkpath( join( '/', @path ) ); 870 889 } 871 File::Copy::move( $source, $target ) 872 || die "Failed to move $source to $target: $!\n"; 890 unless( -d $source ) { 891 File::Copy::move( $source, $target ) 892 || print STDERR "Failed to move $source to $target: $!\n"; 893 } 873 894 } 874 895 unless ($inactive) { … … 1132 1153 unshift( @INC, 'lib' ); 1133 1154 1134 my $n = 0;1135 my $action = 'install';1136 while ( $n < scalar(@ARGV) ) {1137 if ( $ARGV[$n] eq '-a' ) {1138 $noconfirm = 1;1139 }1140 elsif ( $ARGV[$n] eq '-d' ) {1141 $downloadOK = 1;1142 }1143 elsif ( $ARGV[$n] eq '-r' ) {1144 $reuseOK = 1;1145 }1146 elsif ( $ARGV[$n] eq '-n' ) {1147 $inactive = 1;1148 }1149 elsif ( $ARGV[$n] eq '-u' ) {1150 $alreadyUnpacked = 1;1151 }1152 elsif ( $ARGV[$n] =~ m/(install|uninstall|manifest|dependencies)/ ) {1153 $action = $1;1154 }1155 1156 # SMELL: There really shouldn't be a null argument. But installer breaks if it is there.1157 elsif ( $ARGV[$n] eq '' ) {1158 $n++;1159 next;1160 }1161 else {1162 usage();1163 die 'Bad parameter ' . $ARGV[$n];1164 }1165 $n++;1166 }1167 1168 1155 if ( $action eq 'manifest' ) { 1169 1156 foreach my $row ( split( /\r?\n/, $data{MANIFEST} ) ) {
Note: See TracChangeset
for help on using the changeset viewer.
