# HG changeset patch # User Dario Sestito # Date 1254763450 -3600 # Node ID 6358982cd10efdff8daf3ea042c92e943e165c6f # Parent 3692c6f462b438eab1bba74d988436a5ec4c4df6# Parent 339b33d6402f6abf11c531cbcf9b214e45a3faa4 Merge diff -r 3692c6f462b4 -r 6358982cd10e build.xml --- a/build.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/build.xml Mon Oct 05 18:24:10 2009 +0100 @@ -6,7 +6,11 @@ - + + + + + diff -r 3692c6f462b4 -r 6358982cd10e common/build.postbuild.xml --- a/common/build.postbuild.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/build.postbuild.xml Mon Oct 05 18:24:10 2009 +0100 @@ -296,6 +296,7 @@ + @@ -304,11 +305,12 @@ - - - + + + + @@ -321,7 +323,6 @@ - @@ -342,7 +343,6 @@ - @@ -352,12 +352,11 @@ - - + @@ -377,6 +376,15 @@ + + + + + + + + + @@ -632,6 +640,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 3692c6f462b4 -r 6358982cd10e common/build.test.xml --- a/common/build.test.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/build.test.xml Mon Oct 05 18:24:10 2009 +0100 @@ -115,7 +115,7 @@ - + @@ -165,7 +165,7 @@ - + diff -r 3692c6f462b4 -r 6358982cd10e common/common_props.ant.xml --- a/common/common_props.ant.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/common_props.ant.xml Mon Oct 05 18:24:10 2009 +0100 @@ -41,6 +41,7 @@ + diff -r 3692c6f462b4 -r 6358982cd10e common/templates/source-spec.ant.xml.ftl --- a/common/templates/source-spec.ant.xml.ftl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/templates/source-spec.ant.xml.ftl Mon Oct 05 18:24:10 2009 +0100 @@ -17,6 +17,17 @@ <#assign fast_sync = false /> +<#if ("${ant['sf.spec.sourcesync.bug419']}")??> + <#if "${ant['sf.spec.sourcesync.bug419']}" == "true"> + <#assign bug419 = true /> + <#else> + <#assign bug419 = false /> + +<#else> + <#assign bug419 = false /> + + + @@ -55,6 +66,19 @@ + <#if bug419 > + + + + + + + + + + + + <#else> <#if "${pkg_detail.type}"=="tag" > @@ -71,6 +95,7 @@ + diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/ats_specialise_test_drop.pl --- a/common/tools/ats/ats_specialise_test_drop.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/ats_specialise_test_drop.pl Mon Oct 05 18:24:10 2009 +0100 @@ -11,6 +11,7 @@ # Mike Kinghan, mikek@symbian.org # # Contributors: +# Brendan Donegan, brendand@symbian.org # # Description: # This is a tool for setting the name of an ATS test drop, and/or the build id @@ -24,13 +25,13 @@ use Data::Dumper; my $test_drop_name; # Test drop name to be embedded in output XML -my $build_id; # Build ID to be embedded in output XML -my $device_name; # Device name to be embedded in output XML +my $build_id; # Build ID to be embedded in output XML +my $host_name; # Host name to be embedded in output XML my $srcfile; # Input test drop file, either .xml or .zip my $destfile; # Leafname for output file. Extension will be .xml or .zip as input. # If unspecified then the input file is updated. my $help; # Do help? -my $srctype; # Type of inpout file, .xml or .zip +my $srctype; # Type of input file, .xml or .zip my $dev_null = $^O =~ /^MSWin/ ? "nul" : "/dev/null"; # OS-dependent nul device. my $zipper; # Zip command, depending on whether zip or 7z is available. my $unzipper; # Unzip command, depending on whether [unzip or 7z is available. @@ -43,7 +44,7 @@ sub silent_command($); my %optmap = ( 'test-drop-name' => \$test_drop_name, - 'device-name' => \$device_name, + 'host-name' => \$host_name, 'build-id' => \$build_id, 'src' => \$srcfile, 'dest' => \$destfile, @@ -51,7 +52,7 @@ GetOptions(\%optmap, 'test-drop-name=s', - 'device-name=s', + 'host-name=s', 'build-id=s', 'src=s', 'dest=s', @@ -123,11 +124,11 @@ # Insert the specified build id, if any. $test_drop->{'test'}->{'buildid'}->[0] = $build_id, if $build_id; -if ($device_name) { # Also insert sepcified device name. +if ($host_name) { # Also insert specified host name my $device_properties = $test_drop->{'test'}->{'target'}->[0]->{'device'}->[0]->{'property'}; my $num_properties = @{$device_properties}; - $device_properties->[$num_properties]= { 'name' => "NAME", 'value' => "$device_name" }; + $device_properties->[$num_properties]= { 'name' => "HOST", 'value' => "$host_name" }; $test_drop->{'test'}->{'target'}->[0]->{'device'}->[0]->{'property'} = $device_properties; #print Dumper($device_properties); #exit(0); @@ -169,12 +170,12 @@ "Specify the name, build id and target device in an ATS XML test drop\n" . "synopsis:\n" . " ats_specialise_test_drop.pl --help\n" . - " ats_specialise_test_drop.pl [--test-drop-name=TESTNAME] [--build-id=BUILDID] [--device-name=DEVICENAME] [--dest=FILE] --src=FILE \n" . + " ats_specialise_test_drop.pl [--test-drop-name=TESTNAME] [--build-id=BUILDID] [--host-name=HOSTNAME] [--dest=FILE] --src=FILE \n" . "options:\n" . " --help Display this help and exit\n" . " --test-drop-name=TESTNAME TESTNAME is the desired name of the test drop. If not specified then the test drop name is not modified.\n" . " --build-id=BUILDID BUILDID is id of the build being tested. If not specified then the build id is not modified.\n" . - " --device-name=DEVICENAME DEVICENAME is the name of the device on which the test should be run. " . + " --device-name=HOSTNAME HOSTNAME is the name of the ATS worker on which the test should be run. " . "If not specified then the test device name is not modified.\n" . " --src=INFILE INFILE is the file containing the test drop XML to be modified, or else a zip file " . " containing the test drop XML in the file 'test.xml'. INFILE must have extension .xml or.zip\n" . diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/appsupport/profilesengine/profilesengine.pl --- a/common/tools/ats/bctest/appsupport/profilesengine/profilesengine.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/appsupport/profilesengine/profilesengine.pl Mon Oct 05 18:24:10 2009 +0100 @@ -20,15 +20,15 @@ use File::Path; unlink "profilesengine.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/bcprofilesengine/general/testframework"; mkpath "temp/bcprofilesengine/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("profilesengine.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/proengwrapapi.dll", "temp/bcprofilesengine/winscw_udeb/proengwrapapi.dll"); -copy($epoc . "winscw/c/testframework/testframework_proengwrapapi.ini", "temp/bcprofilesengine/general/testframework/testframework_proengwrapapi.ini"); -copy($epoc . "winscw/c/testframework/proengwrapapi.cfg", "temp/bcprofilesengine/general/testframework/proengwrapapi.cfg"); +copy($epoc . "release/winscw/udeb/proengwrapapi.dll", "temp/bcprofilesengine/winscw_udeb/proengwrapapi.dll") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testframework_proengwrapapi.ini", "temp/bcprofilesengine/general/testframework/testframework_proengwrapapi.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/proengwrapapi.cfg", "temp/bcprofilesengine/general/testframework/proengwrapapi.cfg") or die "failed : $!"; system("7z a -tzip profilesengine.zip ./temp/*"); \ No newline at end of file diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/appsupport/profilesengine/profilesengine.xml --- a/common/tools/ats/bctest/appsupport/profilesengine/profilesengine.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/appsupport/profilesengine/profilesengine.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/base/test.xml --- a/common/tools/ats/bctest/base/test.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/base/test.xml Mon Oct 05 18:24:10 2009 +0100 @@ -9,7 +9,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/browser/browser.pl --- a/common/tools/ats/bctest/browser/browser.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/browser/browser.pl Mon Oct 05 18:24:10 2009 +0100 @@ -27,9 +27,9 @@ my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("browser.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/favouritesbctest.dll", "temp/bcbrowser/winscw_udeb/favouritesbctest.dll"); -copy($epoc . "release/winscw/udeb/downloadmgrbctest.dll", "temp/bcbrowser/winscw_udeb/downloadmgrbctest.dll"); +copy($epoc . "release/winscw/udeb/favouritesbctest.dll", "temp/bcbrowser/winscw_udeb/favouritesbctest.dll") or die "failed : $!"; +copy($epoc . "release/winscw/udeb/downloadmgrbctest.dll", "temp/bcbrowser/winscw_udeb/downloadmgrbctest.dll") or die "failed : $!"; -copy($epoc . "winscw/c/testframework/testframework_dwmgr.ini", "temp/bcbrowser/general/testframework/testframework_dwmgr.ini"); +copy($epoc . "winscw/c/testframework/testframework_dwmgr.ini", "temp/bcbrowser/general/testframework/testframework_dwmgr.ini") or die "failed : $!"; system("7z a -tzip browser.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/contacts/phonebook/phonebook.xml --- a/common/tools/ats/bctest/contacts/phonebook/phonebook.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/contacts/phonebook/phonebook.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - @@ -66,7 +65,7 @@ - + @@ -837,7 +836,7 @@ - + @@ -1014,7 +1013,7 @@ - + @@ -1132,7 +1131,7 @@ - + @@ -1368,7 +1367,7 @@ - + @@ -1622,7 +1621,7 @@ - + @@ -1945,7 +1944,7 @@ - + @@ -1977,12 +1976,12 @@ phonebooktest/winscw_udeb/mtpbkiconinfo.dll phonebooktest/general/testframework/testframework_pbkinfo.ini phonebooktest/general/testframework/tcbctestpbkinfo.cfg - phonebooktest/general/testframework/ui_tcbctestpbkinfo.cfg + phonebooktest/general/testframework/ui_bctestpbkinfo.cfg phonebooktest/winscw_udeb/mtpbkiconid.dll phonebooktest/general/testframework/testframework_pbkicon.ini phonebooktest/general/testframework/tcbctestpbkicon.cfg - phonebooktest/general/testframework/ui_tcbctestpbkicon.cfg + phonebooktest/general/testframework/ui_bctestpbkicon.cfg phonebooktest/winscw_udeb/mtpbkfields.dll phonebooktest/general/testframework/testframework_pbkfeilds.ini @@ -1992,7 +1991,7 @@ phonebooktest/winscw_udeb/mtpbkfielddata.dll phonebooktest/general/testframework/testframework_pbkfdata.ini phonebooktest/general/testframework/tcbctestpbkfdata.cfg - phonebooktest/general/testframework/ui_tcbctestpbkfdata.cfg + phonebooktest/general/testframework/ui_bctestpbkfdata.cfg phonebooktest/winscw_udeb/mtpbkcontactiter.dll phonebooktest/general/testframework/testframework_pbkiter.ini diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/drm/drm.pl --- a/common/tools/ats/bctest/drm/drm.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/drm/drm.pl Mon Oct 05 18:24:10 2009 +0100 @@ -20,21 +20,21 @@ use File::Path; unlink "drmtest.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/drmtest/general/testframework"; mkpath "temp/drmtest/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("drm.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/drm_caf.dll", "temp/drmtest/winscw_udeb/drm_caf.dll"); -copy($epoc . "release/winscw/udeb/bcdrmcafcaps.exe", "temp/drmtest/winscw_udeb/bcdrmcafcaps.exe"); -copy($epoc . "winscw/c/testframework/testframework_drmcaf.ini", "temp/drmtest/general/testframework/testframework_drmcaf.ini"); -copy($epoc . "winscw/c/testframework/drm_caf.cfg", "temp/drmtest/general/testframework/drm_caf.cfg"); -copy($epoc . "winscw/c/content-noenc-trunc.odf", "temp/drmtest/general/content-noenc-trunc.odf"); -copy($epoc . "winscw/c/content.odf", "temp/drmtest/general/content.odf"); -copy($epoc . "winscw/c/content.txt", "temp/drmtest/general/content.txt"); -copy($epoc . "winscw/c/content-noenc.odf", "temp/drmtest/general/content-noenc.odf"); -copy($epoc . "winscw/c/content.dcf", "temp/drmtest/general/content.dcf"); +copy($epoc . "release/winscw/udeb/drm_caf.dll", "temp/drmtest/winscw_udeb/drm_caf.dll") or die "failed : $!"; +copy($epoc . "release/winscw/udeb/bcdrmcafcaps.exe", "temp/drmtest/winscw_udeb/bcdrmcafcaps.exe") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testframework_drmcaf.ini", "temp/drmtest/general/testframework/testframework_drmcaf.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/drm_caf.cfg", "temp/drmtest/general/testframework/drm_caf.cfg") or die "failed : $!"; +copy($epoc . "winscw/c/content-noenc-trunc.odf", "temp/drmtest/general/content-noenc-trunc.odf") or die "failed : $!"; +copy($epoc . "winscw/c/content.odf", "temp/drmtest/general/content.odf") or die "failed : $!"; +copy($epoc . "winscw/c/content.txt", "temp/drmtest/general/content.txt") or die "failed : $!"; +copy($epoc . "winscw/c/content-noenc.odf", "temp/drmtest/general/content-noenc.odf") or die "failed : $!"; +copy($epoc . "winscw/c/content.dcf", "temp/drmtest/general/content.dcf") or die "failed : $!"; system("7z a -tzip drmtest.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/drm/drm.xml --- a/common/tools/ats/bctest/drm/drm.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/drm/drm.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/landmarks_api/landmarks.xml --- a/common/tools/ats/bctest/locationsrv/landmarks_api/landmarks.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/landmarks_api/landmarks.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/landmarks_api/landmarks_api.pl --- a/common/tools/ats/bctest/locationsrv/landmarks_api/landmarks_api.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/landmarks_api/landmarks_api.pl Mon Oct 05 18:24:10 2009 +0100 @@ -17,18 +17,18 @@ use File::Path; unlink "landmarks_api.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/landmarks/general/testframework"; mkpath "temp/landmarks/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("landmarks.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/testlandmarksapi.dll", "temp/landmarks/winscw_udeb/testlandmarksapi.dll"); -copy($epoc . "winscw/c/testframework/TestFramework_Landmarks.ini", "temp/landmarks/general/testframework/TestFramework_Landmarks.ini"); -copy($epoc . "winscw/c/testframework/testlandmarksapi.cfg", "temp/landmarks/general/testframework/testlandmarksapi.cfg"); -copy($epoc . "winscw/c/testing/data/smiltemplate.mif", "temp/landmarks/general/smiltemplate.mif"); -copy($epoc . "winscw/c/testing/data/testEposLmImport.lmx", "temp/landmarks/general/testEposLmImport.lmx"); -copy($epoc . "winscw/c/testing/data/testEposLmImportCollection.lmx", "temp/landmarks/general/testEposLmImportCollection.lmx"); +copy($epoc . "release/winscw/udeb/testlandmarksapi.dll", "temp/landmarks/winscw_udeb/testlandmarksapi.dll") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/TestFramework_Landmarks.ini", "temp/landmarks/general/testframework/TestFramework_Landmarks.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testlandmarksapi.cfg", "temp/landmarks/general/testframework/testlandmarksapi.cfg") or die "failed : $!"; +copy($epoc . "winscw/c/testing/data/smiltemplate.mif", "temp/landmarks/general/smiltemplate.mif") or die "failed : $!"; +copy($epoc . "winscw/c/testing/data/testEposLmImport.lmx", "temp/landmarks/general/testEposLmImport.lmx") or die "failed : $!"; +copy($epoc . "winscw/c/testing/data/testEposLmImportCollection.lmx", "temp/landmarks/general/testEposLmImportCollection.lmx") or die "failed : $!"; system("7z a -tzip landmarks_api.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.pl --- a/common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.pl Mon Oct 05 18:24:10 2009 +0100 @@ -20,15 +20,15 @@ use File::Path; unlink "lmdbmanagementtest.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/lmdbmanagementtest/general/testframework"; mkpath "temp/lmdbmanagementtest/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("lmdbmanagement.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/testdbmanagementapi.dll", "temp/lmdbmanagementtest/winscw_udeb/testdbmanagementapi.dll"); -copy($epoc . "winscw/c/testframework/testframework_lmdbmanagement.ini", "temp/lmdbmanagementtest/general/testframework/testframework_lmdbmanagement.ini"); -copy($epoc . "winscw/c/testframework/testdbmanagementapi.cfg", "temp/lmdbmanagementtest/general/testframework/testdbmanagementapi.cfg"); +copy($epoc . "release/winscw/udeb/testdbmanagementapi.dll", "temp/lmdbmanagementtest/winscw_udeb/testdbmanagementapi.dll") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testframework_lmdbmanagement.ini", "temp/lmdbmanagementtest/general/testframework/testframework_lmdbmanagement.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testdbmanagementapi.cfg", "temp/lmdbmanagementtest/general/testframework/testdbmanagementapi.cfg") or die "failed : $!"; system("7z a -tzip lmdbmanagementtest.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.xml --- a/common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/lmdbmanagement/lmdbmanagement.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.pl --- a/common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.pl Mon Oct 05 18:24:10 2009 +0100 @@ -20,15 +20,15 @@ use File::Path; unlink "lmsearchtest.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/lmsearchtest/general/testframework"; mkpath "temp/lmsearchtest/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("lmsearch.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/testlmksearchapi.dll", "temp/lmsearchtest/winscw_udeb/testlmksearchapi.dll"); -copy($epoc . "winscw/c/testframework/TestFramework_lmsearch.ini", "temp/lmsearchtest/general/testframework/TestFramework_lmsearch.ini"); -copy($epoc . "winscw/c/testframework/testlmksearchapi.cfg", "temp/lmsearchtest/general/testframework/testlmksearchapi.cfg"); +copy($epoc . "release/winscw/udeb/testlmksearchapi.dll", "temp/lmsearchtest/winscw_udeb/testlmksearchapi.dll") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/TestFramework_lmsearch.ini", "temp/lmsearchtest/general/testframework/TestFramework_lmsearch.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testlmksearchapi.cfg", "temp/lmsearchtest/general/testframework/testlmksearchapi.cfg") or die "failed : $!"; system("7z a -tzip lmsearchtest.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.xml --- a/common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/lmsearch/lmsearch.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/locationsrv/locblid/locblid.pl --- a/common/tools/ats/bctest/locationsrv/locblid/locblid.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/locationsrv/locblid/locblid.pl Mon Oct 05 18:24:10 2009 +0100 @@ -20,16 +20,16 @@ use File::Path; unlink "locblidtest.zip"; -##rmtree "temp"; +rmtree "temp"; mkpath "temp/locblidtest/general/testframework"; mkpath "temp/locblidtest/winscw_udeb"; my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("locblid.xml", "temp/test.xml"); -copy($epoc . "release/winscw/udeb/BCBlidTest.dll", "temp/locblidtest/winscw_udeb/BCBlidTest.dll"); -copy($epoc . "winscw/c/testframework/testframework_locblid.ini", "temp/locblidtest/general/testframework/testframework_locblid.ini"); -copy($epoc . "winscw/c/testframework/tcLmkBlid.cfg", "temp/locblidtest/general/testframework/tcLmkBlid.cfg"); -copy($epoc . "winscw/c/testframework/UI_BCBLid.cfg", "temp/locblidtest/general/testframework/UI_BCBLid.cfg"); +copy($epoc . "release/winscw/udeb/BCBlidTest.dll", "temp/locblidtest/winscw_udeb/BCBlidTest.dll") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/testframework_locblid.ini", "temp/locblidtest/general/testframework/testframework_locblid.ini") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/tcLmkBlid.cfg", "temp/locblidtest/general/testframework/tcLmkBlid.cfg") or die "failed : $!"; +copy($epoc . "winscw/c/testframework/UI_BCBLid.cfg", "temp/locblidtest/general/testframework/UI_BCBLid.cfg") or die "failed : $!"; system("7z a -tzip locblidtest.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/messaging/messaging.xml --- a/common/tools/ats/bctest/messaging/messaging.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/messaging/messaging.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - @@ -143,7 +142,7 @@ - + diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/messagingmw/sendui/sendui.xml --- a/common/tools/ats/bctest/messagingmw/sendui/sendui.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/messagingmw/sendui/sendui.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/multimedia/multimediasvs.pl --- a/common/tools/ats/bctest/multimedia/multimediasvs.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/multimedia/multimediasvs.pl Mon Oct 05 18:24:10 2009 +0100 @@ -21,7 +21,7 @@ use File::Path; unlink "multimediatest.zip"; -rmtree "temp" or die "failed : $!"; +rmtree "temp"; mkpath "temp/multimediatest/general/multimedia/t_imagedecoder"; mkpath "temp/multimediatest/general/multimedia/t_imageencoder"; diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/multimedia/multimediatest.xml --- a/common/tools/ats/bctest/multimedia/multimediatest.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/multimedia/multimediatest.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/package_definition.xml --- a/common/tools/ats/bctest/package_definition.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/package_definition.xml Mon Oct 05 18:24:10 2009 +0100 @@ -1,169 +1,400 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]> - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + - - - - - - - - - - - - - - + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - + + + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - \ No newline at end of file + diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/pim/clock/clock.xml --- a/common/tools/ats/bctest/pim/clock/clock.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/pim/clock/clock.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/syslibs/syslibssvs.pl --- a/common/tools/ats/bctest/syslibs/syslibssvs.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/syslibs/syslibssvs.pl Mon Oct 05 18:24:10 2009 +0100 @@ -28,16 +28,16 @@ my $epoc=$ENV{'EPOCROOT'} . "epoc32/"; copy("syslibstest.xml", "temp/test.xml"); -copy($epoc . "data/z/syslibs/t_syslibs.tcs", "temp/syslibstest/general/syslibs/t_syslibs.tcs"); -copy($epoc . "data/z/syslibs/winscw/t_syslibs.ini", "temp/syslibstest/general/syslibs/t_syslibs.ini"); +copy($epoc . "data/z/syslibs/t_syslibs.tcs", "temp/syslibstest/general/syslibs/t_syslibs.tcs") or die "failed : $!"; +copy($epoc . "data/z/syslibs/winscw/t_syslibs.ini", "temp/syslibstest/general/syslibs/t_syslibs.ini") or die "failed : $!"; -copy($epoc . "data/z/ecom/syslib-ecom-publicapi.script", "temp/syslibstest/general/ecom/syslib-ecom-publicapi.script"); -copy($epoc . "data/z/ecom/syslib-ecom-publicapi.ini", "temp/syslibstest/general/ecom/syslib-ecom-publicapi.ini"); -copy($epoc . "data/z/ecom/testproduct_plugin.rsc", "temp/syslibstest/general/ecom/testproduct_plugin.rsc"); -copy($epoc . "release/winscw/udeb/testproduct_plugin.dll", "temp/syslibstest/general/ecom/testproduct_plugin.dll"); +copy($epoc . "data/z/ecom/syslib-ecom-publicapi.script", "temp/syslibstest/general/ecom/syslib-ecom-publicapi.script") or die "failed : $!"; +copy($epoc . "data/z/ecom/syslib-ecom-publicapi.ini", "temp/syslibstest/general/ecom/syslib-ecom-publicapi.ini") or die "failed : $!"; +copy($epoc . "data/z/ecom/testproduct_plugin.rsc", "temp/syslibstest/general/ecom/testproduct_plugin.rsc") or die "failed : $!"; +copy($epoc . "release/winscw/udeb/testproduct_plugin.dll", "temp/syslibstest/general/ecom/testproduct_plugin.dll") or die "failed : $!"; -copy($epoc . "release/winscw/udeb/t_ecom.exe", "temp/syslibstest/winscw_udeb/t_ecom.exe"); -copy($epoc . "release/winscw/udeb/tpcopyfileutility.exe", "temp/syslibstest/winscw_udeb/tpcopyfileutility.exe"); -copy($epoc . "release/winscw/udeb/tpdeletefileutility.exe", "temp/syslibstest/winscw_udeb/tpdeletefileutility.exe"); +copy($epoc . "release/winscw/udeb/t_ecom.exe", "temp/syslibstest/winscw_udeb/t_ecom.exe") or die "failed : $!"; +copy($epoc . "release/winscw/udeb/tpcopyfileutility.exe", "temp/syslibstest/winscw_udeb/tpcopyfileutility.exe") or die "failed : $!"; +copy($epoc . "release/winscw/udeb/tpdeletefileutility.exe", "temp/syslibstest/winscw_udeb/tpdeletefileutility.exe") or die "failed : $!"; system("7z a -tzip syslibstest.zip ./temp/*"); diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/syslibs/syslibstest.xml --- a/common/tools/ats/bctest/syslibs/syslibstest.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/syslibs/syslibstest.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/systemsw/systemsw.pl --- a/common/tools/ats/bctest/systemsw/systemsw.pl Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/systemsw/systemsw.pl Mon Oct 05 18:24:10 2009 +0100 @@ -36,7 +36,7 @@ copy($epoc . "release/winscw/udeb/sysutiltest.dll", "temp/systemswtest/winscw_udeb/sysutiltest.dll") or die "failed : $!"; copy($epoc . "release/winscw/udeb/stiftextresolvertest.dll", "temp/systemswtest/winscw_udeb/stiftextresolvertest.dll") or die "failed : $!"; copy($epoc . "release/winscw/udeb/hwresmantest.dll", "temp/systemswtest/winscw_udeb/hwresmantest.dll") or die "failed : $!"; -copy($epoc . "release/winscw/udeb/vibractrltest.dll", "temp/systemswtest/winscw_udeb/vibractrltest.dll") or die "failed : $!"; +##copy($epoc . "release/winscw/udeb/vibractrltest.dll", "temp/systemswtest/winscw_udeb/vibractrltest.dll") or die "failed : $!"; copy($epoc . "release/winscw/udeb/platformvertest.dll", "temp/systemswtest/winscw_udeb/platformvertest.dll") or die "failed : $!"; copy($epoc . "release/winscw/udeb/accmonapibctests.dll", "temp/systemswtest/winscw_udeb/accmonapibctests.dll") or die "failed : $!"; diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/systemsw/systemsw.xml --- a/common/tools/ats/bctest/systemsw/systemsw.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/systemsw/systemsw.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - @@ -337,38 +336,6 @@ - - - makedir - - - - - - install - - - - - - - - - execute - - - - - - - - - fetch-log - - - - - makedir @@ -438,5 +405,16 @@ systemswtest/winscw_udeb/featuremanagertest.dll + systemswtest/winscw_udeb/finditemenginetest.dll + systemswtest/winscw_udeb/light.dll + systemswtest/winscw_udeb/networkstatustest.dll + systemswtest/winscw_udeb/phoneparsertest.dll + systemswtest/winscw_udeb/platformenvtest.dll + systemswtest/winscw_udeb/powerstatetest.dll + systemswtest/winscw_udeb/sysutiltest.dll + systemswtest/winscw_udeb/stiftextresolvertest.dll + systemswtest/winscw_udeb/hwresmantest.dll + systemswtest/winscw_udeb/platformvertest.dll + systemswtest/winscw_udeb/accmonapibctests.dll diff -r 3692c6f462b4 -r 6358982cd10e common/tools/ats/bctest/websrv/websrv.xml --- a/common/tools/ats/bctest/websrv/websrv.xml Mon Oct 05 18:23:03 2009 +0100 +++ b/common/tools/ats/bctest/websrv/websrv.xml Mon Oct 05 18:24:10 2009 +0100 @@ -8,7 +8,6 @@ - diff -r 3692c6f462b4 -r 6358982cd10e common/tools/brag/brag.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/brag/brag.xsl Mon Oct 05 18:24:10 2009 +0100 @@ -0,0 +1,80 @@ + + + + + + + + + + Build Status + +

Build Status

+ + + + + + +

+ Overall BRAG staus: + + BLACK + RED + AMBER + GREEN + GOLD! + +

+ +

Breakdown by severity

+ + + + + + +
Critical
Major
Minor
Unknown
Grand total
+ +

Breakdown by phase/step

+ + + + + + + + + + + + + + + + + + + +
Phase:
Step:
Failures: Number:
+ + + +

Breakdown by package

+ + + + + + + +
PackageTotal failures
+
+ + + +
+ +
+ diff -r 3692c6f462b4 -r 6358982cd10e common/tools/brag/bragForDiamonds.xsl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/brag/bragForDiamonds.xsl Mon Oct 05 18:24:10 2009 +0100 @@ -0,0 +1,27 @@ + + + + + + + + + + + 13 + + + + Black + Red + Amber + Green + Gold + + + + + + + + diff -r 3692c6f462b4 -r 6358982cd10e common/tools/brag/logToBRAG.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/brag/logToBRAG.pl Mon Oct 05 18:24:10 2009 +0100 @@ -0,0 +1,183 @@ +#!perl -w +# +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Identifies failures in a log file (as determined by a set of rules) and produces a BRAG XML summary + +use strict; + +use Getopt::Long; + +my $phaseName; +my $stepName; +my $rulesFile; +my $help = 0; +GetOptions(( + 'phase=s' => \$phaseName, + 'step=s' => \$stepName, + 'rules=s' => \$rulesFile, + 'help!' => \$help, +)); + +my $wrongArgs = 0; +unless ($help) +{ + $wrongArgs += warn "No phase specified to indicate the phase that the failures fall under\n" unless defined $phaseName; + $wrongArgs += warn "No step specified to indicate the step that the failures fall under\n" unless defined $stepName; + $wrongArgs += warn "No file of rules specified to interpret the log file\n" unless defined $rulesFile; + $wrongArgs += warn "No log files to process\n" unless @ARGV; +} +if ($help || $wrongArgs) +{ + print <<"EOT"; + +logToBRAG.pl --phase=prebuild --step=syncsource --rules=syncsourceRules.tsv presync.log [doSync.log ...] > output.xml +EOT + exit(0 + !$help); +} + +# Do the wild-carding thing +@ARGV = map { glob $_ } @ARGV; + +# Start to build structure to be output as XML (same format as XML::Parser would create for us) +my $xmlNewline = bless { Text => "\n" }, "Characters"; +my $step = bless { + name => $stepName, + Kids => [ $xmlNewline ] +}, "step"; +my $phase = bless { + name => $phaseName, + Kids => [ $xmlNewline, $step, $xmlNewline ] +}, "phase"; +my $buildStatus = [ bless { + Kids => + [ + $xmlNewline, + $phase, + $xmlNewline, + ] +}, "buildStatus"]; + +# Also create empty tags with severities in a sensible order +# And shortcuts to those items +my $severityShortcut = {}; +foreach my $severity (qw{critical major minor}) +{ + my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures"; + push @{$step->{Kids}}, $failureSet, $xmlNewline; + $severityShortcut->{$severity} = $failureSet; +} + +# Read rules file +my @rules; +open(TSV, $rulesFile) or die "Unable to open rules file '$rulesFile'\n"; +while (my $line = ) +{ + chomp $line; + next unless $line; + my @terms = split m{\t+}, $line; + die "Rules file not formatted as expected at line $.\n" unless scalar @terms == 2; + push @rules, { regexp => qr{$terms[0]}, severity => $terms[1] }; +} + +# Iterate through all the lines of all the files in @ARGV +while (my $line = <>) +{ + chomp $line; + foreach my $rule (@rules) + { + if ($line =~ m[$rule->{regexp}]) + { + last if $rule->{severity} eq "ignore"; + # We found a match + my $failure = bless{ Kids => [ bless { Text => $line }, "Characters" ] }, "failure"; + # Ensure we have a tag for this severity + if (!exists $severityShortcut->{$rule->{severity}}) + { + # Create the failure set and add it to the shortcut list too + my $failureSet = bless { level => $rule->{severity}, Kids => [ $xmlNewline ] }, "failures"; + push @{$step->{Kids}}, $failureSet, $xmlNewline; + $severityShortcut->{$rule->{severity}} = $failureSet; + } + push @{$severityShortcut->{$rule->{severity}}->{Kids}}, $failure, $xmlNewline; + # Do not consider any more rules + last; + } + } +} + +# Print XML +print "\n"; +print "\n"; +printTree($buildStatus->[0]); +print "\n"; + +exit(0); + +sub printTree +{ + my $tree = shift or die; + die unless ref $tree; + + my $tagName = ref $tree; + $tagName =~ s{^main::}{}; + if ($tagName eq "Characters") + { + print escapeForXML($tree->{Text}); + return; + } + + print "<$tagName"; + + foreach my $attr ( + sort { + my $order = "name level start stop href"; + my $ixA = index $order, $a; + my $ixB = index $order, $b; + die "$a $b" if $ixA + $ixB == -2; + $ixA - $ixB; + } + grep { + ! ref $tree->{$_} + } + keys %$tree) + { + print " $attr=\"$tree->{$attr}\""; + } + + my $children = $tree->{Kids} || []; + if (scalar @$children) + { + print ">"; + foreach my $child (@$children) + { + printTree($child); + } + print ""; +} + +sub escapeForXML +{ + $_ = shift; + s{&}{&}g; + s{<}{<}g; + s{>}{>}g; + return $_; +} diff -r 3692c6f462b4 -r 6358982cd10e common/tools/brag/raptorToBRAG.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/brag/raptorToBRAG.pl Mon Oct 05 18:24:10 2009 +0100 @@ -0,0 +1,210 @@ +#!perl -w +# +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Generate the BRAG-compatible XML summary of the Raptor log from the CSV output of the raptor parser + +use strict; + +use Getopt::Long; +use Text::CSV; + + +my $raptorSummary; +my $help = 0; +GetOptions(( + 'raptorsummary=s' => \$raptorSummary, + 'help!' => \$help +)); + +$help = 1 if (!$raptorSummary); +if ($help) +{ + print "Generate an XML summary of the Raptor build from a summary.csv file\n"; + print "Usage: perl summarize.pl --raptorsummary=CSV\n"; + exit(0); +} + +# Start to build structure to be output as XML (same format as XML::Parser would create for us) +my $xmlNewline = bless { Text => "\n" }, "Characters"; +my $buildStatus = +[ + bless + { + Kids => + [ + $xmlNewline, + bless + { + name => "build", + Kids => [ $xmlNewline ] + }, "phase", + ] + }, "buildStatus" +]; +# Get a shortcut reference to the bit we will use a lot +my $buildPhase = $buildStatus->[0]->{Kids}->[-1]; + +# READ SUMMARY.CSV FILE +open(CSV, $raptorSummary); +my $csv = Text::CSV->new(); +while (my $line = ) +{ + chomp $line; + + unless ($csv->parse($line)) + { + my $err = $csv->error_input(); + warn "Failed to parse $raptorSummary line line $. as CSV '$line': $err Skipping\n"; + next; + } + + my @keys = qw{category subcategory severity config component phase recipe file linenum}; + my @values = $csv->fields(); + unless (scalar @keys == scalar @keys) + { + warn "WARNING: line does not match expected format at $raptorSummary line $.. Skipping\n"; + next; + } + + # Populate the hash using a hash slice + my $failure = {}; + @{$failure}{@keys} = @values; + + if (!$failure->{category}) + { + warn "WARNING: summary line without a category at $raptorSummary line $.. Skipping\n"; + next; + } + + if ($failure->{category} =~ m{^recipe_failure$}i and !$failure->{component}) + { + warn "WARNING: recipe_failure with component field empty at $raptorSummary line $.. Skipping\n"; + next; + } + $failure->{subcategory} ||= 'uncategorized'; + $failure->{severity} ||= 'unknown'; + + # Look through the steps to see if we already have one to match this config + my $step; + foreach (@{$buildPhase->{Kids}}) + { + next unless ref $_ eq "step"; + if ($_->{name} eq $failure->{config}) + { + $step = $_; + last; + } + } + unless ($step) + { + # First item found in this step - create step entry + $step = bless { name => $failure->{config}, Kids => [ $xmlNewline ] }, "step"; + push @{$buildPhase->{Kids}}, $step, $xmlNewline; + # Also create empty tags with severities in a sensible order + foreach my $severity (qw{critical major minor}) + { + my $failureSet = bless { level => $severity, Kids => [ $xmlNewline ] }, "failures"; + push @{$step->{Kids}}, $failureSet, $xmlNewline; + } + } + + # Look through the sets of failures in this step to see if we hve one which matches this severity + my $failureSet; + foreach (@{$step->{Kids}}) + { + next unless ref $_ eq "failures"; + if ($_->{level} eq $failure->{severity}) + { + $failureSet = $_; + last; + } + } + unless ($failureSet) + { + # First item found at this severity - create failures entry + $failureSet = bless { level => $failure->{severity}, Kids => [ $xmlNewline ] }, "failures"; + push @{$step->{Kids}}, $failureSet, $xmlNewline; + } + + # Now create the failure itself, and add it to this failure set + my $failureItem = bless { +# href => "", + Kids => [ bless { Text => $failure->{subcategory} }, "Characters" ] + }, "failure"; + if ($failure->{component}) + { + $failure->{component} =~ s{^(/sf/.*?/.*?)/.*$}{$1}; + $failureItem->{package} = $failure->{component}; + } + push @{$failureSet->{Kids}}, $failureItem, $xmlNewline; +} +close(CSV); + +# Print XML +print "\n"; +print "\n"; +printTree($buildStatus->[0]); +print "\n"; + +exit(0); + +sub printTree +{ + my $tree = shift or die; + die unless ref $tree; + + my $tagName = ref $tree; + $tagName =~ s{^main::}{}; + if ($tagName eq "Characters") + { + print $tree->{Text}; + return; + } + + print "<$tagName"; + + foreach my $attr ( + sort { + my $order = "name level start stop href"; + my $ixA = index $order, $a; + my $ixB = index $order, $b; + die "$a $b" if $ixA + $ixB == -2; + $ixA - $ixB; + } + grep { + ! ref $tree->{$_} + } + keys %$tree) + { + print " $attr=\"$tree->{$attr}\""; + } + + my $children = $tree->{Kids} || []; + if (scalar @$children) + { + print ">"; + foreach my $child (@$children) + { + printTree($child); + } + print ""; +} + diff -r 3692c6f462b4 -r 6358982cd10e common/tools/mergeXML.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/common/tools/mergeXML.pl Mon Oct 05 18:24:10 2009 +0100 @@ -0,0 +1,193 @@ +#!perl -w +# Copyright (c) 2009 Symbian Foundation Ltd +# This component and the accompanying materials are made available +# under the terms of the License "Eclipse Public License v1.0" +# which accompanies this distribution, and is available +# at the URL "http://www.eclipse.org/legal/epl-v10.html". +# +# Initial Contributors: +# Symbian Foundation Ltd - initial contribution. +# +# Contributors: +# +# Description: +# Merge a set of XML files + +use strict; + +use XML::Parser; +use Getopt::Long; + +# Read option arguments +my $howtoString; +my $xslLink; +my $help; +GetOptions(( + 'xsl=s' => \$xslLink, + 'merge=s' => \$howtoString, + 'help!' => \$help, +)); + +my $wrongArgs = 0; +unless ($help) +{ + $wrongArgs += warn "No merge string specified to indicate how the files should be merged\n" unless defined $howtoString; + $wrongArgs += warn "No files to be merged\n" unless scalar @ARGV; +} +if ($help || $wrongArgs) +{ + print <<"EOT"; + +mergeXML.pl --xsl=brag.xsl --merge=SystemDefinition,systemModel,layer(name),block(name),package(name) sysModel1.xml [model*.xml ...] > output.xml +EOT + exit(0 + !$help); +} + +# Hash of tags that should be merged, with optional attribute consideration +my $mergeTags; +foreach my $term (split m{\s*,\s*}, $howtoString) +{ + my ($tag, $attribute) = $term =~ m{(\w+)\((\w+)\)}; + $tag ||= $term; + $mergeTags->{$tag} = $attribute; +} + +# Expand wildcards +@ARGV = map { glob $_ } @ARGV; + +# Merge all the trees together +my $outTree = mergeMultipleTrees($mergeTags, @ARGV); + +# Output total tree +print "\n"; +print "\n" if $xslLink; +printTree($outTree->[0]); +print "\n"; + +exit(0); + +sub mergeMultipleTrees +{ + my $mergeTags = shift or die; + + # Create an XML parser + my $parser = new XML::Parser(Style => "Objects") or die; + + my $outTree; + # For each XML file to merge... + foreach my $xmlFile (@_) + { + my $tree = eval { $parser->parsefile($xmlFile) } or die "Failed to parse $xmlFile : $@"; + if (!$outTree) + { + # The first file is taken verbatim + $outTree = $tree; + } + else + { + # Merge into output Tree + mergeTwoTrees($outTree->[0], $tree->[0], $mergeTags); + } + } + + return $outTree; +} + +sub mergeTwoTrees +{ + my $baseTree = shift or die; + my $extrasTree = shift or die; + my $mergeTags = shift or die; + + die ("Trees do not match: ".(ref $baseTree)." vs ".(ref $extrasTree)) unless ref $baseTree eq ref $extrasTree; + return if ref $baseTree eq "main::Characters"; + + foreach my $extraChild (@{$extrasTree->{Kids}}) + { + # Work out whether this child should be merged with a namesake, or appended + my $mergeIt; + + my $extraChildTag = ref $extraChild; + $extraChildTag =~ s{^main::}{}; + + if (exists $mergeTags->{$extraChildTag}) + { + # Should be merged if there's already one there + # Look for a namesake in the base + $mergeIt = matchTag($baseTree->{Kids}, $extraChild, $mergeTags->{$extraChildTag}); + } + + if ($mergeIt) + { + # Merge children + mergeTwoTrees($mergeIt, $extraChild, $mergeTags); + } + else + { + # Add this child + push @{$baseTree->{Kids}}, $extraChild; + } + } +} + +sub matchTag +{ + my $peers = shift; + my $outsider = shift; + my $attr = shift; + + foreach my $peer (@$peers) + { + if (ref $peer eq ref $outsider && (!defined $attr || $peer->{$attr} eq $outsider->{$attr})) + { + return $peer; + } + } + + return undef; +} + +sub printTree +{ + my $tree = shift or die; + die unless ref $tree; + + my $tagName = ref $tree; + $tagName =~ s{^main::}{}; + if ($tagName eq "Characters") + { + print $tree->{Text}; + return; + } + + print "<$tagName"; + + foreach my $attr ( + sort + grep { + ! ref $tree->{$_} + } + keys %$tree) + { + print " $attr=\"$tree->{$attr}\""; + } + + my $children = $tree->{Kids}; + if (scalar @$children) + { + print ">"; + foreach my $child (@$children) + { + printTree($child); + } + print ""; +} + +