sdkcreationmw/sdkbuild/SDK_WINSCW/Remote_utils.pm
author Shabe Razvi <shaber@symbian.org>
Thu, 04 Nov 2010 17:22:05 +0000
changeset 4 b3b823debf08
parent 0 b26acd06ea60
permissions -rw-r--r--
Workaround for Bug 3917 - CWinsockInterface::DataSent calls NotifyDataSent which is not implemented.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     1
#
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     2
# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     3
# All rights reserved.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     4
# This component and the accompanying materials are made available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     5
# under the terms of "Eclipse Public License v1.0"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     6
# which accompanies this distribution, and is available
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     8
#
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
     9
# Initial Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    10
# Nokia Corporation - initial contribution.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    11
#
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    12
# Contributors:
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    13
#
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    14
# Description: 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    15
#
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    16
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    17
package Remote_utils;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    18
use SDK_vars;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    19
use SDK_utils;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    20
use ApiRef;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    21
use File::Path;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    22
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    23
use XML::Writer;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    24
use IO::File;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    25
use XML::Simple;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    26
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    27
use HTTP::Response;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    28
use HTTP::Request::Common qw(POST);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    29
use LWP::UserAgent;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    30
use Mail::Sendmail qw(sendmail %mailcfg);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    31
use Cwd;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    32
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    33
our ($VERSION, @ISA, @EXPORT);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    34
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    35
$VERSION = 1.00;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    36
@ISA = qw(Exporter);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    37
@EXPORT = qw(copy_platform reconfigure fetch_IF_sheets create_api_and_black_lists Notify_plain_mail Notify_mail beatnik fetch_capas Notify_sms);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    38
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    39
sub copy_platform {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    40
  my ($href) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    41
  enter_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    42
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    43
  my $curr_dir = cwd;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    44
  system ("subst");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    45
  chdir "$$href{S60_Root}\\";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    46
  my $cmd = "xcopy $iniH{Getenv_server}\\Builds\\Tools\\getenv\\getenv.pl $$href{S60_Root} /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    47
  system ($cmd)==0 or die "$cmd failed!\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    48
  foreach my $pl_src_path ( split (/ /, $iniH{Platform_Build}) ){
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    49
    $cmd = "perl getenv.pl -start -k -path $pl_src_path -grace -verbose";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    50
    print "$cmd\n"; system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    51
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    52
  chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    53
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    54
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    55
sub reconfigure {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    56
  my ($href) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    57
 	my $four_part_name;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    58
  enter_sub($$href{SCM_Project});
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    59
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    60
  $|=1;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    61
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    62
  my $pwd = `getPwd Synergy` or print "\n ERROR: Can not Execute getPwd Synergy";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    63
  my $addr = `ccm start -r build_mgr -q -nogui -m -pw $pwd`;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    64
  print "\n CCM ADDRESS: $addr \n ";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    65
  $ENV{CCM_ADDR} = $addr if $addr;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    66
  die "Logon failed!!!" if (!$addr and $$href{'Reconfigure'} =~ /(TRUE|YES)/i);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    67
  warn "Logon failed", return unless $addr;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    68
  #Print project info
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    69
  my ($proj_name, $proj_version) = split "-", $$href{SCM_Project};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    70
  warn "Project not found", return unless $proj_version;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    71
  chomp(my $project_object = `ccm query -type project -name $proj_name -version $proj_version -u -f \"%objectname\"`);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    72
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    73
  system "ccm query -type project -name $proj_name -version $proj_version -u -f \"%objectname  %release\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    74
  print "Reconfigure $$href{'Reconfigure'}\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    75
 	if ($$href{'Reconfigure'} =~ /(TRUE|YES)/i) {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    76
    #Print the reconf time to the log
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    77
    print "Reconf_time : ";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    78
    system "ccm attr -s reconf_time \"$project_object\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    79
 		#Force Maintain workarea on
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    80
 		my $cmd = "ccm wa -wa -relative -recurse -p \"$project_object\" -path \"$iniH{SCM_WA_Path}\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    81
  	print ("\n$cmd\n\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    82
	  #First Reconcile
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    83
	  system "ccm reconc -ignore_uncontrolled -recurse -update_wa $project_object";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    84
	  #Print rp
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    85
	  system "ccm rp /sh i $project_object";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    86
	  #and tasks
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    87
	  #then reconfigure
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    88
	  system "ccm reconfigure /recurse /project $project_object";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    89
	  #Print rp
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    90
	  system "ccm rp /sh i $project_object";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    91
	  #Print the baseline
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    92
	  $cmd = "ccm rp -sh b \"$project_object\" -u";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    93
	  print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    94
	  system($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    95
	  $four_part_name="$project_object";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    96
	  print "Fout Part Project Name: $four_part_name\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    97
	  print "\n\nConflicts Start\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    98
	  $cmd = "ccm conflicts -recurse -nowrap -tasks $four_part_name";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
    99
	  print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   100
	  system($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   101
	  $cmd = "ccm conflicts -recurse -nowrap $four_part_name";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   102
	  print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   103
	  system($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   104
	  print "\n\nConflicts End\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   105
	  #and tasks
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   106
	  $cmd = "ccm rp -sh all_tasks \"$project_object\" -f \"%displayname %release  %completion_date  %owner %task_synopsis\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   107
	  print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   108
    system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   109
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   110
    #Print the task according to  Print_tasks_since  specification in sdk.ini, or print yesterday anyway
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   111
    my @tasks_since = split " ", $iniH{Print_tasks_since} || ("-1:0:0:0");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   112
    for (my $i=0; $i < @tasks_since -1; ++$i){
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   113
      $cmd = "ccm query \"(is_task_in_rp_of('$project_object') or is_task_in_folder_of(is_folder_in_rp_of('$project_object'))) and completion_date >= time('$tasks_since[$i]') and completion_date < time('$tasks_since[$i+1]')\" -f \"%displayname  %task_synopsis\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   114
     	print "\n$cmd\n\nTasks completed between [$tasks_since[$i] - $tasks_since[$i+1]):\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   115
      system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   116
      print "\nEnd of recent tasks.\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   117
    }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   118
    $cmd = "ccm query \"(is_task_in_rp_of('$project_object') or is_task_in_folder_of(is_folder_in_rp_of('$project_object'))) and completion_date > time('$tasks_since[@tasks_since-1]')\" -f \"%displayname  %task_synopsis\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   119
   	print "\n$cmd\n\nRecently completed tasks (since $tasks_since[@tasks_since-1]):\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   120
    system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   121
    print "\nEnd of recent tasks.\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   122
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   123
    #Print the reconf time to the log
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   124
    print "Reconf_time : ";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   125
    system "ccm attr -s reconf_time \"$project_object\"";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   126
	}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   127
  #Grab the work area path
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   128
  chomp($wa_path = `ccm attr /s wa_path \"$project_object\"`);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   129
  $$href{SCM_Workarea} = $wa_path if ($wa_path and !$$href{SCM_Workarea});
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   130
 	print "\nSCM WorkArea: $$href{SCM_Workarea}\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   131
  system "ccm stop";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   132
  exit_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   133
};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   134
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   135
sub fetch_IF_sheets 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   136
{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   137
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   138
  my ($sheet_source_dir, $IFs_dir, $iniH) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   139
          
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   140
  #Check if repository directory is ready to be used, ie. it exists and is not empty, otherwise use document browser
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   141
  ($sheet_source_dir, my $doc_browser_url) = check_sheet_repository( $sheet_source_dir, $href );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   142
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   143
  enter_sub($sheet_source_dir || $doc_browser_url);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   144
  my $curr_dir = cwd;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   145
  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   146
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   147
  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   148
	mkpath($IFs_dir) unless (-e $IFs_dir);             #Make it
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   149
	#All_If_sheets_S60.zip will be downloaded to this location and then copied to $IFs_dir.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   150
	mkpath($iniH{'Sheets_Local_Repo'}) unless (-d $iniH{'Sheets_Local_Repo'});
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   151
	
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   152
 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   153
  chdir $iniH{'Sheets_Local_Repo'} or print "\n ERROR: Can not chdir to $iniH{'Sheets_Local_Repo'}, $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   154
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   155
  unless ( $sheet_source_dir )
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   156
  {#If source directory does not exists, get the stuff from server
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   157
	print "\n Download IFs to $iniH{'Sheets_Local_Repo'}, URL: $doc_browser_url";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   158
    #Get password from registry, not from user!
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   159
    open( PWD, "getPwd Sheets |") or die "Cannot open getPwd: $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   160
    chomp(my $pwd = <PWD>);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   161
    close( PWD );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   162
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   163
		$ua = LWP::UserAgent->new;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   164
		$ua->cookie_jar( {} );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   165
		my $uid = getlogin || getpwuid($<);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   166
		my $req = HTTP::Request->new(GET => "$doc_browser_url/All_If_sheets_S60.zip");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   167
		$req->authorization_basic($uid, $pwd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   168
		$res = $ua->request($req);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   169
		print "\n WARNING: Fetching $doc_browser_url All_If_sheets_S60.zip FAILED!!!\n Local copy from $iniH{'Sheets_Local_Repo'} will be used." unless ($res->is_success);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   170
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   171
		if ($res->title =~ /Web Single Sign-On Login/) 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   172
		{
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   173
		    $res = $ua->post($res->request->uri->as_string,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   174
		                     [
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   175
		                       SMENC    => 'Base64',
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   176
		                       USER     => $uid,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   177
		                       PASSWORD => $pwd,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   178
		                       submit   => "Authenticate",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   179
		                     ]);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   180
		    # We need to follow the redirect from the login page
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   181
		    $res = $ua->request($req, "All_If_sheets_S60.zip");    #The name for the output file needs to be specified somehow. Next line works also.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   182
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   183
		    print "\n WARNING: *** WebSSO post failed: ,Local copy from $iniH{'Sheets_Local_Repo'} will be used. ", $res->status_line if $res->is_error;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   184
		    print "\n WARNING: WebSSO Login failed (bad password?), Local copy from $iniH{'Sheets_Local_Repo'} will be used."          if $res->as_string =~ /authenticate via WebSSO/;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   185
		}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   186
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   187
    my $req2 = HTTP::Request->new(GET => "$doc_browser_url/Other/tools_if_sheets_compare.zip");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   188
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   189
    $res2 = $ua->request($req2, "tools_if_sheets_compare.zip");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   190
    print "\n WARNING: Fetching  tools_if_sheets_compare.zip failed, Local copy from $iniH{'Sheets_Local_Repo'} will be used." unless ($res2->is_success);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   191
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   192
  elsif(-d $sheet_source_dir) 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   193
  {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   194
    my $cmd = "xcopy $sheet_source_dir\\*.zip  /F /R /Y";                        #Copy All_If_sheets_S60.zip and tools
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   195
    system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   196
    $cmd = "xcopy $sheet_source_dir\\*.xls  /F /R /Y";                        #(First) sheet patches
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   197
    system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   198
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   199
  else 
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   200
  {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   201
    print "Nothing to fetch!\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   202
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   203
  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   204
  #Now copy from local $iniH{'Sheets_Local_Repo'} to  $IFs_dir, So if IFSHEETS site is down, it will pick from local copy
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   205
  chdir $IFs_dir or print "\n ERROR: Can not chdir to $iniH{'Sheets_Local_Repo'}, $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   206
  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   207
  print "\n\n Copy IFs from $iniH{'Sheets_Local_Repo'} to $IFs_dir\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   208
  $cmd = "xcopy $iniH{'Sheets_Local_Repo'}\\*.zip /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   209
  system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   210
  
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   211
  # Copy (own) patch sheets
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   212
  print "\n\n Copy IFs patches from $iniH{ Sheet_Patches } to $IFs_dir\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   213
  $cmd = "xcopy $iniH{ Sheet_Patches }\\*.xls /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   214
  system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   215
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   216
  chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   217
  exit_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   218
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   219
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   220
sub check_sheet_repository {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   221
  my ($zip_dir, $iniH) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   222
  my $doc_browser_url = "$iniH{Doc_Browser_Url}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   223
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   224
  (-e $zip_dir) || return ("", $doc_browser_url);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   225
  opendir(my $DIR, $zip_dir) || do {print "can't opendir $zip_dir: $!\n"; return ("", $doc_browser_url)};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   226
  my @zips = grep { /\.(zip|xls)$/i } readdir($DIR);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   227
  closedir $DIR;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   228
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   229
  if (@zips){              #We found some zips or xls files -> use that directory
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   230
    return ($zip_dir, "");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   231
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   232
  return ("", $doc_browser_url);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   233
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   234
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   235
sub create_api_and_black_lists {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   236
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   237
#  @_ = qw( 3.0 IFs sheets result \\Repository_area\\CPP_API \\Repository_area\\Common_Blacklist) unless @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   238
  my ($rel, $IFs_dir, $sheets_sub_dir, $result_dir, $cpp_api_dir, $black_list_dir, $org_dir) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   239
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   240
  enter_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   241
  my $curr_dir = cwd;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   242
  return unless (chdir $IFs_dir);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   243
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   244
  my $all_zip = "All_If_sheets_S60.zip";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   245
  $all_zip = "All_If_sheets_S60_2.zip" unless (-e $all_zip);         #Try the produced one if we are not supposed to use the server
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   246
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   247
  my $cmd = "unzip -o $all_zip -d $sheets_sub_dir";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   248
  print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   249
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   250
  $cmd = "xcopy *.xls $sheets_sub_dir\\ /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   251
  system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   252
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   253
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   254
  $cmd = "unzip -o tools_if_sheets_compare.zip";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   255
  print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   256
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   257
#  print "result dir: $result_dir\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   258
  mkpath $result_dir unless (-e $result_dir);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   259
  $cmd = "perl gather_sdk_info.pl -p S60 -r $rel -d $sheets_sub_dir -t $result_dir";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   260
  print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   261
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   262
	#Put them into one file if sheets were specified for S60, sdk_apis.txt
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   263
	if ($iniH{S60_API} eq 'sheets'){
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   264
    $cmd = "type $result_dir\\_sdk_*.txt > $result_dir\\sdk_apis.txt";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   265
    print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   266
  } else {                                 #or if metaxmls are used
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   267
    $cmd = "type $result_dir\\_sdk_*symbian*.txt > $result_dir\\sdk_apis_symbian.txt";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   268
    print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   269
    $cmd = "type $result_dir\\_sdk_*nokia*.txt > $result_dir\\sdk_apis_nokia.txt";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   270
    print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   271
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   272
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   273
  $cmd = "move /y $result_dir\\_black_list.txt $result_dir\\black_list.txt";        #Renaming!
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   274
  print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   275
  $cmd = "xcopy $result_dir\\black_list.txt $black_list_dir\\ /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   276
  system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   277
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   278
  $cmd = "zip -j All_If_sheets_S60_2.zip $sheets_sub_dir\\*.*";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   279
  print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   280
	system ("del All_If_sheets_S60.zip") if (-e "All_If_sheets_S60.zip");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   281
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   282
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   283
  $cmd = "xcopy $result_dir\\sdk_*.txt $cpp_api_dir\\ /F /R /Y";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   284
  system ($cmd)==0 or print ($cmd."\n");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   285
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   286
  chdir $curr_dir or die "Couldn't chdir to $curr_dir: $!";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   287
	print "create_api_and_black_lists finished === ", scalar localtime(), "\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   288
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   289
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   290
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   291
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   292
sub Notify_mail {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   293
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   294
  my ($msg) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   295
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   296
	print "Notifying $msg\n\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   297
	$mailcfg{smtp} = [qw(mgw.nokia.com)];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   298
	$mailcfg{from} = "$iniH{Mail_From}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   299
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   300
	%mail = ( To      => "$iniH{Mail_To}",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   301
	          Cc      => "$iniH{Mail_Cc}",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   302
						Subject => "$msg",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   303
            'content-type' => 'text/html; charset="iso-8859-1"',
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   304
	         );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   305
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   306
  $mail{body} = <<END_OF_HEADER;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   307
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   308
    "http://www.w3.org/TR/html4/loose.dtd">
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   309
<html>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   310
<head>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   311
  <title> $msg </title>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   312
<style type="text/css">
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   313
  #container
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   314
  {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   315
    padding: 1em;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   316
    width: 90%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   317
    margin: 10px auto;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   318
    line-height: 110%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   319
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   320
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   321
  body {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   322
    color: blue;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   323
    background: white;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   324
    margin-left: 1em;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   325
    margin-right: 1em;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   326
    font-family: arial, helvetica, sans-serif;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   327
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   328
  pre {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   329
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   330
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   331
  .tasks {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   332
    border: none;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   333
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   334
    font-size: 70%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   335
    color: green;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   336
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   337
  .components {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   338
    border: none;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   339
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   340
    font-size: 80%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   341
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   342
  .errors {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   343
    border: none;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   344
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   345
    font-size: 70%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   346
    color: red;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   347
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   348
  .platform_patches {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   349
    border: none;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   350
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   351
    font-size: 70%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   352
    color: maroon;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   353
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   354
  .error_reports {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   355
    border: none;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   356
    font-family: monospace;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   357
    font-size: 70%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   358
    color: magenta;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   359
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   360
  .navbar {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   361
    position: relative;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   362
    margin: 0;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   363
    padding: 1em;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   364
    font-size: 70%;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   365
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   366
  A:link, A:visited { text-decoration: none; }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   367
  A:hover { background: cyan; }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   368
</style>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   369
</head>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   370
END_OF_HEADER
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   371
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   372
  $mail{body} .= <<END_OF_BODY;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   373
<div id="container">
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   374
$body
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   375
</div>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   376
</body>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   377
</html>
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   378
END_OF_BODY
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   379
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   380
# Create the mail report in build output directory
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   381
    my $report_fn="$iniH{Output_Base}\\$iniH{Release}\\$iniH{Platform_Version_Major}.$iniH{Platform_Version_Minor}\\$iniH{Start_time}\\SDK_team_only\\Build_Log\\Build_Report.html";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   382
    open (BR, ">$report_fn") or print "\n ERROR: Can not create $report_fn";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   383
    print BR $mail{body};
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   384
    close(BR);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   385
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   386
    #Send out mail.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   387
	sendmail(%mail) or die $Mail::Sendmail::error;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   388
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   389
	print "$msg. Log says:\n", $Mail::Sendmail::log;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   390
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   391
#This Sub will take sub, meg as input and send a plain mail.
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   392
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   393
sub Notify_plain_mail {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   394
    
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   395
    enter_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   396
    my ($sub, $msg) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   397
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   398
	print "\n\n Notifying $sub\n\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   399
	$mailcfg{smtp} = [qw(mgw.nokia.com)];
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   400
	$mailcfg{from} = "$iniH{Mail_From}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   401
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   402
	%mail = ( To      => "$iniH{Mail_To}",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   403
	          Cc      => "$iniH{Mail_Cc}",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   404
						Subject => "$sub",
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   405
            Message=>"$msg"
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   406
	         );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   407
    print "\n Sending Mail  to $iniH{Mail_To}, $iniH{Mail_Cc}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   408
	sendmail(%mail) or die $Mail::Sendmail::error;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   409
	print "\n Mail Log: $Mail::Sendmail::log" if ($!);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   410
	print "\n Mail has been sent.";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   411
	exit_sub();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   412
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   413
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   414
sub Notify_sms {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   415
  my ($sms_receivers, $body) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   416
	my $ua = LWP::UserAgent->new();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   417
	my $res = $ua->request(POST 'http://smsgw.nokia.com/smsgw/systemSender',
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   418
	            [ APPLICATION_ID => 'SDK_Creation',
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   419
	              gsmnum => $sms_receivers,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   420
	              message=> $body,
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   421
	            ]);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   422
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   423
  print "$msg.\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   424
  # Check the outcome of the response
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   425
  if ($res->is_success) {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   426
      print "Success: $res->content";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   427
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   428
  else {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   429
      print $res->status_line, "\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   430
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   431
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   432
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   433
sub beatnik {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   434
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   435
  my ($source) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   436
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   437
  enter_sub($source);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   438
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   439
  #Delete the possible old directory
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   440
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   441
  unless (-d $source ) {                #Try to find the package in GRACE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   442
                                        #We need to extract the files from a big rosetta/ariane zip, may change in the future
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   443
    my $pl_version = "$iniH{Platform_Version_Major}_$iniH{Platform_Version_Minor}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   444
#    my $zip_file = "$iniH{Grace_server}\\S60RnD\\S60_$pl_version\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_rosetta\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_rosetta_epoc32.zip";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   445
    my $zip_file = "$iniH{Grace_server}\\S60RnD\\S60_$pl_version\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_ariane\\S60_${pl_version}_$iniH{Platform_Year}$iniH{Platform_Week}_RnD_ariane_epoc32.zip";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   446
    my @dlls = qw(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   447
    		BAEMmfAudioController.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   448
    		BAEMmfCodec.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   449
    		BAEMmfMidiController.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   450
    		BAEMmfStructuredFormat.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   451
        mobilebae.dll
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   452
    );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   453
    my @rsc_files = qw(
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   454
    		BAEMmfAudioController.rsc
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   455
    		BAEMmfCodec.rsc
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   456
    		BAEMmfMidiController.rsc
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   457
    		BAEMmfStructuredFormat.rsc
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   458
    );
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   459
    my
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   460
    $beatnik_files = join " ", map {"epoc32\\release\\winscw\\udeb\\$_"} @dlls;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   461
    $beatnik_files .= " ";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   462
    $beatnik_files .= join " ", map {"epoc32\\release\\winscw\\udeb\\z\\resource\\plugins\\$_"} @rsc_files;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   463
    $beatnik_files .= " epoc32\\release\\winscw\\udeb\\z\\resource\\ensb.dat";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   464
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   465
    #Unzip the files onto repository
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   466
    #NOTE: unzip can create only one directory level!
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   467
    my $cmd = "unzip -o -C $zip_file $beatnik_files -d $source";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   468
    print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   469
    system("$cmd");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   470
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   471
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   472
  #Finally copy the files onto repository area
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   473
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   474
sub fetch_capas {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   475
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   476
  my ($source) = @_;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   477
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   478
  enter_sub($source);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   479
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   480
  #Delete the possible old repository_area directory
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   481
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   482
  unless (-d $source ) {                #Try to find the package in GRACE
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   483
                                        #We need to extract the files from a big rosetta zip, may change in the future
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   484
    $SOS = get_Symbian_OS_info();
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   485
    die "No Symbian info found" unless ($SOS =~ /[\d_]/);                            #Should contain only digits or underscore
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   486
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   487
    my ($sos, $symb_year_week) = split "_", $SOS;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   488
    my ($symb_major, $symb_minor) = split "", $sos;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   489
    my $capa_file_trunk = "GT_${symb_major}.${symb_minor}";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   490
    my $zip_file = "$iniH{Grace_server}\\SymbianOS\\__SymbianOS_${sos}\\SymbianOS_${sos}_$symb_year_week\\MCL_${sos}_${symb_year_week}_src_common_other_sources_part1.zip";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   491
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   492
    #Unzip the files onto repository
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   493
    #NOTE: unzip can create only one directory level!
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   494
    my $cmd = "unzip -o -j -C $zip_file src\\common\\developerlibrary\\doc_source\\reference\\capability\\$capa_file_trunk\\${capa_file_trunk}.xml.txt -d $source";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   495
    print "$cmd\n";
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   496
    system("$cmd");
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   497
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   498
    mkpath("$source\\epoc32\\data\\capabilities") unless (-e "$source\\epoc32\\data\\capabilities");             #Make the directory for move
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   499
    $cmd = "move /y $source\\${capa_file_trunk}.xml.txt $source\\epoc32\\data\\capabilities\\${capa_file_trunk}.xml";        #Renaming!
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   500
    print ($cmd."\n"); system ($cmd);
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   501
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   502
  }
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   503
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   504
  #Finally copy the files onto repository area. We create the proper directory (epoc32\data\capabilities) only here; perhaps should be in unzip already
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   505
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   506
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   507
__END__
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   508
package SubHandlers;
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   509
sub api {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   510
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   511
sub header {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   512
  print $Remote_utils::OUT_PUT "@_[3]\n"; #The tag name (=header name) is under index 3
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   513
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   514
sub lib {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   515
  print $Remote_utils::OUT_PUT "@_[3]\n"; #The tag name (=lib name) is under index 3
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   516
}
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   517
sub api_ {
b26acd06ea60 First Contribution of SDK components
rajpuroh
parents:
diff changeset
   518
}