equal
deleted
inserted
replaced
42 |
42 |
43 use strict; |
43 use strict; |
44 use File::Path; # Module to provide functions to remove or create directories in a convenient way. |
44 use File::Path; # Module to provide functions to remove or create directories in a convenient way. |
45 use File::Copy; # Module to provide functions to copy file(s) from source to destination. |
45 use File::Copy; # Module to provide functions to copy file(s) from source to destination. |
46 |
46 |
47 use Pathutl; |
|
48 use Cwd; # Module to provide functions for determining the pathname of the current working directory. |
47 use Cwd; # Module to provide functions for determining the pathname of the current working directory. |
|
48 |
|
49 use romutl; |
|
50 use romosvariant; |
49 |
51 |
50 # This fuction is used primiarly to check for whitespace in the location for "zdrive" / "datadrive" folder creation, |
52 # This fuction is used primiarly to check for whitespace in the location for "zdrive" / "datadrive" folder creation, |
51 # specified by the user, if yes then it returns one, else zero |
53 # specified by the user, if yes then it returns one, else zero |
52 sub checkForWhiteSpace |
54 sub checkForWhiteSpace |
53 { |
55 { |
168 { |
170 { |
169 my($dirName) = @_; |
171 my($dirName) = @_; |
170 # get the working directory. |
172 # get the working directory. |
171 my $curWorkingDir = getcwd; |
173 my $curWorkingDir = getcwd; |
172 # substitute slash with double backward slash. |
174 # substitute slash with double backward slash. |
173 $curWorkingDir =~ s/\//\\/g; |
175 $curWorkingDir =~ s/\\/\//g; |
174 #if $curWorkingDir already has trailing '\', don't include it again |
176 #if $curWorkingDir already has trailing '\', don't include it again |
175 if( $curWorkingDir =~ /\\$/) |
177 if( $curWorkingDir =~ /\/$/) |
176 { |
178 { |
177 return $curWorkingDir.$dirName; |
179 return $curWorkingDir.$dirName; |
178 } |
180 } |
179 else |
181 else |
180 { |
182 { |
181 return $curWorkingDir."\\".$dirName; |
183 return $curWorkingDir."\/".$dirName; |
182 } |
184 } |
183 } |
185 } |
184 |
186 |
185 # create directory and copy respective file on to that directory. |
187 # create directory and copy respective file on to that directory. |
186 # is there is a problem while copying files from source to destination |
188 # is there is a problem while copying files from source to destination |
191 $source =~ s/\"//g; # remove double quotes from the string. |
193 $source =~ s/\"//g; # remove double quotes from the string. |
192 my $destFileName = ""; # name of the destination file. |
194 my $destFileName = ""; # name of the destination file. |
193 $dest =~ s/\"//g; # remove double quotes from the string. |
195 $dest =~ s/\"//g; # remove double quotes from the string. |
194 my $destDirectory = $dest; |
196 my $destDirectory = $dest; |
195 # strip the last substring to get destination file |
197 # strip the last substring to get destination file |
196 if ($dest=~/.*\\(\S+)/) |
198 if ($dest=~/.*[\/\\](\S+)/) |
197 { |
199 { |
198 $destFileName = $1; |
200 $destFileName = $1; |
199 } |
201 } |
200 else |
202 else |
201 { |
203 { |
212 } |
214 } |
213 else |
215 else |
214 { |
216 { |
215 $destDirectory =~ s/$destFileName//; |
217 $destDirectory =~ s/$destFileName//; |
216 } |
218 } |
217 my $destfile = $dir."\\".$dest; |
219 my $destfile = $dir."\/".$dest; |
218 my $createdir = $dir."\\".$destDirectory ; |
220 my $createdir = $dir."\/".$destDirectory ; |
219 |
221 |
220 # create the specified directory. |
222 # create the specified directory. |
221 &createDirectory($createdir); |
223 &createDirectory($createdir); |
222 if (!copy($source,$destfile)) |
224 if (!copy($source,$destfile)) |
223 { |
225 { |
292 my $source=$2; |
294 my $source=$2; |
293 my $dest=$3; |
295 my $dest=$3; |
294 |
296 |
295 if( $source !~ /(\S+):(\S+)/ ) |
297 if( $source !~ /(\S+):(\S+)/ ) |
296 { |
298 { |
297 $source = Path_Drive().$2; |
299 $source = get_drive().$2; |
298 } |
300 } |
299 my $var = ©FilesToFolders( $source,$dest,$dir,$verboseOpt); |
301 my $var = ©FilesToFolders( $source,$dest,$dir,$verboseOpt); |
300 if($var) |
302 if($var) |
301 { |
303 { |
302 $var = $keyWord."=".$var; |
304 $var = $keyWord."=".$var; |
364 # default system drive letter is specified since interpretsis doesnt allow overloading of options unless default |
366 # default system drive letter is specified since interpretsis doesnt allow overloading of options unless default |
365 # options are specified. |
367 # options are specified. |
366 my $basicOption = "-d C: "; # default system drive letter |
368 my $basicOption = "-d C: "; # default system drive letter |
367 my $command = "interpretsis "; |
369 my $command = "interpretsis "; |
368 my $vOption = "-w info" if ($verboseOpt); |
370 my $vOption = "-w info" if ($verboseOpt); |
|
371 |
|
372 is_existinpath("interpretsis", romutl::DIE_NOT_FOUND); |
369 |
373 |
370 # do a check if the path has a white space. |
374 # do a check if the path has a white space. |
371 if( $dataDrivePath =~ m/ /) |
375 if( $dataDrivePath =~ m/ /) |
372 { |
376 { |
373 $dataDrivePath = '"'.$dataDrivePath.'"'; |
377 $dataDrivePath = '"'.$dataDrivePath.'"'; |
428 for( my $i = 0; $i < $arraysize; $i++ ) |
432 for( my $i = 0; $i < $arraysize; $i++ ) |
429 { |
433 { |
430 $command .= $$interpretsisOptList[$i]." "; |
434 $command .= $$interpretsisOptList[$i]." "; |
431 } |
435 } |
432 } |
436 } |
433 |
437 |
434 print "* Executing $command\n" if ( $verboseOpt ); |
438 print "* Executing $command\n" if ( $verboseOpt ); |
435 system ( $command ); |
439 system ( $command ); |
436 |
440 |
437 if ($? != 0) |
441 if ($? != 0) |
438 { |
442 { |
443 # invoke the READIMAGE tool with appropriate parameters. |
447 # invoke the READIMAGE tool with appropriate parameters. |
444 sub invokeReadImage |
448 sub invokeReadImage |
445 { |
449 { |
446 my($imageName,$loc,$verboseOpt,$logFile,$keepgoingOpt) = @_; |
450 my($imageName,$loc,$verboseOpt,$logFile,$keepgoingOpt) = @_; |
447 my $command = "readimage "; |
451 my $command = "readimage "; |
|
452 |
|
453 is_existinpath("readimage", romutl::DIE_NOT_FOUND); |
|
454 |
448 # check if log file has been supplied. |
455 # check if log file has been supplied. |
449 if(defined($logFile)) |
456 if(defined($logFile)) |
450 { |
457 { |
451 if( $logFile =~ m/ /) |
458 if( $logFile =~ m/ /) |
452 { |
459 { |
490 # destination file. |
497 # destination file. |
491 my $linedestFile; |
498 my $linedestFile; |
492 # get source file. |
499 # get source file. |
493 |
500 |
494 # strip first occurrence of back slash |
501 # strip first occurrence of back slash |
495 $linesource =~ s/\\//; |
502 $linesource =~ s/[\/\\]//; |
496 |
503 |
497 # get source file. |
504 # get source file. |
498 if ($linesource =~ /.*\\(\S+)/ ) |
505 if ($linesource =~ /.*[\/\\](\S+)/ ) |
499 { |
506 { |
500 $linesourceFile = $1; |
507 $linesourceFile = $1; |
501 } |
508 } |
502 # get destination file. |
509 # get destination file. |
503 if ($linedest =~ /.*\\(\S+)/ ) |
510 if ($linedest =~ /.*[\/\\](\S+)/ ) |
504 { |
511 { |
505 $linedestFile = $1; |
512 $linedestFile = $1; |
506 } |
513 } |
507 # iterate trough all |
514 # iterate trough all |
508 foreach my $firstarrayEntry (@$firstarray) |
515 foreach my $firstarrayEntry (@$firstarray) |
523 { |
530 { |
524 my $nonsisEntryDest = $3; |
531 my $nonsisEntryDest = $3; |
525 # remove double quotes. |
532 # remove double quotes. |
526 $nonsisEntryDest =~ s/\"//g; |
533 $nonsisEntryDest =~ s/\"//g; |
527 my $nonsisEntryDestFile; |
534 my $nonsisEntryDestFile; |
528 if ($nonsisEntryDest =~ /.*\\(\S+)/ ) |
535 if ($nonsisEntryDest =~ /.*[\/\\](\S+)/ ) |
529 { |
536 { |
530 $nonsisEntryDestFile = $1; |
537 $nonsisEntryDestFile = $1; |
531 } |
538 } |
532 if( $nonsisEntryDest eq $linesource ) |
539 if( $nonsisEntryDest eq $linesource ) |
533 { |
540 { |
591 { |
598 { |
592 my $newLineKeyword = $1; |
599 my $newLineKeyword = $1; |
593 my $newLinesource = $2; |
600 my $newLinesource = $2; |
594 my $newLinedest = $3; |
601 my $newLinedest = $3; |
595 $newLinedest =~ s/\"//g; |
602 $newLinedest =~ s/\"//g; |
596 $newLinedest = "\\".$newLinedest; |
603 $newLinedest = "\/".$newLinedest; |
597 if( $newLinedest eq $lineToSearch ) |
604 if( $newLinedest eq $lineToSearch ) |
598 { |
605 { |
599 # remove the specified element from the array. |
606 # remove the specified element from the array. |
600 splice(@$nonsisFileArray,$nonsisFileListCount,1); |
607 splice(@$nonsisFileArray,$nonsisFileListCount,1); |
601 } |
608 } |
664 #skip, parent directory and current directory. |
671 #skip, parent directory and current directory. |
665 next if ($entry eq "." || $entry eq ".."); |
672 next if ($entry eq "." || $entry eq ".."); |
666 #check if it is a file |
673 #check if it is a file |
667 if( -f $entry ) |
674 if( -f $entry ) |
668 { |
675 { |
669 my $sourcedir = $rootdir."\\".$folderList.$entry; |
676 my $sourcedir = $rootdir."\/".$folderList.$entry; |
670 my $destdir = "$folderList".$entry; |
677 my $destdir = "$folderList".$entry; |
671 my $sisSource; |
678 my $sisSource; |
672 my $sisdestination; |
679 my $sisdestination; |
673 if(&checkRegCtlFiles($entry)) |
680 if(&checkRegCtlFiles($entry)) |
674 { |
681 { |
704 } |
711 } |
705 } |
712 } |
706 #else it's a directory |
713 #else it's a directory |
707 else |
714 else |
708 { |
715 { |
709 &TraverseDir($entry,$folderList.$entry."\\",$sisFileContent,$rootdir); |
716 &TraverseDir($entry,$folderList.$entry."\/",$sisFileContent,$rootdir); |
710 } |
717 } |
711 } |
718 } |
712 closedir(DIR); |
719 closedir(DIR); |
713 chdir(".."); |
720 chdir(".."); |
714 } |
721 } |
720 #get the array size. |
727 #get the array size. |
721 my $arraySize = scalar(@$array); |
728 my $arraySize = scalar(@$array); |
722 for(my $i=0; $i<$arraySize ; $i++ ) |
729 for(my $i=0; $i<$arraySize ; $i++ ) |
723 { |
730 { |
724 #pop out the element to the respective obey file. |
731 #pop out the element to the respective obey file. |
725 print NEWDATA pop(@$array)."\n"; |
732 my $line=pop(@$array); |
726 } |
733 if (&is_windows){ |
727 } |
734 $line =~ s-\/-\\-g; |
|
735 }else{ |
|
736 $line =~ s-\\-\/-g; |
|
737 } |
|
738 print NEWDATA $line."\n"; |
|
739 } |
|
740 } |