diff -r 403e7f6ed6c5 -r 564bc7b7ad27 internal/boost/genatsmodules.bat --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/internal/boost/genatsmodules.bat Tue Nov 02 19:23:22 2010 +0530 @@ -0,0 +1,2726 @@ +rem +rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. + +rem Redistribution and use in source and binary forms, with or without +rem modification, are permitted provided that the following conditions are met: + +rem Redistributions of source code must retain the above copyright notice, this +rem list of conditions and the following disclaimer. +rem Redistributions in binary form must reproduce the above copyright notice, +rem this list of conditions and the following disclaimer in the documentation +rem and/or other materials provided with the distribution. +rem Neither the name of Nokia Corporation nor the names of its contributors +rem may be used to endorse or promote products derived from this software +rem without specific prior written permission. + +rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +rem AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +rem IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +rem DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +rem FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +rem DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +rem SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +rem CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +rem OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +rem +rem Description: +rem +@perl -x GenATSModules.bat %1 %2 %3 %4 %5 %6 %7 %8 %9 +@goto end + +#!perl +use strict; +use File::Find; +use File::Copy; +use Cwd; +use File::Basename; + + +my $target = "winsspd"; +my $suite; +my $install = "no"; +my $session = "no"; +my $combinedSession = "no"; +my $sdkversion=""; +my $noXmlsGenList = "play_new"; +my @AllModuleList = (); + +my %DirHash; + +my $sendEmail = "no"; +my $rootDrive = substr(getcwd(), 0,2); +my $templateRoot = getcwd(); +my $ATSRoot = getcwd()."\\ATSINPUT"; + +if($ENV{'ATS_SETUP'} ne "") +{ + $sendEmail = "yes"; + $rootDrive = $ENV{'ATS_INDRIVE'}; + $templateRoot = $ENV{'ATS_TEMPLATEROOT'}; + $ATSRoot = $ENV{'ATS_ATSOUTDRIVE'}; +} + + +if(scalar @ARGV ==0 || $ARGV[0] =~ /[\-\\\/][h\?]/ || $ARGV[0] =~ /help/ ) +{ + print <) + { + if(/(.*)\.mmp/ && $1 !~ /^\s*\/\//) + { + if($_ !~ /\/\/Not for ATS/) + { + my $text = $1; + $text =~ s/^\s*//; + push @moduleList, $text; + } + } + } + close (INFILE); + return @moduleList; +} + +my @groupList; +sub GetLtpModules() +{ + my $prevDir = getcwd(); + my @rootList = ("kernel", "misc"); + my @totalgroupList; + foreach my $node(@rootList) + { + chdir $ltpPath."/$node"; + @groupList = (); + find(\&MakeGroupList, "."); + @totalgroupList = (@totalgroupList, @groupList); + } + chdir $prevDir; + return @totalgroupList; +} + +sub GetstdexeModules() +{ + my $prevDir = getcwd(); + my @fullList = (); + foreach my $group(@stdexeList) + { + my $groupPath = $templateRoot."/testapps/".$group. "/"; + chdir $groupPath; + @groupList = (); + find(\&grovelAllMmpFiles, "."); + chdir $prevDir; + @fullList = (@fullList,@groupList); + } + return @fullList; +} + +sub grovelAllMmpFiles() +{ + if($_ =~ /(.*)\.mmp/ && ! ($_ =~ /manual/)) + { + push @groupList, $1;#get name of module + } +} + +sub GetstdcppModules() +{ + my $prevDir = getcwd(); + my @rootList = ("auto"); + my @totalgroupList; + foreach my $node(@rootList) + { + chdir $stdcppPath."/$node"; + @groupList = (); + find(\&MakeGroupList, "."); + @totalgroupList = (@totalgroupList, @groupList); + } + chdir $prevDir; + my @newmodules = ("tiostreams", "tlocale", "tstl_1", "tstl_2", "tstl_3", "twiostreams"); + @totalgroupList = (@totalgroupList, @newmodules); + foreach my $mod(@newmodules) + { + $cfglocation{$mod} = getcwd()."/testapps/bc/$mod/group"."\/$mod.cfg"; + #print "$cfglocation{$mod} - $mod\n"; + } + return @totalgroupList; +} + +sub GetTstdcppModules() +{ + my $prevDir = getcwd(); + #chdir $tstdcppPath; + @groupList = (); + find(\&grovelAllMmpFiles, "."); + chdir $prevDir; + return @groupList; +} + +sub MakeGroupList() +{ + my $currentDir = $File::Find::dir; + + #print "Current dir:$currentDir\n"; + if( $currentDir =~ /.*\/(.*)\/group/) + { + if($cfglocation{$1} eq "") + { + $cfglocation{$1} = getcwd()."\/$1.cfg"; + push @groupList, $1;#get name of module + }#first time in group + }#group found +}#subrtn end + + +#function that generates the ATS setup +sub DoGen($$) +{ + my $libname = shift @_; + my $ext = shift @_; + mkdir $ATSRoot; + mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir"); + + + GenDirs($libname); + my $module; + foreach my $listed(@generatedModules) + { + my @filesToProcess = + ( + "LibXXX_ATSTemplateXXX_module_blr_hw_component.xml", + "LibXXX_ATSTemplateXXX_module_blr_winsspd_component.xml", + "testframework.ini", + ); + if(rindex($noXmlsGenList, $libname) != -1 ) + { + @filesToProcess = ("testframework.ini",); + } + + if($ext eq ".exe") + { + GenExeXmls($listed,$libname); + } + else + { + #just in case no xml file was supplied + + my $ref = \@filesToProcess; + GenXmls($libname, $listed,$ref); + } + }#foreach + + CopyDlls($libname,$ext); + #copy the provided cfg, ini and xmls + if($libname eq "opts") + { + CopyOptsCfg($libname); + } + elsif($libname eq "ltp" || $libname eq "lsb" || $libname eq "glib") + { + #copy latter and dont copy respectively for ltp and lsb + } + else + { + CopyCfgIniXmls($libname); + } +} + +sub CopyCfgIniXmls() +{ + my $libname = pop @_; + + my $libRoot = $templateRoot; + $libRoot =~ /(.*)internal.*/; + $libRoot = $1; + + + my $module; + my $src; + my $dst; + + foreach my $listed(@generatedModules) + { + my $dirname = $listed; + $dirname =~ s/test/t/; + $module = StripModulePrefix($listed); + + $src = $libRoot.$libname.$TDIR.$dirname."\\group\\"; + + my $xmlCopied = "0"; + my @globpattern = ("*.ini", "*.xml","*.cfg"); + foreach my $pat(@globpattern) + { + $dst = $ATSRoot."\\components\\".$libname."_".$module; + if($pat ne "*.xml") + { + $dst = $dst."\\General\\"; + } + else + { + $dst = $dst."\\"; + } + my @filesFound = glob($src."\\$pat"); + if(scalar @filesFound eq "0") + { + #print "No files found for module $module $pat!\n"; + #print $src; + } + + #handcoded + if($pat eq "*.cfg" && $xmlCopied eq "0")#rename only if xml not copied + { + if(scalar @filesFound > 1) + { + print "Multiple cfg files found. Copying all!\n"; + } + else + { + $dst = $dst.$listed.".cfg"; + } + } + elsif($pat eq "*.xml") + { + my $folder = $dst; + foreach my $from (@filesFound) + { + if($from =~ /winscw_component/) + { + $dst = $folder.$libname."_".$module."_module_blr_winscw_component.xml"; + copy($from, $dst) or die "DIED: copy: $! $from $dst"; + $xmlCopied = "1"; + } + elsif($from =~ /winsspd_component/) + { + $dst = $folder.$libname."_".$module."_module_blr_winsspd_component.xml"; + copy($from, $dst) or die "DIED: copy: $! $from $dst"; + $xmlCopied = "1"; + } + elsif($from =~ /hw_component/) + { + $dst = $folder.$libname."_".$module."_module_blr_hw_component.xml"; + copy($from, $dst) or die "DIED: copy: $! $from $dst"; + $xmlCopied = "1"; + } + }#examine individually + if(scalar @filesFound > 2) + { + #print "Multiple xml files found!!!\n"; + } + @filesFound = (); + } + + + foreach my $from (@filesFound) + { + copy($from, $dst) or die "DIED: copy: $! $from $dst"; + }#copy individually + }#globpattern + }#module +}#fn + +#copy the cfg files for the opts test suite +sub CopyOptsCfg() +{ + my $libname = pop @_; + + my $libRoot = $optsGroupPath."\\"; + my $module; + my $src; + my $dst; + + foreach $module(@generatedModules) + { + $src = $libRoot.$module."\.cfg"; + $dst = $ATSRoot."\\components\\".$libname."_".$module; + $dst = $dst."\\General\\"; + copy($src, $dst) or warn "copy: $! $src $dst"; + }#module +}#fn + +#copy the lsb cfg files +sub CopyLsbCfg() +{ + my $libname = pop @_; + + my $module; + + my $dst; + + my $srcDir = $templateRoot."/ts/lsbsuites/lsblib/data/"; + + foreach $module(@generatedModules) + { + my $file1 = $srcDir."tet_code.cfg"; + my $file2 = $srcDir."tetexec.cfg"; + $dst = $ATSRoot."\\components\\".$libname."_".$module; + $dst = $dst."\\General\\"; + copy($file1, $dst) or die "copy: $! $file1 $dst"; + copy($file2, $dst) or die "copy: $! $file2 $dst"; + }#module +}#fn + + +#copy the ltp cfg files +sub CopyLtpCfg($) +{ + my $libname = pop @_; + + my $module; + my $src; + my $dst; + + foreach $module(@generatedModules) + { + $src = $cfglocation{$module}; + $dst = $ATSRoot."\\components\\".$libname."_".$module; + $dst = $dst."\\General\\"; + copy($src, $dst) or warn "copy: $! $src $dst"; + }#module +}#fn + + +sub CopyDlls($$) +{ + my $libname = shift @_; + my $suffix = shift @_; + + my $module; + my $src; + my $dst; + + + foreach $module(@generatedModules) + { + if($do_winscw == 1) + { + $src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$module.$suffix; + $dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module); + $dst = $dst."\\winscw_udeb\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + if($do_armv5 == 1) + { + $src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$module.$suffix; + $dst = $ATSRoot."\\components\\".$libname."_".StripModulePrefix($module); + $dst = $dst."\\armv5_urel\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + }#foreach +} +#fn to generate the session file +sub GenerateSessionFile($$$$) +{ + my $libname = shift @_; + my $target = shift @_; + my $name = shift @_; + my $listptr = shift @_; + my $outdir = $ATSRoot; + my $infile = $templateRoot."\\testsession.xml"; + chdir $outdir || die("DIED: Unable to chdir!"); + #open INFILE, $infile || die ("DIED: Can not open input file $infile"); + my $prefix = $name."_".$target; + if($sdkversion ne "") + { + $prefix = $prefix."_".$sdkversion; + } + + open OUTFILE, ">".$outdir."\\".$prefix."_testsession.xml" || die ("DIED: Can not open output file"); + my $line; + my $snippet = $target; + if($target ne "winscw" && $target ne "winsspd") + { + $snippet = "hw"; + } + +print OUTFILE "\n"; +print OUTFILE "\n"; +#print OUTFILE "$libname"."_".$snippet."_TestDrop_blr_component\n"; +print OUTFILE "Boost_combined_test_session\n"; +print OUTFILE "at\n"; +print OUTFILE "ATSOUTPUT\\".$prefix."_testsession_results.xml\n"; +if($sendEmail eq "yes") +{ +print OUTFILE < +false +C:\\\\lm.txt +false +Boost $snippet testreport +swbuild\@nokia.com +ajith.narayanan\@nokia.com +hrishikesh.brahmakal\@nokia.com +santosh.ks\@nokia.com +shilpa.sharma\@nokia.com +kasthuri.n-s\@nokia.com +hema.1.s\@nokia.com +vineetha.hari-pai\@nokia.com +madhusudhan.p.reddy\@nokia.com + +EOEmailNote +} + + if($libname ne "combined") + { + AddAssumedIncludes($libname,$snippet); + } + else + { + if($listptr ne "") + { + AddFileList($libname,$listptr); + } + else + { + AddActualIncludes($libname); + } + } + + print OUTFILE "\n"; + + close(OUTFILE); + #close(INFILE); +}#fn + + +sub AddAssumedIncludes($$) +{ + my $libname = shift @_; + my $snippet = shift @_; + + my $APITest; + foreach my $listed(@generatedModules) + { + $APITest = StripModulePrefix($listed); + print OUTFILE "\n"; + print OUTFILE " \n"; + print OUTFILE " \n"; + print OUTFILE " Symbian\n"; + if($libname eq "all") + { + print OUTFILE " ATSINPUT\\components\\$listed\\$listed"."_module_blr_".$snippet."_component.xml\n"; + } + else + { + print OUTFILE " ATSINPUT\\components\\$libname"."_"."$APITest\\$libname"."_$APITest"."_module_blr_".$snippet."_component.xml\n"; + } + if($target eq "winscw") + { + print OUTFILE " \n"; + } + elsif($target eq "winsspd") + { + print OUTFILE " \n"; + } + else + { + print OUTFILE " \n"; + } + print OUTFILE " \n"; + print OUTFILE "\n"; + }#foreach @generatedModules +} + + +sub AddFileList($$) +{ + my $libname = shift @_; + my $listptr = shift @_; + my @componentfiles = @$listptr; + + foreach my $listed(@componentfiles) + { + print OUTFILE "\n"; + print OUTFILE " \n"; + print OUTFILE " \n"; + print OUTFILE " Symbian\n"; + print OUTFILE " ATSINPUT\\components\\$listed\n"; + if($target eq "winscw") + { + print OUTFILE " \n"; + } + elsif($target eq "winsspd") + { + print OUTFILE " \n"; + } + else + { + print OUTFILE " \n"; + } + print OUTFILE " \n"; + print OUTFILE "\n"; + }#foreach @componentfiles +} + + + +sub GetSslXmls() +{ + my $APITest; + my @componentfiles; + + my @emulatorfiles = + ( + "libssl_ssltest\\libssl_blr_winsspd_component.xml", + "libcrypto_crypto_test\\libcrypto_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestss_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestverify_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestenc_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestgen_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltreq_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltreq2_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltrsa_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltcrl_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltsid_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx509_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx5091_blr_winsspd_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx5092_blr_winsspd_component.xml", + ); + + my @hwfiles = + ( + "libcrypto_openssl\\libcrypto_topenssltestss_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestverify_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestenc_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltestgen_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltpkcs7_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltpkcs7d_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltreq_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltreq2_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltrsa_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltcrl_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltsid_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx509_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx5091_blr_hw_component.xml", + "libcrypto_openssl\\libcrypto_topenssltx5092_blr_hw_component.xml", + "libssl_ssltest\\libssl_blr_hw_component.xml", + "libcrypto_crypto_test\\libcrypto_blr_hw_component.xml", + ); + if($target eq "winsspd" || $target eq "winscw") + { + @componentfiles = @emulatorfiles; + } + else + { + @componentfiles = @hwfiles; + } + return @componentfiles; +} + + + +sub AddActualIncludes($) +{ + my $libname = shift @_; + find(\&XmlComponentFiles, "."); + my $key; + my $value; + while(($key, $value) = each(%DirHash)) + { + $value =~ s/\//\\/g; + print OUTFILE "\n"; + print OUTFILE " \n"; + print OUTFILE " \n"; + print OUTFILE " Symbian\n"; + print OUTFILE " $value\n"; + if($target eq "winscw") + { + print OUTFILE " \n"; + } + elsif($target eq "winsspd") + { + print OUTFILE " \n"; + } + else + { + print OUTFILE " \n"; + } + print OUTFILE " \n"; + print OUTFILE "\n"; + + }#while +}#fn + +sub XmlComponentFiles() +{ + if($_ !~ /\.xml/ || $_ =~ /manual/) + { + return; + } + #print "Processing $_\n"; + my $dir = getcwd(); + if($dir =~ /.*(ATSINPUT.*)/) + { + $dir = $1; + if($dir !~ /.*components.*/) + { + return; + } + #print "The dir is $dir\n"; + } + else + { + return; + } + + if($target eq "winsspd" ) + { + if($_ =~ /winsspd/) + { + #print "Adding $target file $_ for $dir\n"; + $DirHash{$dir} = $dir."/".$_; + } + } + elsif($target eq "winscw") + { + if($_ =~ /winscw/) + { + #print "Adding $target file $_ for $dir\n"; + $DirHash{$dir} = $dir."/".$_; + } + } + elsif($_ =~ /$target/) + { + #print "$_ matched $target \n"; + #print "Adding $target file $_ for $dir\n"; + $DirHash{$dir} = $dir."/".$_; + } + elsif($_ =~/hw/) + { + #print "$_ matched hw"; + if(scalar $DirHash{$dir} == 0) + { + #print "Adding hw file $_ for $dir\n"; + $DirHash{$dir} = $dir."/".$_; + #print " and added\n" + } + else + { + #print " and not added\n"; + } + } +} + + + +sub emptyArray() +{ + @generatedModules = (); +} + +sub GenDirs($) +{ + my $libname = shift @_; + my $dirname; + foreach my $module(@generatedModules) + { + $dirname = StripModulePrefix($module); + my $relroot = $ATSRoot."\\components\\$libname"."_$dirname"; + mkdir $relroot || die("DIED: unable to create dir $dirname\n"); + mkdir $relroot."\\General" || die("DIED: unable to create dir $relroot\\General\n"); + if($do_armv5 == 1) + { + mkdir $relroot."\\armv5_urel" || die("DIED: unable to create dir $relroot\\armv5_urel\n"); + } + if($do_winscw == 1) + { + mkdir $relroot."\\winscw_udeb" || die("DIED: unable to create dir $relroot\\winscw_udeb\n"); + } + } +} + +sub GenXmls($$$) +{ + my $libname = shift @_; + my $listedName = shift @_; + my $bref = shift @_; + my @filesToProcess = @$bref; + + #strip leading test and t names from module + my $moduleName = StripModulePrefix($listedName); + + my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; + + + my $dst; + my $src; + foreach $src(@filesToProcess) + { + $dst = $src; + $dst =~ s/ATSTemplateXXX/$moduleName/; + $dst =~ s/LibXXX/$libname/; + + + if($src eq "testframework.ini") + { + $dst = $toPath."General\\".$dst; + } + else + { + $dst = $toPath.$dst; + } + copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy $src to $dst\n"); + ExpandModuleMacros($dst, $libname, $listedName); + }#foreach file +} + + +sub GenExeXmls() +{ + my $moduleName = shift @_; + my $libname = shift @_; + + my $toPath = $ATSRoot."\\components\\$libname"."_$moduleName\\"; + my @filesToProcess = + ( + "LibXXX_ATSTemplateXXX_exemodule_blr_hw_component.xml", + "LibXXX_ATSTemplateXXX_exemodule_blr_winsspd_component.xml", + ); + + my $dst; + my $src; + foreach $src(@filesToProcess) + { + $dst = $src; + $dst =~ s/ATSTemplateXXX/$moduleName/; + $dst =~ s/LibXXX/$libname/; + $dst =~ s/_exemodule_/_module_/; + $dst = $toPath.$dst; + copy($templateRoot."\\".$src, $dst) || die("DIED: Unable to copy to $dst\n"); + ExpandModuleMacros($dst, $libname, $moduleName); + }#foreach file +} + +#function to expand the macros existing in a file +#file is replaced by new version +#args are relativePath. filename and $moduleName +sub ExpandModuleMacros() +{ + # Take module name + my $moduleName = pop @_; + my $libname = pop @_; + my $filename = pop @_; + + my $MODULENAME = $moduleName; + $MODULENAME =~ tr/[a-z]/[A-Z]/; + + # Open input file + open (INFILE, $filename ) || die ("DIED: Can not find $filename"); + + #Open output file + my $newOutput = $filename."new"; + open (OUTFILE, ">".$newOutput ) || die ("DIED: Can not open $newOutput"); + + # Replace text in files + while () + { + s/ATSTemplateXXX/$moduleName/g; + s/LibXXX/$libname/g; + print OUTFILE $_; + } + + # Close filehandles + close (INFILE); + close (OUTFILE); + + # Rename result file + unlink $filename; + rename $newOutput,$filename; +} + + + +sub CopyDeps($$) +{ + my $libname = shift @_; + my $copyDll = shift @_; + my $src; + my $dst; + foreach my $listed(@generatedModules) + { + my $module = StripModulePrefix($listed); + if($do_winscw == 1) + { + $src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll; + $dst = $ATSRoot."\\components\\$libname"."_$module"; + $dst = $dst."\\winscw_udeb\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + if($do_armv5 == 1) + { + $src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll; + $dst = $ATSRoot."\\components\\$libname"."_$module"; + $dst = $dst."\\armv5_urel\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + }#foreach +}#fn + +#dat file copy +sub CopyDatFiles() +{ + my $libRoot = $templateRoot; + $libRoot =~ /(.*)internal.*/; + $libRoot = $1; + + my @list = ( + ["libcrypt", "tlibcrypt", "group/Test_Data.dat"], + ["libc", "tnetdb", "data/services.txt"], + ["libc", "tstring", "data/locales.txt"], + ["libc", "libc_loc_blr", "data/locales.txt"], + ["libz", "tzlib", "data/*.*"], + ["libc", "tlink", "data/*.*"], + ["libc", "tmmap", "data/*.*"], + ); + + my $libname; + my $dirname; + my $glob; + foreach my $ref(@list) + { + my @inarr = @$ref; + ($libname, $dirname, $glob) = @inarr; + my $modulename = StripModulePrefix($dirname); + my $src = "$libRoot/$libname/internal/testapps/$dirname/$glob"; + my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\"; + if($dirname eq "libc_loc_blr") + { + $src = "$libRoot/libc/src/locales.txt"; + } + my @filesFound = glob($src); + if(scalar @filesFound == 0) + { + die("DIED: no Dat file found to copy!"); + } + foreach my $file(@filesFound) + { + copy($file, $dst) || die("DIED: unable to copy $file to $dst"); + } + }#ref processing +}#fn + + +#glib dat file copy +sub CopyArbitDatFiles($$) +{ + + my $libname = shift @_; + my $refArr = shift @_; + my @list = @$refArr; + + + my $fname; + my $modulename; + my $location; + my $atsDst; + my $targetDst; + + #now copy the files appropriately + foreach my $ref(@list) + { + my @inarr = @$ref; + ($fname, $modulename, $location, $atsDst, $targetDst) = @inarr; + #print "[$fname, $modulename, $location, $atsDst, $targetDst]\n"; + if($location =~ /(.*)\.\.(.*)/) + { + $location = GetPathPrefix().$2; + } + else + { + $location = $rootDrive.$location; + } + my $src = $location.$fname; + my $dst = $ATSRoot."\\components\\$libname"."_".$modulename.$atsDst; + if($libname eq "") + { + $dst = $ATSRoot."\\components\\".$modulename.$atsDst; + #print "$dst CHANGED!\n" + } + + my @filesFound = glob($src); + if(scalar @filesFound == 0) + { + die("DIED: no Dat file $src found to copy!"); + } + foreach my $file(@filesFound) + { + copy($file, $dst) || die("DIED: unable to copy $file to $dst"); + } + + if($targetDst ne "") + { + my @filesToChange = (); + if($atsDst =~ "armv5") + { + #armv5 component file + unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml"; + + } + elsif($atsDst =~ "winscw") + { + #winscw component file + unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml"; + } + else + { + #add entry to both xmls + unshift @filesToChange, $libname."_".$modulename."_module_blr_hw_component.xml"; + unshift @filesToChange, $libname."_".$modulename."_module_blr_winsspd_component.xml"; + } + foreach my $file(@filesToChange) + { + $src = $ATSRoot."/components/".$libname."_"."$modulename/".$file; + ModifyXml($src,$libname,$fname,$atsDst,$targetDst); + } + }#updating the xmls + + }#ref processing + + +}#fn + +sub ModifyXml($$$$$) +{ + my $filename = shift @_; + my $lib = shift @_; + my $fname = shift @_; + my $atsDst = shift @_; + my $targetDst = shift @_; + + + #printf("Modifying $filename with lib= $lib fname= $fname atsDst = $atsDst targetDst = $targetDst\n"); + + # Open input file + open (INFILE, $filename ) || die ("Can not find $filename"); + + #Open output file + my $newOutput = $filename."new"; + open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput"); + + + # Replace text in files + while () + { + if(/\/ || /\/) + { + if(/\/) + { + print OUTFILE "\\n"; + } + else + { + print OUTFILE "\\n"; + } + my $type = "data"; + if($atsDst !~ "General") + { + $type = "binary"; + } + print OUTFILE < + $fname + $targetDst\\$fname + +EObinary + }#stif or execute tag found + else + { + print OUTFILE $_; + } + }#while + # Close filehandles + close (INFILE); + close (OUTFILE); + + # Rename result file + unlink $filename; + rename $newOutput,$filename; + +}#fn +sub GenGenModules($) +{ + my $libname = shift @_; + + + my $src = $ATSRoot."/components/"; + my @fileList = (); + opendir(DIRHANDLE, "$src") || die "Cannot opendir $src"; + foreach my $name (readdir(DIRHANDLE)) + { + if($name =~ /^$libname/) + { + if($libname ne "libc" || $name !~ /^libcrypt/) + { + $name =~ s/^$libname//; + $name =~ s/^_//; + unshift @fileList, $name; + }#excluded libcrypt from libc list + }#libname match + }#foreach + closedir(DIRHANDLE); + return @fileList; +} + + +sub GetAllModules() +{ + + my $src = $ATSRoot."/components/"; + my @fileList = (); + opendir(DIRHANDLE, "$src") || die "Cannot opendir $src"; + foreach my $name (readdir(DIRHANDLE)) + { + if($name ne "." && $name ne ".." && $name ne "shared") + { + unshift @fileList, $name; + } + + }#foreach + closedir(DIRHANDLE); + return @fileList; +} + + + +sub TransformXmls($$) +{ + my $libname = shift @_; + my $shared = shift @_; + my $target = shift @_; + my $module; + my $src; + my $dst; + + my $armv5 = 0; + my $winscw = 0; + if($target eq "armv5") + { + $armv5 = 1; + } + elsif($target eq "winscw") + { + $winscw = 1; + } + else + { + $armv5 = $do_armv5; + $winscw = $do_winscw; + } + + + foreach $module(@generatedModules) + { + if($armv5 == 1 && $winscw == 1) + { + $src = $ATSRoot."/components/".$libname."_"."$module/*.xml"; + } + elsif($armv5 == 1) + { + $src = $ATSRoot."/components/".$libname."_"."$module/*_hw_component.xml"; + } + elsif($winscw == 1) + { + $src = $ATSRoot."/components/".$libname."_"."$module/*_winsspd_component.xml"; + } + my @fileList = glob($src); + foreach my $file(@fileList) + { + #print"$file to be transformed!\n"; + AddLibsInXml($libname,$file,$shared); + } + } +}#fn + +sub AddLibsInXml($$$) +{ + my $libname = shift @_; + my $filename = shift @_; + my $shared = shift @_; + + # Open input file + open (INFILE, $filename ) || die ("Can not find $filename"); + + #Open output file + my $newOutput = $filename."new"; + open (OUTFILE, ">".$newOutput ) || die ("Can not open $newOutput"); + + my $drive = "c:"; + + # Replace text in files + while () + { + if(/\/ || /\/) + { + if(/\/) + { + print OUTFILE "\\n"; + } + else + { + print OUTFILE "\\n"; + if($filename =~ /winsspd/) + { + $drive = "z:"; + } + } + foreach my $installable(@dllList) + { + print OUTFILE < + $installable + $drive\\sys\\bin\\$installable + +EOLine + } + + } + else + { + print OUTFILE $_; + } + }#while + # Close filehandles + close (INFILE); + close (OUTFILE); + + # Rename result file + unlink $filename; + rename $newOutput,$filename; +} + +sub CopySharedDlls() +{ + my $libname = shift @_; + my $ref = shift @_; + my @ListOfDlls = @$ref; + my $target = shift @_; + my $module; + my $src; + my $dst; + + my $do_armv5 = 0; + my $do_winscw = 0; + if($target eq "armv5") + { + $do_armv5 = 1; + } + elsif($target eq "winscw") + { + $do_winscw = 1; + } + else + { + $do_armv5 = 1; + $do_winscw = 1; + } + + + mkdir $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components"); + if($do_winscw == 1) + { + mkdir $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb"); + } + if($do_armv5 == 1) + { + mkdir $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel"); + } + + foreach my $copyDll(@ListOfDlls) + { + if($do_winscw == 1) + { + $src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll; + $dst = $ATSRoot."\\components\\shared"; + $dst = $dst."\\winscw_udeb\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + if($do_armv5 == 1) + { + $src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll; + $dst = $ATSRoot."\\components\\shared"; + $dst = $dst."\\armv5_urel\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + }#foreach +}#fn + + +sub CopyMultiDlls($) +{ + my $libname = shift @_; + my $module; + my $src; + my $dst; + foreach my $listed(@generatedModules) + { + foreach my $copyDll(@dllList) + { + if($do_winscw == 1) + { + $src = $rootDrive."\\epoc32\\release\\winscw\\udeb\\".$copyDll; + $dst = $ATSRoot."\\components\\$libname"."_$listed"; + $dst = $dst."\\winscw_udeb\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + if($do_armv5 == 1) + { + $src = $rootDrive."\\epoc32\\release\\armv5\\urel\\".$copyDll; + $dst = $ATSRoot."\\components\\$libname"."_$listed"; + $dst = $dst."\\armv5_urel\\"; + copy($src, $dst) || warn("unable to copy $src to $dst"); + } + }#foreach + } +}#fn + +sub StripModulePrefix($) +{ + my $listed = pop @_; + my $module = $listed; + if($dontStrip == 0) + { + $module =~ s/^test//; + $module =~ s/^t//; + $module =~ s/^libc_//; + $module =~ s/^libm_//; + } + return $module; + +} + +sub GetLsbModules() +{ + my @lsbList = + ( + "abs", +"acos", +"asctime", +"asin", +"atan", +"atan2", +"atof", +"atoi", +"atol", +"bsearch", +"calloc", +"ceil", +"chdir", +"clearerr", +"close", +"closedir", +"cos", +"cosh", +"creat", +"lsb_ctime", +"lsb_difftime", +"dlclose", +"dlerror", +"dlopen", +"dup", +"dup2", +"exp", +"fabs", +"fclose", +"fcntl_x", +"fdopen", +"feof", +"ferror", +"fflush", +"fgetpos", +"fgets", +"fileno", +"floor", +"fmod", +"fopen", +"fopen_X", +"fprintf", +"fputs", +"fread", +"free", +"freopen", +"freopen_X", +"frexp", +"fseek", +"fsetpos", +"fstat", +"ftell", +"ftok", +"ftok_l", +"fwrite", +"getc", +"getcwd", +"gets", +"lsb_gmtime", +"ldexp", +"link", +"lsb_localtime", +"log", +"log10", +"longjmp", +"lseek", +"malloc", +"memchr_X", +"memcmp_X", +"memcpy_X", +"memmove", +"memset_X", +"mkdir", +"mkfifo", +"lsb_mktime", +"modf", +"msgctl", +"msgget", +"msgsnd", +"open", +"opendir", +"open_x", +"perror", +"pipe", +"pow", +"printf", +"qsort", +"rand", +"read", +"readdir", +"readv_l", +"realloc", +"remove", +"rename", +"rewind", +"rewinddir", +"rmdir", +"scanf", +"scanf_X", +"seekdir", +"semctl", +"semget", +"semop", +"setbuf", +"setjmp", +"shmat", +"shmdt", +"shmget", +"sin", +"sinh", +"sqrt", +"srand", +"stat", +"strcat", +"strchr", +"strcmp", +"strcoll_X", +"strcpy", +"strcspn", +"strerror_X", +"strftime", +"strftime_X", +"strlen", +"strncat", +"strncmp", +"strncpy", +"strpbrk", +"strptime", +"strrchr", +"strspn", +"strstr", +"strtod_X", +"strtok", +"strtol_X", +"strxfrm_X", +"tan", +"tanh", +"telldir", +"telldir_l", +"lsb_time", +"tmpfile", +"tmpnam", +"ungetc", +"unlink", +"utime", +"vfprintf", +"vprintf", +"write", +"writev_l", + + ); + return @lsbList; +} + + + +sub GenBackendTest() +{ + + my @datList = + ( + ["libc", "tlibcbackend"], + ); + + mkdir $ATSRoot; + mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir"); + + my $lib; + my $module; + my $ext; + foreach my $ref(@datList) + { + my @inarr = @$ref; + ($lib, $module,$ext) = @inarr; + @generatedModules = ($module); + GenDirs($lib); + CopyDlls($lib,".dll"); + } + #now copy xmls + CopyAtsSetup(); + #extra exes + @generatedModules = ("tlibcbackend"); + CopyDeps("libc","TPopenReadChild.exe"); + CopyDeps("libc","TPopenWriteChild.exe"); + +}#fn + +sub CopyAtsSetup() +{ + my $libname = "libc"; + my @list = ( + ["*.xml", "libcbackend", "/../backend/internal/tlibcbackend/group/","/", ""], + ["*.cfg", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""], + ["*.ini", "libcbackend", "/../backend/internal/tlibcbackend/group/","/General/", ""], + ); + + my $bDataRef = \@list; + CopyArbitDatFiles("libc",$bDataRef); + +}#fn +sub GetPathPrefix() +{ + my $srcPrefix = $templateRoot; + $srcPrefix =~ /(.*)internal.*/; + $srcPrefix = $1; + return $srcPrefix; +} + + +#dat file copy +sub CopyCryptoDat() +{ + my $libRoot = $templateRoot; + $libRoot =~ /(.*)internal.*/; + $libRoot = $1; + + my @list = ( + ["libssl", "ssltest", "libssl/internal/testapps/ssl_test/data/*"], + ["libcrypto", "topenssl", "/libcrypto/internal/testapps/topenssl/data/*"], + ); + + my $libname; + my $dirname; + my $glob; + foreach my $ref(@list) + { + my @inarr = @$ref; + ($libname, $dirname, $glob) = @inarr; + my $modulename = StripModulePrefix($dirname); + my $srcPrefix = GetPathPrefix(); + + my $src = "$srcPrefix"."$glob"; + + my $dst = $ATSRoot."\\components\\$libname"."_"."$modulename\\General\\"; + my @filesFound = glob($src); + if(scalar @filesFound == 0) + { + die("DIED: no Dat file found to copy!"); + } + foreach my $file(@filesFound) + { + copy($file, $dst) || die("DIED: unable to copy $file to $dst"); + } + }#ref processing +}#fn + +#Crypto xmls copy +sub CopyCryptoXmls() +{ + my @list = ( + ["*.xml", "libssl_ssltest/", "/libssl/internal/testapps/ssl_test/group/"], + ["*.xml", "libcrypto_crypto_test/", "/libcrypto/internal/testapps/crypto_test/group/"], + ["*.xml", "libcrypto_openssl/", "/libcrypto/internal/testapps/topenssl/group/"], + ); + + + my $fname; + my $moduleDst; + my $location; + + #now copy the files appropriately + foreach my $ref(@list) + { + my @inarr = @$ref; + ($fname, $moduleDst, $location) = @inarr; + my $src = GetPathPrefix().$location.$fname; + my $dst = $ATSRoot."\\components\\$moduleDst"; + + my @filesFound = glob($src); + if(scalar @filesFound == 0) + { + die("DIED: no xml file found to copy!"); + } + foreach my $file(@filesFound) + { + copy($file, $dst) || die("DIED: unable to copy $file to $dst"); + } + }#ref + + my @crypto_copyList = ("*.txt", "*cfg", "*.ini"); + + foreach my $item(@crypto_copyList) + { + $location = "/libcrypto/internal/testapps/crypto_test/group/"; + $fname = GetPathPrefix().$location.$item; + my @filesFound = glob($fname); + foreach my $file(@filesFound) + { + $moduleDst = "libcrypto_crypto_test/"; + my $dst = $ATSRoot."\\components\\".$moduleDst."/General/"; + copy($file, $dst); + } + } +}#fn + +sub GenCryptoTest() +{ + + my @datList = + ( + ["libssl", "ssltest", ".exe"], + ["libcrypto", "crypto_test",".dll"], + ["libcrypto", "openssl",".exe"], + ); + + mkdir $ATSRoot; + mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir"); + + my $lib; + my $module; + my $ext; + foreach my $ref(@datList) + { + my @inarr = @$ref; + ($lib, $module,$ext) = @inarr; + @generatedModules = ($module); + GenDirs($lib); + CopyDlls($lib,$ext); + } + CopyCryptoDat(); + CopyCryptoXmls(); + + +}#fn + + +#ngi xml copy +sub CopyNgiXmls() +{ + my @list = ( + ["*.xml", "ngi_sa_amrrecording", "/audio/lowlevelaudio/internal/sa_amrrecording/group/"], + ["*.xml", "ngi_sa_highlevelaudio", "/audio/highlevelaudio/internal/sa_highlevelaudio/group/"], + ["*.xml", "ngi_sa_audiomixing", "/audio/lowlevelaudio/internal/sa_audiomixing/group/"], + ["*.xml", "ngi_sa_audiorecording", "/audio/lowlevelaudio/internal/sa_audiorecording/group/"], + ["*.xml", "ngi_sa_clip", "/audio/lowlevelaudio/internal/sa_clip/group/"], + ["*.xml", "ngi_sa_lowlevelaudio", "/audio/lowlevelaudio/internal/sa_lowlevelaudio/group/"], + ["*.xml", "ngi_sa_stream", "/audio/lowlevelaudio/internal/sa_stream/group/"], + + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_antitearing/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_colortranslation/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb565/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_createfb888/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_heapusage/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_multibb/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_performance/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_plswitching/group/"], + ["*.xml", "ngi_sa_backbuffer", "/graphics/backbuffer/internal/sa_bb_misc/group/"], + ["*.xml", "ngi_sa_bitmap", "/graphics/bitmap/internal/sa_bitmap/group/"], + ["*.xml", "ngi_sa_camera", "/graphics/camera/internal/sa_camera/group/"], + ["*.xml", "ngi_sa_images", "/graphics/images/internal/sa_images/group/"], + ["*.xml", "ngi_sa_display", "/graphics/display/internal/sa_display/group/"], + ["*.xml", "ngi_sa_lights", "/graphics/lights/internal/sa_lights/group/"], + ["*.xml", "ngi_sa_videoplayback", "/graphics/video/internal/sa_videoplayback/group/"], + + ["*.xml", "ngi_sa_input", "/input/input/internal/sa_input/group/"], + ["*.xml", "ngi_sa_textinput", "/input/textinput/internal/sa_textinput/group/"], + ["*.xml", "ngi_sa_devicecapabilities", "/system/devicecapabilities/internal/sa_devicecapabilities/group/"], + ["*.xml", "ngi_sa_devicestatus", "/system/devicestatus/internal/sa_phone/group/"], + ["*.xml", "ngi_sa_runtimetester", "/system/runtime/internal/sa_runtimetester/group/"], + ["*.xml", "ngi_sa_timing", "/timing/internal/sa_timing/group/"], + ); + + + my $fname; + my $moduleDst; + my $location; + + #now copy the files appropriately + foreach my $ref(@list) + { + my @inarr = @$ref; + ($fname, $moduleDst, $location) = @inarr; + my $src = GetPathPrefix().$location.$fname; + my $dst = $ATSRoot."\\components\\$moduleDst"; + + #print "My src is $src\n"; + #print "My dst is $dst\n"; + + my @filesFound = glob($src); + if(scalar @filesFound == 0) + { + warn("warning: no xml file found to copy from $src!"); + } + foreach my $file(@filesFound) + { + copy($file, $dst) || die("DIED: unable to copy $file to $dst"); + } + }#ref + +}#fn + + +sub GenNgiTest() +{ + + my @datList = + ( + ["ngi", "sa_amrrecording", ".dll"], + ["ngi", "sa_highlevelaudio", ".dll"], + ["ngi", "sa_audiomixing", ".dll"], + ["ngi", "sa_audiorecording", ".dll"], + ["ngi", "sa_clip", ".dll"], + ["ngi", "sa_lowlevelaudio", ".dll"], + ["ngi", "sa_stream", ".dll"], + ["ngi", "sa_bitmap", ".dll"], + ["ngi", "sa_camera", ".dll"], + ["ngi", "sa_images", ".dll"], + ["ngi", "sa_display", ".dll"], + ["ngi", "sa_lights", ".dll"], + ["ngi", "sa_videoplayback", ".dll"], + ["ngi", "sa_input", ".dll"], + ["ngi", "sa_textinput", ".dll"], + ["ngi", "sa_devicecapabilities", ".dll"], + ["ngi", "sa_devicestatus", ".dll"], + ["ngi", "sa_runtimetester", ".dll"], + ["ngi", "sa_timing", ".dll"], + + ); + + mkdir $ATSRoot; + mkdir $ATSRoot."\\components" || die ("DIED: unable to create component dir"); + + + my $lib; + my $module; + my $ext; + foreach my $ref(@datList) + { + my @inarr = @$ref; + ($lib, $module,$ext) = @inarr; + @generatedModules = ($module); + GenDirs($lib); + CopyDlls($lib,$ext); + } + + @generatedModules =("sa_backbuffer"); + GenDirs($lib); + @dllList = + ( + "sa_bb_antitearing.dll", + "sa_bb_colortranslation.dll", + "sa_bb_createfb444.dll", + "sa_bb_createfb565.dll", + "sa_bb_createfb888.dll", + "sa_bb_misc.dll", + "sa_bb_heapusage.dll", + "sa_bb_multibb.dll", + "sa_bb_performance.dll", + "sa_bb_plswitch.dll", + "sa_bb_testenv.dll" + ); + CopyMultiDlls("ngi"); + + + mkdir $ATSRoot."\\components\\shared" || die("Wouldn't make shared folder in $ATSRoot\\components"); + mkdir $ATSRoot."\\components\\shared\\winscw_udeb" || die("Wouldn't make shared folder in $ATSRoot\\components\winscw_udeb"); + mkdir $ATSRoot."\\components\\shared\\armv5_urel" || die("Wouldn't make shared folder in $ATSRoot\\components\armv5_urel"); + +}#fn + + +sub GetXmls() +{ + my @foundList; + my $libname = shift @_; + my @globlist = (); + if($target eq "winsspd" && $sdkversion ne "") + { + @globlist = ("winsspd_".$sdkversion); + #print "winsspd ".$sdkversion." selected\n"; + } + elsif($target eq "winsspd") + { + @globlist = ("winsspd"); + #print "winsspd selected\n"; + } + elsif($sdkversion ne "") + { + @globlist = ($target,"hw_".$sdkversion); + #print "$target $sdkversion selected\n"; + } + else + { + @globlist = ($target,"hw"); + #print "$target $sdkversion selected\n"; + } + + foreach my $module(@generatedModules) + { + my $glob_to_use = ""; + my @fileList; + foreach my $glob(@globlist) + { + my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml"; + #print "Analysing $module and $glob\n"; + @fileList = glob($src); + foreach my $file(@fileList) + { + my $pat = $glob."\_component\.xml"; + #print "[$file - $glob"."_component.xml"."]\n"; + if($file =~ /$pat/) + { + $glob_to_use = $pat; + #print "[$file - $glob"."_component.xml"."]\n"; + last + } + }#foreach FILE + if($glob_to_use ne "") + { + last; + } + }#finding glob + if($glob_to_use ne "") + { + #print "Using the glob $glob_to_use\n"; + my $src = $ATSRoot."/components/".$libname."_"."$module/*.xml"; + @fileList = glob($src); + foreach my $file(@fileList) + { + #print "[$file - $glob_to_use]\n"; + if($file =~ /$glob_to_use/) + { + $file =~ /.*components[\\\/](.*)/; + my $value = $1; + $value =~ s/\//\\/g; + #print "adding $value for $module with $glob_to_use\n"; + unshift @foundList,$value; + }#if + }#foreach + }#glob is present + else + { + warn("Unable to figure out glob to use for $module. Skipping...\n"); + } + }#each module + return @foundList; + }#fn + +__END__ +:end + + + +