1*cdf0e10cSrcweir: 2*cdf0e10cSrcweireval 'exec perl -wS $0 ${1+"$@"}' 3*cdf0e10cSrcweir if 0; 4*cdf0e10cSrcweir 5*cdf0e10cSrcweir#************************************************************************* 6*cdf0e10cSrcweir# 7*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8*cdf0e10cSrcweir# 9*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates. 10*cdf0e10cSrcweir# 11*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite 12*cdf0e10cSrcweir# 13*cdf0e10cSrcweir# This file is part of OpenOffice.org. 14*cdf0e10cSrcweir# 15*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify 16*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3 17*cdf0e10cSrcweir# only, as published by the Free Software Foundation. 18*cdf0e10cSrcweir# 19*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful, 20*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of 21*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 22*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details 23*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code). 24*cdf0e10cSrcweir# 25*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License 26*cdf0e10cSrcweir# version 3 along with OpenOffice.org. If not, see 27*cdf0e10cSrcweir# <http://www.openoffice.org/license.html> 28*cdf0e10cSrcweir# for a copy of the LGPLv3 License. 29*cdf0e10cSrcweir# 30*cdf0e10cSrcweir#************************************************************************* 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir 33*cdf0e10cSrcweir#***************************************************************************************** 34*cdf0e10cSrcweir# ASCII parser for the changeover of the current build.lst files to XML files * 35*cdf0e10cSrcweir# programmer: Pascal Junck, Sun Microsystems GmbH * 36*cdf0e10cSrcweir#***************************************************************************************** 37*cdf0e10cSrcweir 38*cdf0e10cSrcweir# this is the first step for the changeover of the current 'build.lst' files to the new 39*cdf0e10cSrcweir# 'build.xlist'(XML) files 40*cdf0e10cSrcweir# before we create the new ones we have to parse all important informations from the old files 41*cdf0e10cSrcweir# important parameters are: 42*cdf0e10cSrcweir# 1. 'module name' 43*cdf0e10cSrcweir# 2. 'module dependency names' 44*cdf0e10cSrcweir# 3. 'dependency type' 45*cdf0e10cSrcweir# 4. 'job dir' 46*cdf0e10cSrcweir# 5. 'depending directories' 47*cdf0e10cSrcweir# 6. 'job platform'(only: 'w', 'u', 'm' and 'all') 48*cdf0e10cSrcweir# 7. 'job'(only: 'nmake' means 'make') 49*cdf0e10cSrcweir# 8. 'build requirements'(here called: 'restrictions') 50*cdf0e10cSrcweir 51*cdf0e10cSrcweir 52*cdf0e10cSrcweir################################# begin of main ####################################### 53*cdf0e10cSrcweir 54*cdf0e10cSrcweiruse strict; 55*cdf0e10cSrcweiruse lib ("/home/vg119683/work/modules"); 56*cdf0e10cSrcweir 57*cdf0e10cSrcweiruse XMLBuildListParser; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir# get and work with each argument(build.lst files) of the commando line 60*cdf0e10cSrcweir# e.g. if the user wants to parse the build.lst file(s): 61*cdf0e10cSrcweir# user input (on unix) for all modules : 'perl -w ascii_parser.pl /so/ws/SRC680/src.m42/*/prj/build.lst' 62*cdf0e10cSrcweir# user input (on windows) for one module : 'perl -w ascii_parser.pl O:/SRC680/src.m42/[module]/prj/build.lst' 63*cdf0e10cSrcweir# get all arguments (build.lst files) of the commando line in this global variable '@buildlist_files' 64*cdf0e10cSrcweirmy @buildlist_files = @ARGV; 65*cdf0e10cSrcweir# global variable for each file name that we want to parse in ASCII 66*cdf0e10cSrcweirmy $parse_file = ""; 67*cdf0e10cSrcweir# set the global variable '$debug' (= 1) to see all results on the terminal, 68*cdf0e10cSrcweir# else (= 0) it shows nothing of the working output! 69*cdf0e10cSrcweirmy $debug = 0; 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir# open the filehandle 'ERROR_LOG' for all errors 72*cdf0e10cSrcweiropen (ERROR_LOG, ">>ascii_parse.log") 73*cdf0e10cSrcweir or die "Error. Open the file <ascii_parse.log> wasn't successful!\n\n"; 74*cdf0e10cSrcweir 75*cdf0e10cSrcweir# reference of the instance of a new object 76*cdf0e10cSrcweirmy $XMLTree; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweirforeach (@buildlist_files) 79*cdf0e10cSrcweir{ 80*cdf0e10cSrcweir # get each element (= module) in '$parse_file' 81*cdf0e10cSrcweir $parse_file = $_; 82*cdf0e10cSrcweir 83*cdf0e10cSrcweir # open the filehandle 'PARSE_ASCII' for each module/file that we want to parse 84*cdf0e10cSrcweir open (PARSE_ASCII, $parse_file) 85*cdf0e10cSrcweir or die "Error. Open the module <$parse_file> wasn't successful!\n\n"; 86*cdf0e10cSrcweir 87*cdf0e10cSrcweir # create a new object 88*cdf0e10cSrcweir $XMLTree = XMLBuildListParser->new(); 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir # invoking of the main subroutine 91*cdf0e10cSrcweir reading_file(); 92*cdf0e10cSrcweir 93*cdf0e10cSrcweir # is the file name 'build.lst' in the path on the command line? 94*cdf0e10cSrcweir # if not, we can not parse and create the new 'build.xlist' file 95*cdf0e10cSrcweir if ($parse_file =~ /build(\w+)?\.lst\S*$/) 96*cdf0e10cSrcweir { 97*cdf0e10cSrcweir my $path = $parse_file; 98*cdf0e10cSrcweir 99*cdf0e10cSrcweir $path =~ s/build(\w+)?\.lst\S*$/build\.xlist/; 100*cdf0e10cSrcweir 101*cdf0e10cSrcweir $XMLTree->saveXMLFile($path); 102*cdf0e10cSrcweir } 103*cdf0e10cSrcweir else 104*cdf0e10cSrcweir { 105*cdf0e10cSrcweir add_errorlog_no_buildlst_file_found_statement($parse_file); 106*cdf0e10cSrcweir } 107*cdf0e10cSrcweir 108*cdf0e10cSrcweir # close the current $parse_file 109*cdf0e10cSrcweir close(PARSE_ASCII); 110*cdf0e10cSrcweir 111*cdf0e10cSrcweir} 112*cdf0e10cSrcweir# after all files were read close the errorlog file 113*cdf0e10cSrcweirclose(ERROR_LOG); 114*cdf0e10cSrcweir 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir########################### begin of subroutines ##################################### 117*cdf0e10cSrcweir# 118*cdf0e10cSrcweir# global used variable: $parse_file 119*cdf0e10cSrcweir# 120*cdf0e10cSrcweir######################################################################################## 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir######################################################################################## 124*cdf0e10cSrcweir# sub: reading_file 125*cdf0e10cSrcweir# gets: $_ (current file) 126*cdf0e10cSrcweir# returns: - 127*cdf0e10cSrcweir######################################################################################## 128*cdf0e10cSrcweirsub reading_file 129*cdf0e10cSrcweir{ 130*cdf0e10cSrcweir # variable for the name of the current module 131*cdf0e10cSrcweir my $module_name = ""; 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir # hashes for the infos beginning at the second line of the build.lst files 134*cdf0e10cSrcweir my %dir_of_job_platform = (); 135*cdf0e10cSrcweir my %dir_of_alias = (); 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir # control variable for the module dependency line of the file 138*cdf0e10cSrcweir # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42) 139*cdf0e10cSrcweir # "sa sal : xml2cmp NULL" 140*cdf0e10cSrcweir my $module_dependency_line_exists = 0; 141*cdf0e10cSrcweir my $module_dependency_line_was_read = 0; 142*cdf0e10cSrcweir 143*cdf0e10cSrcweir # this line variables are for checking that all lines will be read 144*cdf0e10cSrcweir # counts each line 145*cdf0e10cSrcweir my $line_number = 0; 146*cdf0e10cSrcweir # for the sum of the informative lines (='module dependency line' and 'nmake' lines of the file) 147*cdf0e10cSrcweir my $info_line_sum = 0; 148*cdf0e10cSrcweir # for the sum of the no-info lines, like: 149*cdf0e10cSrcweir # job lines: 'usr1', 'get', ... and comment lines: '# ...' or empty lines 150*cdf0e10cSrcweir my $no_info_line_sum = 0; 151*cdf0e10cSrcweir 152*cdf0e10cSrcweir # read all lines of the file to resolve the first alias 153*cdf0e10cSrcweir # with the matching dir to know all aliases and directories 154*cdf0e10cSrcweir # at the later second file reading 155*cdf0e10cSrcweir while (<PARSE_ASCII>) 156*cdf0e10cSrcweir { 157*cdf0e10cSrcweir # the variable for each line of a file 158*cdf0e10cSrcweir my $line = $_; 159*cdf0e10cSrcweir 160*cdf0e10cSrcweir # count each line for more exact error descriptions in the log file 161*cdf0e10cSrcweir $line_number += 1; 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir # remember it, if this line exists 164*cdf0e10cSrcweir if ( (is_module_dependency_line($line)) && ($module_dependency_line_exists == 0) ) 165*cdf0e10cSrcweir { 166*cdf0e10cSrcweir $module_dependency_line_exists = 1; 167*cdf0e10cSrcweir 168*cdf0e10cSrcweir # get the name of the current module 169*cdf0e10cSrcweir $module_name = get_module_name($line); 170*cdf0e10cSrcweir } 171*cdf0e10cSrcweir 172*cdf0e10cSrcweir # skip all lines, that hasn't the job 'nmake' 173*cdf0e10cSrcweir next if (!(is_nmake_line($line))); 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir # check that the infos (job directory, job platform and alias) exist 176*cdf0e10cSrcweir if (my ($job_dir, $job_platform, $alias) = get_alias_resolving_infos($line)) 177*cdf0e10cSrcweir { 178*cdf0e10cSrcweir # prove that it's a valid job_platform 179*cdf0e10cSrcweir # and that each first alias and matching job platform exists only once 180*cdf0e10cSrcweir check_alias_and_job_platform($job_dir, $job_platform, $alias, \%dir_of_job_platform, 181*cdf0e10cSrcweir \%dir_of_alias, $module_name, $line_number); 182*cdf0e10cSrcweir } 183*cdf0e10cSrcweir else 184*cdf0e10cSrcweir { 185*cdf0e10cSrcweir chomp; 186*cdf0e10cSrcweir add_errorlog_unknown_format_statement($line, $module_name, $line_number); 187*cdf0e10cSrcweir next; 188*cdf0e10cSrcweir } 189*cdf0e10cSrcweir } 190*cdf0e10cSrcweir # reset the $line_number, because we count it again 191*cdf0e10cSrcweir $line_number = 0; 192*cdf0e10cSrcweir 193*cdf0e10cSrcweir # read the same file again 194*cdf0e10cSrcweir seek (PARSE_ASCII,0,0); 195*cdf0e10cSrcweir 196*cdf0e10cSrcweir # read each line of the file for all other informations 197*cdf0e10cSrcweir # e.g. line 8 of module 'sal' 198*cdf0e10cSrcweir # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL" 199*cdf0e10cSrcweir # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform 200*cdf0e10cSrcweir while (<PARSE_ASCII>) 201*cdf0e10cSrcweir { 202*cdf0e10cSrcweir # the variable for each line of a file 203*cdf0e10cSrcweir my $line = $_; 204*cdf0e10cSrcweir 205*cdf0e10cSrcweir # count each line to check at the end of the file that all lines were read 206*cdf0e10cSrcweir # and for more exact error descriptions in the log file 207*cdf0e10cSrcweir $line_number += 1; 208*cdf0e10cSrcweir 209*cdf0e10cSrcweir # is it a 'nmake' or a 'module dependency' line? 210*cdf0e10cSrcweir # if not: print this line to STDOUT, 211*cdf0e10cSrcweir # count one to the no-info lines, 212*cdf0e10cSrcweir # try to get the information about the module name from this line 213*cdf0e10cSrcweir # and skip the line 214*cdf0e10cSrcweir if ( (!(is_nmake_line($line))) && (!(is_module_dependency_line($line))) ) 215*cdf0e10cSrcweir { 216*cdf0e10cSrcweir my $no_info_line = show_no_info_line($line, $line_number); 217*cdf0e10cSrcweir 218*cdf0e10cSrcweir $no_info_line_sum += $no_info_line; 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir # if no module dependency line exists get the name of the current module from another line 221*cdf0e10cSrcweir $module_name = get_module_name($line) if (!($module_name)); 222*cdf0e10cSrcweir 223*cdf0e10cSrcweir # skip the no-info line 224*cdf0e10cSrcweir next; 225*cdf0e10cSrcweir } 226*cdf0e10cSrcweir 227*cdf0e10cSrcweir # only if the module dependency line exists and it wasn't read get the infos about it 228*cdf0e10cSrcweir if ( ($module_dependency_line_exists) && (!($module_dependency_line_was_read)) ) 229*cdf0e10cSrcweir { 230*cdf0e10cSrcweir ($module_dependency_line_was_read, $info_line_sum) = get_module_dependency_line_infos 231*cdf0e10cSrcweir ($line, $module_name, $line_number); 232*cdf0e10cSrcweir } 233*cdf0e10cSrcweir 234*cdf0e10cSrcweir # get all 'nmake' line infos 235*cdf0e10cSrcweir my $info_line = get_nmake_line_infos($line, \%dir_of_alias, \%dir_of_job_platform, 236*cdf0e10cSrcweir $module_name, $line_number); 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir # count the info lines; 239*cdf0e10cSrcweir $info_line_sum += $info_line; 240*cdf0e10cSrcweir } 241*cdf0e10cSrcweir 242*cdf0e10cSrcweir if ($debug == 1) 243*cdf0e10cSrcweir { 244*cdf0e10cSrcweir # show the sums of the info and no-info lines 245*cdf0e10cSrcweir lines_sums_output($module_name, $line_number, $info_line_sum, $no_info_line_sum); 246*cdf0e10cSrcweir } 247*cdf0e10cSrcweir} 248*cdf0e10cSrcweir 249*cdf0e10cSrcweir######################################################################################## 250*cdf0e10cSrcweir# sub: is_module_dependency_line 251*cdf0e10cSrcweir# gets: $line 252*cdf0e10cSrcweir# returns: 1 (true) or 0 (false) 253*cdf0e10cSrcweir######################################################################################## 254*cdf0e10cSrcweirsub is_module_dependency_line 255*cdf0e10cSrcweir{ 256*cdf0e10cSrcweir my $line = shift; 257*cdf0e10cSrcweir 258*cdf0e10cSrcweir # if the module dpendency line exists return 1, otherwise 0 259*cdf0e10cSrcweir ($line =~ /^\w+\s+\S+\s+:+\s+/) 260*cdf0e10cSrcweir ? return 1 261*cdf0e10cSrcweir : return 0; 262*cdf0e10cSrcweir} 263*cdf0e10cSrcweir 264*cdf0e10cSrcweir######################################################################################## 265*cdf0e10cSrcweir# sub: is_nmake_line 266*cdf0e10cSrcweir# gets: $line 267*cdf0e10cSrcweir# returns: '1' (true) or '0' (false) 268*cdf0e10cSrcweir######################################################################################## 269*cdf0e10cSrcweirsub is_nmake_line 270*cdf0e10cSrcweir{ 271*cdf0e10cSrcweir my $line = shift; 272*cdf0e10cSrcweir 273*cdf0e10cSrcweir # these lines are NO nmake lines: 274*cdf0e10cSrcweir # 1. a empty line 275*cdf0e10cSrcweir # 2. a comment line (perhaps with the job 'nmake') 276*cdf0e10cSrcweir # like line 20 of module 'bridges' (SRC680/src.m42) 277*cdf0e10cSrcweir # "#br bridges\source\cli_uno nmake - w,vc7 br_cli_uno br_unotypes NULL========= " 278*cdf0e10cSrcweir # 3. the module dependency line 279*cdf0e10cSrcweir # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42) 280*cdf0e10cSrcweir # "sa sal : xml2cmp N ULL" 281*cdf0e10cSrcweir # 4. a 'p' job platform line (for OS2) 282*cdf0e10cSrcweir # 5. a line with a job, which is not 'nmake' 283*cdf0e10cSrcweir ($line =~ (/^[^\s+\#]/) && (!(/\s+:+\s+/)) && (!(/\s+p\s+/)) && (/\bnmake\b/) ) 284*cdf0e10cSrcweir ? return 1 285*cdf0e10cSrcweir : return 0; 286*cdf0e10cSrcweir} 287*cdf0e10cSrcweir 288*cdf0e10cSrcweir######################################################################################## 289*cdf0e10cSrcweir# sub: get_alias_resolving_infos 290*cdf0e10cSrcweir# gets: $line 291*cdf0e10cSrcweir# returns: $job_dir, $job_platform, $alias 292*cdf0e10cSrcweir######################################################################################## 293*cdf0e10cSrcweirsub get_alias_resolving_infos 294*cdf0e10cSrcweir{ 295*cdf0e10cSrcweir my $line = shift; 296*cdf0e10cSrcweir 297*cdf0e10cSrcweir if ($line =~ /^\w+\s+(\S+)\s+\w+\s+\-\s+(\w+)\,?(\w+)?\s+(\S+)\s+/) 298*cdf0e10cSrcweir { 299*cdf0e10cSrcweir # get the current work directory 300*cdf0e10cSrcweir my $temp_job_dir = $1; 301*cdf0e10cSrcweir 302*cdf0e10cSrcweir my $job_dir = change_job_directory($temp_job_dir); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir # get the job platform of the current job 305*cdf0e10cSrcweir # if it is a 'n' job platform transform it to 'w' 306*cdf0e10cSrcweir # because 'n' can be used now as 'w' (both means windows) 307*cdf0e10cSrcweir my $job_platform = $2; 308*cdf0e10cSrcweir $job_platform = "w" if($job_platform eq "n"); 309*cdf0e10cSrcweir 310*cdf0e10cSrcweir # get the first alias in each line 311*cdf0e10cSrcweir my $alias = $4; 312*cdf0e10cSrcweir 313*cdf0e10cSrcweir return ($job_dir, $job_platform, $alias); 314*cdf0e10cSrcweir } 315*cdf0e10cSrcweir return (undef, undef, undef); 316*cdf0e10cSrcweir} 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir######################################################################################## 319*cdf0e10cSrcweir# sub: change_job_directory 320*cdf0e10cSrcweir# gets: $job_dir 321*cdf0e10cSrcweir# returns: $changed_job_dir 322*cdf0e10cSrcweir######################################################################################## 323*cdf0e10cSrcweir# we don't need the module name and the first '\' in the current directory 324*cdf0e10cSrcweirsub change_job_directory 325*cdf0e10cSrcweir{ 326*cdf0e10cSrcweir my $changed_job_dir = shift; 327*cdf0e10cSrcweir 328*cdf0e10cSrcweir # ignore the module name 329*cdf0e10cSrcweir $changed_job_dir =~ s/^\w+//; 330*cdf0e10cSrcweir # change all other '\' against the '/' of the current dir 331*cdf0e10cSrcweir $changed_job_dir =~ s/\\/\//g; 332*cdf0e10cSrcweir 333*cdf0e10cSrcweir # get only a "/" if we are in the root directory 334*cdf0e10cSrcweir $changed_job_dir = "/" if ($changed_job_dir eq ""); 335*cdf0e10cSrcweir 336*cdf0e10cSrcweir return $changed_job_dir; 337*cdf0e10cSrcweir} 338*cdf0e10cSrcweir 339*cdf0e10cSrcweir######################################################################################## 340*cdf0e10cSrcweir# sub: check_alias_and_job_platform 341*cdf0e10cSrcweir# gets: $job_dir, $job_platform, $alias, $dir_of_job_platform_ref, 342*cdf0e10cSrcweir# $dir_of_alias_ref, $module_name, $line_number 343*cdf0e10cSrcweir# returns: - 344*cdf0e10cSrcweir######################################################################################## 345*cdf0e10cSrcweir# get it in the hash only if it is a valid job platform, 346*cdf0e10cSrcweir# like 'w', 'u', 'm' and 'n' 347*cdf0e10cSrcweir# 'all' is also valid but it doesn't exist in an alias platform(!) 348*cdf0e10cSrcweirsub check_alias_and_job_platform 349*cdf0e10cSrcweir{ 350*cdf0e10cSrcweir my ($job_dir, $job_platform, $alias, $dir_of_job_platform_ref, 351*cdf0e10cSrcweir $dir_of_alias_ref, $module_name, $line_number) = @_; 352*cdf0e10cSrcweir 353*cdf0e10cSrcweir # is it a valid job_platform? 354*cdf0e10cSrcweir if ($job_platform =~ /(w|u|m|n|all)/) 355*cdf0e10cSrcweir { 356*cdf0e10cSrcweir # get only the 'w', 'u', 'm' and 'n' based job platforms 357*cdf0e10cSrcweir if ($job_platform =~ /[wumn]/) 358*cdf0e10cSrcweir { 359*cdf0e10cSrcweir # doesn't the key already exist? 360*cdf0e10cSrcweir (!(exists $$dir_of_job_platform_ref{$job_platform.$alias})) 361*cdf0e10cSrcweir # get the first alias with the matching job platform in the hash 362*cdf0e10cSrcweir ? get_alias_and_job_platform($job_platform, $alias, $dir_of_job_platform_ref) 363*cdf0e10cSrcweir # this is a line with a redundant alias and job platform 364*cdf0e10cSrcweir : add_errorlog_alias_redundancy_statement($module_name, $alias, $job_platform, $line_number); 365*cdf0e10cSrcweir } 366*cdf0e10cSrcweir if (!(exists $$dir_of_alias_ref{$alias})) 367*cdf0e10cSrcweir { 368*cdf0e10cSrcweir # get each first alias with the matching job platform 369*cdf0e10cSrcweir get_alias_and_matching_directory($dir_of_alias_ref, $alias, $job_dir); 370*cdf0e10cSrcweir } 371*cdf0e10cSrcweir } 372*cdf0e10cSrcweir # it's not a valid job platform 373*cdf0e10cSrcweir else 374*cdf0e10cSrcweir { 375*cdf0e10cSrcweir add_errorlog_invalid_platform_statement($module_name, $job_platform, $line_number); 376*cdf0e10cSrcweir } 377*cdf0e10cSrcweir} 378*cdf0e10cSrcweir 379*cdf0e10cSrcweir######################################################################################## 380*cdf0e10cSrcweir# sub: get_alias_and_job_platform 381*cdf0e10cSrcweir# gets: $job_platform, $alias, $dir_of_job_platform_ref 382*cdf0e10cSrcweir# returns: - 383*cdf0e10cSrcweir######################################################################################## 384*cdf0e10cSrcweir# get the the job platform and the first alias as a unique key 385*cdf0e10cSrcweir# and the job platform as value of the hash 386*cdf0e10cSrcweir# it's for checking later that the alias platform is equal to the job platform 387*cdf0e10cSrcweir# e.g.: line 6 + 7 of the module 'gtk' (SRC680/src.m42) 388*cdf0e10cSrcweir# "gt gtk\pkgconfig nmake - u gt_pkg NULL" 389*cdf0e10cSrcweir# "gt gtk\glib nmake - u gt_glib gt_pkg.u NULL" 390*cdf0e10cSrcweir# the alias 'gt_pkg' has the directory 'gtk\pkgconfig' (we need only 'pkgconfig') 391*cdf0e10cSrcweir# and it has the job platform 'u' - compare it with the alias platform 'gt_pkg.u' 392*cdf0e10cSrcweirsub get_alias_and_job_platform 393*cdf0e10cSrcweir{ 394*cdf0e10cSrcweir my ($job_platform, $alias, $dir_of_job_platform_ref) = @_; 395*cdf0e10cSrcweir 396*cdf0e10cSrcweir # key = 'job platform' and 'first alias' => value = 'job platform' 397*cdf0e10cSrcweir $$dir_of_job_platform_ref{$job_platform.$alias} = $job_platform; 398*cdf0e10cSrcweir} 399*cdf0e10cSrcweir 400*cdf0e10cSrcweir######################################################################################## 401*cdf0e10cSrcweir# sub: get_alias_and_matching_directory 402*cdf0e10cSrcweir# gets: $dir_of_alias_ref, $alias, $job_dir 403*cdf0e10cSrcweir# returns: - 404*cdf0e10cSrcweir######################################################################################## 405*cdf0e10cSrcweir# fill the hash with the first alias and the matching directory 406*cdf0e10cSrcweir# e.g. line 14 of module 'setup2' (SRC680/src.m42) 407*cdf0e10cSrcweir# "se setup2\win\source\unloader nmake - w se_wulo se_unotypes NULL" 408*cdf0e10cSrcweir# key = 'se_wulo' => value = 'win/source/unloader' 409*cdf0e10cSrcweirsub get_alias_and_matching_directory 410*cdf0e10cSrcweir{ 411*cdf0e10cSrcweir my ($dir_of_alias_ref, $alias, $job_dir) = @_; 412*cdf0e10cSrcweir 413*cdf0e10cSrcweir # key = 'first alias' => value = 'job directory' 414*cdf0e10cSrcweir $$dir_of_alias_ref{$alias} = $job_dir; 415*cdf0e10cSrcweir} 416*cdf0e10cSrcweir 417*cdf0e10cSrcweir######################################################################################## 418*cdf0e10cSrcweir# sub: show_no_info_line 419*cdf0e10cSrcweir# gets: $line, $line_number 420*cdf0e10cSrcweir# returns: $no_info_line 421*cdf0e10cSrcweir######################################################################################## 422*cdf0e10cSrcweirsub show_no_info_line 423*cdf0e10cSrcweir{ 424*cdf0e10cSrcweir my ($line, $line_number) = @_; 425*cdf0e10cSrcweir my $no_info_line += 1; 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir chomp($line); 428*cdf0e10cSrcweir 429*cdf0e10cSrcweir print"Ignore line <$line_number>:\n\"$line\"\n\n" if ($debug); 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir return $no_info_line; 432*cdf0e10cSrcweir} 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir######################################################################################## 435*cdf0e10cSrcweir# sub: get_module_name 436*cdf0e10cSrcweir# gets: $line 437*cdf0e10cSrcweir# returns: $module_name 438*cdf0e10cSrcweir######################################################################################## 439*cdf0e10cSrcweirsub get_module_name 440*cdf0e10cSrcweir{ 441*cdf0e10cSrcweir my $line = shift; 442*cdf0e10cSrcweir my $module_name = ""; 443*cdf0e10cSrcweir 444*cdf0e10cSrcweir if ($line =~ /^\w+\s+([\w\.\-]+)\\?/) 445*cdf0e10cSrcweir { 446*cdf0e10cSrcweir $module_name = $1; 447*cdf0e10cSrcweir } 448*cdf0e10cSrcweir 449*cdf0e10cSrcweir # set the 'module name' in the data structure tree 450*cdf0e10cSrcweir $XMLTree->setModuleName($module_name); 451*cdf0e10cSrcweir 452*cdf0e10cSrcweir return $module_name; 453*cdf0e10cSrcweir} 454*cdf0e10cSrcweir 455*cdf0e10cSrcweir######################################################################################## 456*cdf0e10cSrcweir# sub: get_module_dependency_line_infos 457*cdf0e10cSrcweir# gets: $line, $module_name, $line_number 458*cdf0e10cSrcweir# returns: $module_dependency_line_was_read, $info_line_sum 459*cdf0e10cSrcweir######################################################################################## 460*cdf0e10cSrcweir# get the informations about the module dependency line 461*cdf0e10cSrcweir# like line 1 of module 'sal' (SRC680/src.m42) 462*cdf0e10cSrcweir# "sa sal : xml2cmp NULL" 463*cdf0e10cSrcweir# $module_name $module_dependency @module_dependency_names 464*cdf0e10cSrcweirsub get_module_dependency_line_infos 465*cdf0e10cSrcweir{ 466*cdf0e10cSrcweir my ($line, $module_name, $line_number) = @_; 467*cdf0e10cSrcweir my $module_dependency = ""; 468*cdf0e10cSrcweir my @module_dependency_names = (); 469*cdf0e10cSrcweir my %dep_modules_and_products = (); 470*cdf0e10cSrcweir my $product = ""; 471*cdf0e10cSrcweir 472*cdf0e10cSrcweir my $module_dependency_line_was_read = 1; 473*cdf0e10cSrcweir my $info_line_sum = 1; 474*cdf0e10cSrcweir 475*cdf0e10cSrcweir if ($debug) 476*cdf0e10cSrcweir { 477*cdf0e10cSrcweir print"\nline number : <$line_number>\n"; 478*cdf0e10cSrcweir print"module-name : <$module_name>\n"; 479*cdf0e10cSrcweir } 480*cdf0e10cSrcweir 481*cdf0e10cSrcweir # get the dependencies 482*cdf0e10cSrcweir if ($line =~ /\s+(:+)\s+/) 483*cdf0e10cSrcweir { 484*cdf0e10cSrcweir $module_dependency = $1; 485*cdf0e10cSrcweir print"module-dependency : <$module_dependency>\n" if ($debug); 486*cdf0e10cSrcweir 487*cdf0e10cSrcweir # transform the dependency type to the corresponding tag name 488*cdf0e10cSrcweir if ($module_dependency eq ":") 489*cdf0e10cSrcweir { 490*cdf0e10cSrcweir $module_dependency = "md-simple"; 491*cdf0e10cSrcweir } 492*cdf0e10cSrcweir elsif ($module_dependency eq "::") 493*cdf0e10cSrcweir { 494*cdf0e10cSrcweir $module_dependency = "md-always"; 495*cdf0e10cSrcweir } 496*cdf0e10cSrcweir elsif ($module_dependency eq ":::") 497*cdf0e10cSrcweir { 498*cdf0e10cSrcweir $module_dependency = "md-force"; 499*cdf0e10cSrcweir } 500*cdf0e10cSrcweir } 501*cdf0e10cSrcweir 502*cdf0e10cSrcweir # get a list of all depending module names 503*cdf0e10cSrcweir if ($line =~ /:+\s+([\S\s]+)\s+NULL/) 504*cdf0e10cSrcweir { 505*cdf0e10cSrcweir @module_dependency_names = split(/\s+/, $1); 506*cdf0e10cSrcweir 507*cdf0e10cSrcweir foreach my $module (@module_dependency_names) 508*cdf0e10cSrcweir { 509*cdf0e10cSrcweir # check whether that there is another product (as "all") of a module 510*cdf0e10cSrcweir if ($module =~ /(\S+):+(\S+)/) 511*cdf0e10cSrcweir { 512*cdf0e10cSrcweir $dep_modules_and_products{$2} = $1; 513*cdf0e10cSrcweir } 514*cdf0e10cSrcweir else 515*cdf0e10cSrcweir { 516*cdf0e10cSrcweir $dep_modules_and_products{$module} = "all"; 517*cdf0e10cSrcweir } 518*cdf0e10cSrcweir } 519*cdf0e10cSrcweir } 520*cdf0e10cSrcweir 521*cdf0e10cSrcweir # add the dependency module names, the module dependency type and the product to the data structure 522*cdf0e10cSrcweir foreach my $module (sort keys %dep_modules_and_products) 523*cdf0e10cSrcweir { 524*cdf0e10cSrcweir print"module-dependency-name(s) : key <$module> value <".$dep_modules_and_products{$module}.">\n" if ($debug); 525*cdf0e10cSrcweir 526*cdf0e10cSrcweir $XMLTree->addModuleDependencies($module, $module_dependency, $dep_modules_and_products{$module}); 527*cdf0e10cSrcweir } 528*cdf0e10cSrcweir 529*cdf0e10cSrcweir return ($module_dependency_line_was_read, $info_line_sum); 530*cdf0e10cSrcweir} 531*cdf0e10cSrcweir 532*cdf0e10cSrcweir######################################################################################## 533*cdf0e10cSrcweir# sub: get_nmake_line_infos 534*cdf0e10cSrcweir# gets: $line, \%dir_of_alias, \%dir_of_job_platform, $module_name, $line_number 535*cdf0e10cSrcweir# returns: $info_line 536*cdf0e10cSrcweir######################################################################################## 537*cdf0e10cSrcweir# get all infos about the 'nmake' lines 538*cdf0e10cSrcweir# e.g. line 8 of module 'sal' 539*cdf0e10cSrcweir# "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL" 540*cdf0e10cSrcweir# $job_dir $job $job_platform 1.$alias 2.$alias + alias platform 541*cdf0e10cSrcweirsub get_nmake_line_infos 542*cdf0e10cSrcweir{ 543*cdf0e10cSrcweir my ($line, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_; 544*cdf0e10cSrcweir my $directories_ref = ""; 545*cdf0e10cSrcweir my $info_line = 0; 546*cdf0e10cSrcweir 547*cdf0e10cSrcweir # get the infos about the 'nmake' lines 548*cdf0e10cSrcweir if ($line =~ /^\w+\s+(\S+)\s+(\w+)\s+\-\s+(\w+)\,?(\S+)?/) 549*cdf0e10cSrcweir { 550*cdf0e10cSrcweir # get the current working directory 551*cdf0e10cSrcweir my $temp_job_dir = $1; 552*cdf0e10cSrcweir my $job_dir = change_job_directory($temp_job_dir); 553*cdf0e10cSrcweir 554*cdf0e10cSrcweir # get the job 555*cdf0e10cSrcweir my $job = $2; 556*cdf0e10cSrcweir $job = "make" if ($job eq "nmake"); 557*cdf0e10cSrcweir 558*cdf0e10cSrcweir # get the job platform of the current job 559*cdf0e10cSrcweir # if it is a 'n' job platform transform it to 'wnt' 560*cdf0e10cSrcweir # available values are: 'wnt', 'unx', 'mac' or 'all' 561*cdf0e10cSrcweir my $job_platform = $3; 562*cdf0e10cSrcweir $job_platform = change_job_platform_name($job_platform); 563*cdf0e10cSrcweir 564*cdf0e10cSrcweir # get the first alias in each line 565*cdf0e10cSrcweir my $restriction = $4; 566*cdf0e10cSrcweir my %build_req = ( "$restriction" => "$job_platform") if ($restriction && $job_platform); 567*cdf0e10cSrcweir 568*cdf0e10cSrcweir 569*cdf0e10cSrcweir # get all aliases (but not the first) in an array 570*cdf0e10cSrcweir my $aliases_ref = get_aliases($line); 571*cdf0e10cSrcweir 572*cdf0e10cSrcweir # filter the list of aliases, which has a 'p' job platform 573*cdf0e10cSrcweir # and transform a 'n' ending alias platform to a 'w' ending alias platform 574*cdf0e10cSrcweir filter_aliases($aliases_ref); 575*cdf0e10cSrcweir 576*cdf0e10cSrcweir # resolve all aliases (alias[.job platform] => matching directory) 577*cdf0e10cSrcweir $directories_ref = resolve_aliases($aliases_ref, $dir_of_alias_ref, 578*cdf0e10cSrcweir $dir_of_job_platform_ref, $module_name, $line_number); 579*cdf0e10cSrcweir 580*cdf0e10cSrcweir # count the informative lines 581*cdf0e10cSrcweir $info_line = 1; 582*cdf0e10cSrcweir 583*cdf0e10cSrcweir $XMLTree->addJob($job_dir, $job, $job_platform, $directories_ref, \%build_req); 584*cdf0e10cSrcweir 585*cdf0e10cSrcweir # show the infos, that we know about each line 586*cdf0e10cSrcweir if ($debug == 1) 587*cdf0e10cSrcweir { 588*cdf0e10cSrcweir show_line_infos($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref); 589*cdf0e10cSrcweir } 590*cdf0e10cSrcweir } 591*cdf0e10cSrcweir return $info_line; 592*cdf0e10cSrcweir} 593*cdf0e10cSrcweir 594*cdf0e10cSrcweir######################################################################################## 595*cdf0e10cSrcweir# sub: change_job_platform_name 596*cdf0e10cSrcweir# gets: $job_platform 597*cdf0e10cSrcweir# returns: $job_platform 598*cdf0e10cSrcweir######################################################################################## 599*cdf0e10cSrcweirsub change_job_platform_name 600*cdf0e10cSrcweir{ 601*cdf0e10cSrcweir my $job_platform = shift; 602*cdf0e10cSrcweir 603*cdf0e10cSrcweir $job_platform = "wnt" if($job_platform eq "n" || $job_platform eq "w"); 604*cdf0e10cSrcweir $job_platform = "unx" if($job_platform eq "u"); 605*cdf0e10cSrcweir $job_platform = "mac" if($job_platform eq "m"); 606*cdf0e10cSrcweir 607*cdf0e10cSrcweir return $job_platform; 608*cdf0e10cSrcweir} 609*cdf0e10cSrcweir 610*cdf0e10cSrcweir######################################################################################## 611*cdf0e10cSrcweir# sub: get_aliases 612*cdf0e10cSrcweir# gets: $_ (current line) 613*cdf0e10cSrcweir# returns: \@aliases 614*cdf0e10cSrcweir######################################################################################## 615*cdf0e10cSrcweir# get all aliases of the line in an array 616*cdf0e10cSrcweirsub get_aliases 617*cdf0e10cSrcweir{ 618*cdf0e10cSrcweir my $line = shift; 619*cdf0e10cSrcweir my @aliases = (); 620*cdf0e10cSrcweir 621*cdf0e10cSrcweir # get all aliases in an array (but cut out the first alias) 622*cdf0e10cSrcweir if ($line =~ /\-\s+[\w+\,]+\s+([\S\s]+)\s+NULL$/) 623*cdf0e10cSrcweir { 624*cdf0e10cSrcweir print"\nall job aliases : <$1>\n" if ($debug); 625*cdf0e10cSrcweir 626*cdf0e10cSrcweir @aliases = split /\s+/, $1; 627*cdf0e10cSrcweir 628*cdf0e10cSrcweir # we don't need the first alias (it stands for the current job directory) 629*cdf0e10cSrcweir shift @aliases; 630*cdf0e10cSrcweir } 631*cdf0e10cSrcweir return \@aliases; 632*cdf0e10cSrcweir} 633*cdf0e10cSrcweir 634*cdf0e10cSrcweir######################################################################################## 635*cdf0e10cSrcweir# sub: filter_aliases 636*cdf0e10cSrcweir# gets: $aliases_ref 637*cdf0e10cSrcweir# returns: - 638*cdf0e10cSrcweir######################################################################################## 639*cdf0e10cSrcweir# filter all aliases, because we only need the 'w', 'u' and 'm' job platform based aliases 640*cdf0e10cSrcweirsub filter_aliases 641*cdf0e10cSrcweir{ 642*cdf0e10cSrcweir my $aliases_ref = shift; 643*cdf0e10cSrcweir 644*cdf0e10cSrcweir # get the highest index of the array (number of elements of the array - 1) 645*cdf0e10cSrcweir # also works: my $index = scalar(@$aliases_ref)-1; 646*cdf0e10cSrcweir my $index = $#{@{$aliases_ref}}; 647*cdf0e10cSrcweir 648*cdf0e10cSrcweir for (; $index >= 0; $index--) 649*cdf0e10cSrcweir { 650*cdf0e10cSrcweir # filter the 'p' job platform based aliases from '@aliases' 651*cdf0e10cSrcweir splice(@$aliases_ref, $index, 1) if ($$aliases_ref[$index] =~ /\.p$/); 652*cdf0e10cSrcweir 653*cdf0e10cSrcweir # transform a '.n' ending alias platform to '.w' ending alias platform 654*cdf0e10cSrcweir if ($$aliases_ref[$index] =~ /\.n$/) 655*cdf0e10cSrcweir { 656*cdf0e10cSrcweir $$aliases_ref[$index] =~ s/\.n$/\.w/; 657*cdf0e10cSrcweir splice(@$aliases_ref, $index, 1, $$aliases_ref[$index]); 658*cdf0e10cSrcweir } 659*cdf0e10cSrcweir } 660*cdf0e10cSrcweir} 661*cdf0e10cSrcweir 662*cdf0e10cSrcweir######################################################################################## 663*cdf0e10cSrcweir# sub: resolve_aliases 664*cdf0e10cSrcweir# gets: $aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, 665*cdf0e10cSrcweir# $module_name, $line_number 666*cdf0e10cSrcweir# returns: \@directories 667*cdf0e10cSrcweir######################################################################################## 668*cdf0e10cSrcweir# here we get each alias with the matching job directory 669*cdf0e10cSrcweirsub resolve_aliases 670*cdf0e10cSrcweir{ 671*cdf0e10cSrcweir my ($aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_; 672*cdf0e10cSrcweir 673*cdf0e10cSrcweir my @directories = (); 674*cdf0e10cSrcweir my ($alias_platform, $alias, $temp_alias) = ""; 675*cdf0e10cSrcweir 676*cdf0e10cSrcweir # resolving all directory aliases 677*cdf0e10cSrcweir foreach $temp_alias (@$aliases_ref) 678*cdf0e10cSrcweir { 679*cdf0e10cSrcweir ($alias, $alias_platform) = compare_job_platform_with_alias_platform 680*cdf0e10cSrcweir ($temp_alias, $dir_of_job_platform_ref, $module_name, $line_number); 681*cdf0e10cSrcweir 682*cdf0e10cSrcweir # does the alias exist? 683*cdf0e10cSrcweir if (exists $$dir_of_alias_ref{$alias}) 684*cdf0e10cSrcweir { 685*cdf0e10cSrcweir # then get the matching directory in the array 686*cdf0e10cSrcweir push (@directories, $$dir_of_alias_ref{$alias}); 687*cdf0e10cSrcweir } 688*cdf0e10cSrcweir else 689*cdf0e10cSrcweir { 690*cdf0e10cSrcweir add_errorlog_no_directory_of_alias_statement($module_name, $alias, $line_number); 691*cdf0e10cSrcweir } 692*cdf0e10cSrcweir } 693*cdf0e10cSrcweir return \@directories; 694*cdf0e10cSrcweir} 695*cdf0e10cSrcweir 696*cdf0e10cSrcweir######################################################################################## 697*cdf0e10cSrcweir# sub: compare_job_platform_with_alias_platform 698*cdf0e10cSrcweir# gets: $alias, $dir_of_job_platform_ref, $module_name, $line_number 699*cdf0e10cSrcweir# returns: $alias 700*cdf0e10cSrcweir######################################################################################## 701*cdf0e10cSrcweirsub compare_job_platform_with_alias_platform 702*cdf0e10cSrcweir{ 703*cdf0e10cSrcweir my ($alias, $dir_of_job_platform_ref, $module_name, $line_number) = @_; 704*cdf0e10cSrcweir 705*cdf0e10cSrcweir my $alias_platform = ""; 706*cdf0e10cSrcweir 707*cdf0e10cSrcweir # compare the alias platform (with a dot and an ending letter, like "al_alib.u") 708*cdf0e10cSrcweir # with the job platform of the line in which this alias was resolved 709*cdf0e10cSrcweir if ($alias =~ /\.([wum])$/) 710*cdf0e10cSrcweir { 711*cdf0e10cSrcweir $alias_platform = $1; 712*cdf0e10cSrcweir 713*cdf0e10cSrcweir # don't memorize the ending dot and letter 714*cdf0e10cSrcweir $alias =~ s/\.\w$//; 715*cdf0e10cSrcweir 716*cdf0e10cSrcweir # if the value(= job platform) of the hash or the alias platform has no value 717*cdf0e10cSrcweir # set it to "no valid value" 718*cdf0e10cSrcweir if (!(exists $$dir_of_job_platform_ref{$alias_platform.$alias})) 719*cdf0e10cSrcweir { 720*cdf0e10cSrcweir $$dir_of_job_platform_ref{$alias_platform.$alias} = "no valid value"; 721*cdf0e10cSrcweir } 722*cdf0e10cSrcweir $alias_platform = "no valid value" if (!($alias_platform)); 723*cdf0e10cSrcweir 724*cdf0e10cSrcweir # are the job platform and the alias platform equal? 725*cdf0e10cSrcweir if ($$dir_of_job_platform_ref{$alias_platform.$alias} ne $alias_platform) 726*cdf0e10cSrcweir { 727*cdf0e10cSrcweir add_errorlog_not_equal_platforms_statement 728*cdf0e10cSrcweir ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number); 729*cdf0e10cSrcweir } 730*cdf0e10cSrcweir } 731*cdf0e10cSrcweir return ($alias, $alias_platform); 732*cdf0e10cSrcweir} 733*cdf0e10cSrcweir 734*cdf0e10cSrcweir######################################################################################## 735*cdf0e10cSrcweir# sub: show_line_infos 736*cdf0e10cSrcweir# gets: $line_number, $job_dir, $job, $job_platform, $restriction, 737*cdf0e10cSrcweir# $aliases_ref, $directories_ref 738*cdf0e10cSrcweir# returns: - 739*cdf0e10cSrcweir######################################################################################## 740*cdf0e10cSrcweir# print the infos about each line 741*cdf0e10cSrcweirsub show_line_infos 742*cdf0e10cSrcweir{ 743*cdf0e10cSrcweir my ($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref) = @_; 744*cdf0e10cSrcweir 745*cdf0e10cSrcweir print"line number : <$line_number>\n"; 746*cdf0e10cSrcweir print"job directory : <$job_dir>\n"; 747*cdf0e10cSrcweir print"job : <$job>\n"; 748*cdf0e10cSrcweir print"job platform : <$job_platform>\n" if ($job_platform =~ /(w|u|m|all)/); 749*cdf0e10cSrcweir print"restriction : <$restriction>\n" if ($restriction); 750*cdf0e10cSrcweir print"alias dependencies : <@$aliases_ref>\n"; 751*cdf0e10cSrcweir print"directory dependencies : <@$directories_ref>\n\n"; 752*cdf0e10cSrcweir} 753*cdf0e10cSrcweir 754*cdf0e10cSrcweir######################################################################################## 755*cdf0e10cSrcweir# sub: lines_sums_output 756*cdf0e10cSrcweir# gets: $module_name, $line_number, $info_line_sum, $no_info_line_sum 757*cdf0e10cSrcweir# returns: - 758*cdf0e10cSrcweir######################################################################################## 759*cdf0e10cSrcweirsub lines_sums_output 760*cdf0e10cSrcweir{ 761*cdf0e10cSrcweir # this line variables are for checking that all lines will be read: 762*cdf0e10cSrcweir my ($module_name, $line_number, $info_line_sum, $no_info_line_sum) = @_; 763*cdf0e10cSrcweir my $lines_sum = 0; 764*cdf0e10cSrcweir 765*cdf0e10cSrcweir add_errorlog_no_module_name_statement() if (!($module_name)); 766*cdf0e10cSrcweir 767*cdf0e10cSrcweir # were all lines read? and is the checksum okay? 768*cdf0e10cSrcweir $lines_sum = $info_line_sum + $no_info_line_sum; 769*cdf0e10cSrcweir if ($lines_sum == $line_number) 770*cdf0e10cSrcweir { 771*cdf0e10cSrcweir print"All $line_number line(s) of module <$module_name> were read and checked!\n\n"; 772*cdf0e10cSrcweir } 773*cdf0e10cSrcweir else 774*cdf0e10cSrcweir { 775*cdf0e10cSrcweir add_errorlog_different_lines_sums_statement($module_name); 776*cdf0e10cSrcweir } 777*cdf0e10cSrcweir 778*cdf0e10cSrcweir print"module: <$module_name>\n". 779*cdf0e10cSrcweir "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n". 780*cdf0e10cSrcweir " info line(s) sum = $info_line_sum\n". 781*cdf0e10cSrcweir "no-info line(s) sum = $no_info_line_sum\n". 782*cdf0e10cSrcweir "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n". 783*cdf0e10cSrcweir " total line(s) sum = $line_number\n\n\n"; 784*cdf0e10cSrcweir} 785*cdf0e10cSrcweir 786*cdf0e10cSrcweir 787*cdf0e10cSrcweir############################ ERROR_LOG subroutines ##################################### 788*cdf0e10cSrcweir 789*cdf0e10cSrcweir 790*cdf0e10cSrcweir######################################################################################## 791*cdf0e10cSrcweir# sub: add_errorlog_invalid_job_platform_statement 792*cdf0e10cSrcweir# gets: $module_name, $platform, $line_number 793*cdf0e10cSrcweir# returns: - 794*cdf0e10cSrcweir######################################################################################## 795*cdf0e10cSrcweirsub add_errorlog_invalid_job_platform_statement 796*cdf0e10cSrcweir{ 797*cdf0e10cSrcweir my ($module_name, $job_platform, $line_number) = @_; 798*cdf0e10cSrcweir 799*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". 800*cdf0e10cSrcweir "The job platform <$job_platform> is not valid.\n\n"; 801*cdf0e10cSrcweir} 802*cdf0e10cSrcweir 803*cdf0e10cSrcweir######################################################################################## 804*cdf0e10cSrcweir# sub: add_errorlog_not_equal_platforms_statement 805*cdf0e10cSrcweir# gets: $module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number 806*cdf0e10cSrcweir# returns: - 807*cdf0e10cSrcweir######################################################################################## 808*cdf0e10cSrcweirsub add_errorlog_not_equal_platforms_statement 809*cdf0e10cSrcweir{ 810*cdf0e10cSrcweir my ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number) = @_; 811*cdf0e10cSrcweir 812*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". 813*cdf0e10cSrcweir "The alias platform <$alias.$alias_platform> is not equal ". 814*cdf0e10cSrcweir "with the job platform <$$dir_of_job_platform_ref{$alias_platform.$alias}>.\n\n"; 815*cdf0e10cSrcweir} 816*cdf0e10cSrcweir 817*cdf0e10cSrcweir######################################################################################## 818*cdf0e10cSrcweir# sub: add_errorlog_no_directory_of_alias_statement 819*cdf0e10cSrcweir# gets: $module_name, $alias, $line_number 820*cdf0e10cSrcweir# returns: - 821*cdf0e10cSrcweir######################################################################################## 822*cdf0e10cSrcweirsub add_errorlog_no_directory_of_alias_statement 823*cdf0e10cSrcweir{ 824*cdf0e10cSrcweir my ($module_name, $alias, $line_number) = @_; 825*cdf0e10cSrcweir 826*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". 827*cdf0e10cSrcweir "The directory of the alias <$alias> doesn't exist!\n\n"; 828*cdf0e10cSrcweir} 829*cdf0e10cSrcweir 830*cdf0e10cSrcweir######################################################################################## 831*cdf0e10cSrcweir# sub: add_errorlog_no_module_name_statement 832*cdf0e10cSrcweir# gets: - 833*cdf0e10cSrcweir# returns: - 834*cdf0e10cSrcweir######################################################################################## 835*cdf0e10cSrcweirsub add_errorlog_no_module_name_statement 836*cdf0e10cSrcweir{ 837*cdf0e10cSrcweir print ERROR_LOG "Error. No module name found in dir/file <$parse_file>.\n\n"; 838*cdf0e10cSrcweir} 839*cdf0e10cSrcweir 840*cdf0e10cSrcweir######################################################################################## 841*cdf0e10cSrcweir# sub: add_errorlog_alias_redundancy_statement 842*cdf0e10cSrcweir# gets: $module_name, $alias, $job_platform, $line_number 843*cdf0e10cSrcweir# returns: - 844*cdf0e10cSrcweir######################################################################################## 845*cdf0e10cSrcweirsub add_errorlog_alias_redundancy_statement 846*cdf0e10cSrcweir{ 847*cdf0e10cSrcweir my ($module_name, $alias, $job_platform, $line_number)= @_; 848*cdf0e10cSrcweir 849*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n". 850*cdf0e10cSrcweir "The alias <$alias> with the job platform <$job_platform> is redundant.\n\n"; 851*cdf0e10cSrcweir} 852*cdf0e10cSrcweir 853*cdf0e10cSrcweir######################################################################################## 854*cdf0e10cSrcweir# sub: add_errorlog_unknown_format_statement 855*cdf0e10cSrcweir# gets: $module_name, $line_number 856*cdf0e10cSrcweir# returns: - 857*cdf0e10cSrcweir######################################################################################## 858*cdf0e10cSrcweirsub add_errorlog_unknown_format_statement 859*cdf0e10cSrcweir{ 860*cdf0e10cSrcweir my ($line, $module_name, $line_number) = @_; 861*cdf0e10cSrcweir 862*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.". 863*cdf0e10cSrcweir "\nUnknown format:\n\"$line\"\n\n"; 864*cdf0e10cSrcweir} 865*cdf0e10cSrcweir 866*cdf0e10cSrcweir######################################################################################## 867*cdf0e10cSrcweir# sub: add_errorlog_different_lines_sums_statement 868*cdf0e10cSrcweir# gets: $module_name 869*cdf0e10cSrcweir# returns: - 870*cdf0e10cSrcweir######################################################################################## 871*cdf0e10cSrcweirsub add_errorlog_different_lines_sums_statement 872*cdf0e10cSrcweir{ 873*cdf0e10cSrcweir my $module_name = shift; 874*cdf0e10cSrcweir 875*cdf0e10cSrcweir print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file>.\n". 876*cdf0e10cSrcweir "The sums of all info and no-info lines are not correct!\n\n"; 877*cdf0e10cSrcweir} 878*cdf0e10cSrcweir 879*cdf0e10cSrcweir######################################################################################## 880*cdf0e10cSrcweir# sub: add_errorlog_no_buildlst_file_found_statement 881*cdf0e10cSrcweir# gets: $parse_file 882*cdf0e10cSrcweir# returns: - 883*cdf0e10cSrcweir######################################################################################## 884*cdf0e10cSrcweirsub add_errorlog_no_buildlst_file_found_statement 885*cdf0e10cSrcweir{ 886*cdf0e10cSrcweir my $parse_file = shift; 887*cdf0e10cSrcweir 888*cdf0e10cSrcweir print ERROR_LOG "Error in command line argument <$parse_file>.\n". 889*cdf0e10cSrcweir "File 'build.lst' not found!\n"; 890*cdf0e10cSrcweir} 891*cdf0e10cSrcweir 892*cdf0e10cSrcweir############################# end of the subroutines ################################### 893