common/tools/test/pckg_status/scripts/check_all_pckg_test_status.pl
author Arnaud Lenoir
Tue, 12 Jan 2010 17:18:11 +0000
changeset 840 3b9cc38657db
permissions -rw-r--r--
Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
840
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     1
# Copyright (c) 2009 Symbian Foundation Ltd
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     2
# This component and the accompanying materials are made available
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     3
# under the terms of the License "Eclipse Public License v1.0"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     4
# which accompanies this distribution, and is available
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     5
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     6
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     7
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     8
# Script name: check_all_pckg_test_status.pl
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
     9
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    10
# Initial Contributors:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    11
# Symbian Foundation Ltd - initial contribution.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    12
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    13
# Contributors:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    14
# Arnaud Lenoir <arnaudl@symbian.org>
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    15
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    16
# Created 30/11/2009
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    17
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    18
# Description:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    19
# Task 286 - Package test status prep - Compile a global view for all packages that we want to analyse
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    20
#
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    21
# Parameters passed:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    22
#	Param1: Path to the file containing the directories to check for test status
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    23
#	Param2: Path to the directory containing the source code to analyse (generate a file)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    24
#	Param3: Path to the directory where DB will be published
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    25
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    26
# Modules necessary to run this script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    27
use Getopt::Long;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    28
use strict;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    29
use Text::CSV;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    30
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    31
# Parameters passed to this script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    32
my $help;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    33
my $source_path_to_analyse;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    34
my $dirs_file_path_to_analyse;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    35
my $source_csv_path_to_analyse;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    36
my $publication_directory_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    37
my $pattern_file_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    38
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    39
# Variables
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    40
my @tab_package_extraction;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    41
my @tab_package_extraction_S2;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    42
my @tab_package_extraction_S3;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    43
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    44
my $system_cmd;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    45
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    46
# Constantes declaration
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    47
my $default_publication_directory_path = "\.\\results";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    48
my $default_pattern_file_path = ".\\pckg_test_status_patterns.csv";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    49
my $pckg_dir_paths_file_name = "pckg_test_status_paths.txt";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    50
my $pckg_dir_paths_file_name_S2 = "pckg_test_status_paths_S2.txt";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    51
my $pckg_dir_paths_file_name_S3 = "pckg_test_status_paths_S3.txt";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    52
my $all_pckgs_from_source_csv= "all_pckgs_from_source_csv.txt";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    53
my $pckg_definition_pattern = "package_definition*.xml";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    54
my $pckg_definition_pattern_S2 = "package_definition.xml";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    55
my $pckg_definition_pattern_S3 = "package_definition_*.xml";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    56
my $pckg_definition_extraction_pattern = "(^[\\w\\W]+)\\package_definition";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    57
my $csv_status_file_name = "packages_tests_supported_status.csv";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    58
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    59
my $nb_arg_passed = scalar(@ARGV);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    60
if(!$nb_arg_passed)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    61
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    62
	print "No arguments/parameters passed then print help!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    63
	helpme();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    64
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    65
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    66
my %optmap = (  'source_path_to_analyse' => \$source_path_to_analyse,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    67
			    'dirs_file_path_to_analyse' => \$dirs_file_path_to_analyse,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    68
			    'publication_directory_path' => \$publication_directory_path,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    69
				'source_csv_path_to_analyse' => \$source_csv_path_to_analyse,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    70
			    'pattern_file_path' => \$pattern_file_path,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    71
                'help' => \$help);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    72
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    73
GetOptions(\%optmap,
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    74
		  'source_path_to_analyse=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    75
		  'dirs_file_path_to_analyse=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    76
		  'publication_directory_path=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    77
		  'source_csv_path_to_analyse=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    78
		  'pattern_file_path=s',
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    79
          'help');
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    80
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    81
print "The value for help is: <$help>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    82
print "source_path_to_analyse: <$source_path_to_analyse>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    83
print "dirs_file_path_to_analyse: <$dirs_file_path_to_analyse>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    84
print "publication_directory_path: <$publication_directory_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    85
print "source_csv_path_to_analyse: <$source_csv_path_to_analyse>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    86
print "pattern_file_path: <$pattern_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    87
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    88
if ($help)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    89
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    90
	print "We want to print the help\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    91
	helpme();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    92
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    93
else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    94
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    95
	print "\nIt's from here that the real work starts!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    96
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    97
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    98
# Check if we need default values for some of the parameters
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
    99
# Publication directory
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   100
if (!defined($publication_directory_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   101
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   102
	print "No publication_directory_path passed as argument, therefore use default path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   103
	$publication_directory_path = $default_publication_directory_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   104
	print "publication_directory_path = <$publication_directory_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   105
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   106
# Check if we have a directory use for publishing. If not create it
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   107
print "Check if $publication_directory_path exist or not!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   108
if (!(-d $publication_directory_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   109
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   110
	print "The directory $publication_directory_path, doesn't exist, therefore we create it\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   111
	$system_cmd = "mkdir $publication_directory_path";	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   112
	print "Exec: $system_cmd\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   113
	system($system_cmd);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   114
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   115
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   116
# We are going to packages type of tests supported in a csv file and before to do that we are going to make sure that if a file exist, then we rename it.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   117
# File will be renamed before .csv with date & time in the format:
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   118
# year-month-day@hour-minute
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   119
# Eg: packages_tests_supported_status-2009-12-11@10-57.csv
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   120
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   121
my $csv_status_file_path = "$publication_directory_path\\$csv_status_file_name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   122
print "The full path for the csv packages tests status file is: $csv_status_file_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   123
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   124
if(-f $csv_status_file_path)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   125
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   126
	print "the file exists, we need to rename it to allow a new file to be created with new data\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   127
	my $date;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   128
	my $time;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   129
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   130
	open (GETTIME,"time /t |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   131
	$time = <GETTIME>;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   132
	chomp($time);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   133
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   134
	open (GETDATE,"date /t |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   135
	$date = <GETDATE>;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   136
	chomp($date);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   137
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   138
	print "date is <$date>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   139
	print "time is <$time>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   140
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   141
	$time =~ s/:/-/g;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   142
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   143
	$date =~ m~([0-9]+)\/([0-9]+)\/([0-9]+)~;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   144
	print "$3-$2-$1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   145
	$date = "$3-$2-$1";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   146
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   147
	print "date is <$date>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   148
	print "time is <$time>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   149
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   150
	my $csv_status_file_path_renamed = $csv_status_file_name;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   151
	print "Current file name: $csv_status_file_path_renamed\n";	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   152
	$csv_status_file_path_renamed =~ s/\.csv/\-$date\@$time.csv/;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   153
	print "Renamed file name: $csv_status_file_path_renamed\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   154
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   155
	# Rename file to be saved and to use new one to work with.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   156
	$system_cmd = "rename $csv_status_file_path $csv_status_file_path_renamed";	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   157
	print "Exec: $system_cmd\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   158
	system($system_cmd);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   159
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   160
else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   161
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   162
	print "The file doesn't exist, we are starting from scratch! Nothing else to do!\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   163
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   164
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   165
# Define Pacakge list & path by searching for "package_definition*.xml" file.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   166
# The directory having that file is considerated as the short package name.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   167
# Store list in a file? DB? or table?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   168
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   169
if (defined($source_csv_path_to_analyse))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   170
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   171
	print "We have been given the path to a source.csv file to extract all the packages to be used\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   172
	if(!(-f $source_csv_path_to_analyse))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   173
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   174
		print "The file $source_csv_path_to_analyse doesn't exist! Please provide a new path!";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   175
		exit(0);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   176
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   177
	open (CSVFILE, "$source_csv_path_to_analyse");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   178
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   179
	my @local_tab = <CSVFILE>;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   180
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   181
	# Need to discard the first line of the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   182
	print "local_tab[0]=<$local_tab[0]>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   183
	$local_tab[0] = undef;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   184
	print "local_tab[0]=<$local_tab[0]> has been removed as garbage for us\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   185
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   186
	my $nb_packgs_in_csv = 0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   187
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   188
	# Extract package names
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   189
	foreach my $line (@local_tab)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   190
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   191
		#Typical line: <E:\hgcache\mercurial_master_prod/sfl/MCL/sf/app/contentcontrol/,/sf/app/contentcontrol,changeset,8cb47bc684d4,layers.sysdef.xml>
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   192
		#print "Line from file is: $line\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   193
		#if($line =~ m;,(/sf/[\w\/_]+),;) # Use for the second column of the csv file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   194
		if($line =~ m;([\w\W]+)\/,\/sf;) # Use for the first column of the csv file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   195
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   196
			#print "We have detected $1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   197
			my $transform = $1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   198
			$transform =~ s/\//\\/ig;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   199
			#print "transformed to: $transform\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   200
			$tab_package_extraction[$nb_packgs_in_csv++] = $transform;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   201
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   202
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   203
	print "# of packages is: <$nb_packgs_in_csv>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   204
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   205
	close (CSVFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   206
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   207
	# Save data in a file to be reused later on.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   208
	my $file2use = "$publication_directory_path\\$all_pckgs_from_source_csv";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   209
	print "File to open=$file2use\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   210
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   211
	open(SAVINGDATAFILE,">$file2use");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   212
	foreach my $val2save (@tab_package_extraction)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   213
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   214
		print SAVINGDATAFILE "$val2save\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   215
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   216
	close(SAVINGDATAFILE);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   217
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   218
elsif (defined($dirs_file_path_to_analyse))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   219
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   220
	print "Use the file <$dirs_file_path_to_analyse> that contains the directories to scan\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   221
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   222
	open(FILEWITHPCKGPATHS,"$dirs_file_path_to_analyse");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   223
	my $count_line = 0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   224
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   225
	while(<FILEWITHPCKGPATHS>)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   226
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   227
		#print "$_";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   228
		$tab_package_extraction[$count_line] = $_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   229
		#print "tab_package_extraction[$count_line]=$tab_package_extraction[$count_line]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   230
		$count_line++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   231
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   232
	my $total_pckg_found = scalar(@tab_package_extraction);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   233
	print "nb of packages found in $dirs_file_path_to_analyse is: <$total_pckg_found>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   234
	close(FILEWITHPCKGPATHS);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   235
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   236
elsif (defined($source_path_to_analyse))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   237
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   238
	print "Use the directory \\sf that contains the code to scan\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   239
	generate_file_with_path_2_pckgs($source_path_to_analyse);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   240
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   241
else
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   242
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   243
	print "No parameters <source_path_to_analyse> or <dirs_file_path_to_analyse> or <source_csv_path_to_analyse> passed, therefore can't work\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   244
	helpme();
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   245
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   246
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   247
# Patterns file used
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   248
if (!defined($pattern_file_path))
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   249
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   250
	print "No specific patterns file has been passed as parameters, therefore we use default patterns file\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   251
	$pattern_file_path = $default_pattern_file_path;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   252
	print "pattern_file_path = <$pattern_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   253
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   254
# End check if default values are necessary
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   255
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   256
print "\n\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   257
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   258
# Call script to extract test data from each packge.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   259
# foreach package in the list, call check_pckg_test_status.pl script with right parameters
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   260
# check_pckg_test_status.pl will automatically fill the DB with the right info	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   261
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   262
# May need to remove trailing \n using chomp($path2passed);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   263
foreach my $path2passed (@tab_package_extraction)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   264
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   265
	#print "Remove trailing \\n for each line\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   266
	chomp($path2passed);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   267
	#print "The path we pass is: <$path2passed>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   268
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   269
	$system_cmd = "check_pckg_test_status.pl --package_path=$path2passed --pattern_file_path=$pattern_file_path --publication_directory_path=$publication_directory_path";	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   270
	print "Exec: $system_cmd\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   271
	system($system_cmd);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   272
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   273
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   274
# Create / update the global DB files.
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   275
# Can be adding all the smaller files generated to a bigger unigue file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   276
# Use XSLT using all the xml files generated?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   277
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   278
# End of the script
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   279
exit(0);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   280
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   281
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   282
# Functions section
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   283
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   284
# If no parameters entered or help selected, display help
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   285
sub helpme
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   286
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   287
	print "\nfct: helpme\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   288
	print "check_all_pckg_test_status.pl\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   289
	print "Usage:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   290
	print "check_all_pckg_test_status.pl --help\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   291
	print "check_all_pckg_test_status.pl --dirs_file_path_to_analyse=I:\\Task-286\\Scripts\\pckg_test_status_paths.txt --publication_directory_path=.\\result\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   292
	print "check_all_pckg_test_status.pl --source_path_to_analyse=I:\\sf --publication_directory_path=.\\result --pattern_file_path=I:\\Task-286\\Scripts\\pckg_test_status_patterns.csv\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   293
	print "check_all_pckg_test_status.pl --source_csv_path_to_analyse=I:\\sf --publication_directory_path=.\\result --pattern_file_path=I:\\Task-286\\Scripts\\pckg_test_status_patterns.csv\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   294
	print "Options:\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   295
	print "--help:\t\t\t\t display this help and exit\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   296
	print "--dirs_file_path_to_analyse:\t path to a file that contains the path to the directories containing package_definition.xml\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   297
	print "--source_path_to_analyse:\t path of the root of the source code \\sf\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   298
	print "--publication_directory_path:\t is the path to the directory where the results will be published (optional)\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   299
	print "--source_csv_path_to_analyse:\t is path to sources.csv file in case packages haven't got a package_definition.xml (optional)\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   300
	print "\t\t\t\t default value is $default_publication_directory_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   301
	print "--pattern_file_path:\t is the path to file that contain the patterns to be search for (optional)\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   302
	print "\t\t\t\t default value is $default_pattern_file_path\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   303
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   304
	exit(0);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   305
}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   306
# End section related to help
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   307
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   308
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   309
# This function is called with the path to the directory \\sf and then we scan for all the directories / packages that contains package_definition*.xml
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   310
# Result should be a file with something like this: "I:\sf\os\kernelhwsrv"
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   311
# Parameter passed is the path to the directory \\sf
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   312
sub generate_file_with_path_2_pckgs
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   313
{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   314
	my ($path_2_dir_sf_2_analyse) = @_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   315
	my @tab_package_definition_list;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   316
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   317
	print "The path to the \\sf directory we want to analyse is: <$path_2_dir_sf_2_analyse>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   318
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   319
	print "The pattern used to find out the root directory for a pacakge is: <$pckg_definition_pattern>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   320
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   321
	# Ananlyse directories for package_definition*.xml
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   322
	# Find a way to parse all the directories and get results as fast as possible
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   323
	# something like <dir I:\sf\package_definition*.xml /s/b>
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   324
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   325
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   326
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   327
	open(FINDPCKDEFPATHS,"dir $path_2_dir_sf_2_analyse\\$pckg_definition_pattern /s/b |");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   328
	my $local_ctr = 0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   329
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   330
	while(<FINDPCKDEFPATHS>)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   331
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   332
		print "$_";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   333
		$tab_package_definition_list[$local_ctr] = $_;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   334
		#print "tab_package_definition_list[$local_ctr]=$tab_package_definition_list[$local_ctr]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   335
		$local_ctr++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   336
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   337
	my $total_pckg_def_files_found = scalar(@tab_package_definition_list);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   338
	print "nb of $pckg_definition_pattern found in $path_2_dir_sf_2_analyse are: <$total_pckg_def_files_found>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   339
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   340
	close(FINDPCKDEFPATHS);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   341
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   342
	print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   343
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   344
	my $local_ctr1=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   345
	my $local_ctr2=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   346
	my $local_ctr3=0;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   347
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   348
	# What to extract
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   349
	#I:\sf\adaptation\qemu\package_definition.xml
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   350
	#I:\sf\adaptation\qemu\package_definition_2.0.1.xml
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   351
	# Anything before the last \\, whcih should not be included!
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   352
	foreach my $val (@tab_package_definition_list)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   353
	{		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   354
		if ($val =~ m#(^[\w\W]+)\\package_definition#i)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   355
		#if ($val =~ m,$pckg_definition_extraction_pattern,i)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   356
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   357
			#print "Value to analyse is: $val\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   358
			#print "Managed to extract: $1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   359
			$tab_package_extraction[$local_ctr1] = $1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   360
			#print "tab_package_extraction[$local_ctr1]=$tab_package_extraction[$local_ctr1]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   361
			$local_ctr1++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   362
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   363
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   364
		#print "\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   365
		
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   366
		# Create tables for S^2 & S^3 package_definition.xml file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   367
		# Store them in a table and save it in 2 different files
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   368
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   369
		#S^2
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   370
		if ($val =~ m#(^[\w\W]+)\\package_definition.xml#i)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   371
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   372
			#print "Value to analyse is: $val\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   373
			#print "Managed to extract: $1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   374
			$tab_package_extraction_S2[$local_ctr2] = $1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   375
			#print "tab_package_extraction_S2[$local_ctr2]=$tab_package_extraction_S2[$local_ctr2]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   376
			$local_ctr2++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   377
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   378
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   379
		#S^3
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   380
		if ($val =~ m#(^[\w\W]+)\\package_definition_#i)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   381
		{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   382
			#print "Value to analyse is: $val\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   383
			#print "Managed to extract: $1\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   384
			$tab_package_extraction_S3[$local_ctr3] = $1;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   385
			#print "tab_package_extraction_S3[$local_ctr3]=$tab_package_extraction_S3[$local_ctr3]\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   386
			$local_ctr3++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   387
		}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   388
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   389
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   390
	# Eliminate duplicates packages paths!
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   391
	my %seen;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   392
	for ( my $i = 0; $i <= $#tab_package_extraction ; )
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   393
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   394
    splice @tab_package_extraction, --$i, 1
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   395
        if $seen{$tab_package_extraction[$i++]}++;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   396
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   397
	#print "Sorted out table:\n @tab_package_extraction\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   398
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   399
	# Save data in a file that will be reused later on
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   400
	# Create a new file everytime. Save old one if exist with date and time?
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   401
	print "Path to the file where data will be saved is called: <$publication_directory_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   402
	print "File name where data will be saved is called: <$pckg_dir_paths_file_name>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   403
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   404
	my $data_2_save_file_path = "$publication_directory_path\\$pckg_dir_paths_file_name";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   405
	my $path2save;
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   406
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   407
	print "The path to the file to write to is: <$data_2_save_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   408
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   409
	# Save generic table in a file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   410
	# Open the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   411
	open(FILE2SAVEDATA, ">$data_2_save_file_path");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   412
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   413
	foreach $path2save (@tab_package_extraction)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   414
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   415
		print FILE2SAVEDATA "$path2save\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   416
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   417
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   418
	# Close the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   419
	close(FILE2SAVEDATA);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   420
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   421
	# Save generic table for S^2 in a file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   422
	$data_2_save_file_path = "$publication_directory_path\\$pckg_dir_paths_file_name_S2";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   423
	print "The path to the file to write to is: <$data_2_save_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   424
	# Open the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   425
	open(FILE2SAVEDATA, ">$data_2_save_file_path");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   426
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   427
	foreach $path2save (@tab_package_extraction_S2)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   428
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   429
		print FILE2SAVEDATA "$path2save\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   430
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   431
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   432
	# Save generic table for S^3 in a file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   433
	$data_2_save_file_path = "$publication_directory_path\\$pckg_dir_paths_file_name_S3";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   434
	print "The path to the file to write to is: <$data_2_save_file_path>\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   435
	# Open the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   436
	open(FILE2SAVEDATA, ">$data_2_save_file_path");
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   437
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   438
	foreach $path2save (@tab_package_extraction_S3)
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   439
	{
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   440
		print FILE2SAVEDATA "$path2save\n";
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   441
	}
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   442
	
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   443
	# Close the file
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   444
	close(FILE2SAVEDATA);
3b9cc38657db Arnaudl: Added scripts and files related to the development of "task 286 - Package test status prep"
Arnaud Lenoir
parents:
diff changeset
   445
}