merged tag ooo/OOO330_m14
[LibreOffice.git] / soldep / bootstrp / build_list_converter.pl
blob3887eca03a12ac444c2b9c811f01fbf640337cd5
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9 # Copyright 2000, 2010 Oracle and/or its affiliates.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # This file is part of OpenOffice.org.
15 # OpenOffice.org is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU Lesser General Public License version 3
17 # only, as published by the Free Software Foundation.
19 # OpenOffice.org is distributed in the hope that it will be useful,
20 # but WITHOUT ANY WARRANTY; without even the implied warranty of
21 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 # GNU Lesser General Public License version 3 for more details
23 # (a copy is included in the LICENSE file that accompanied this code).
25 # You should have received a copy of the GNU Lesser General Public License
26 # version 3 along with OpenOffice.org. If not, see
27 # <http://www.openoffice.org/license.html>
28 # for a copy of the LGPLv3 License.
30 #*************************************************************************
33 #*****************************************************************************************
34 # ASCII parser for the changeover of the current build.lst files to XML files *
35 # programmer: Pascal Junck, Sun Microsystems GmbH *
36 #*****************************************************************************************
38 # this is the first step for the changeover of the current 'build.lst' files to the new
39 # 'build.xlist'(XML) files
40 # before we create the new ones we have to parse all important informations from the old files
41 # important parameters are:
42 # 1. 'module name'
43 # 2. 'module dependency names'
44 # 3. 'dependency type'
45 # 4. 'job dir'
46 # 5. 'depending directories'
47 # 6. 'job platform'(only: 'w', 'u', 'm' and 'all')
48 # 7. 'job'(only: 'nmake' means 'make')
49 # 8. 'build requirements'(here called: 'restrictions')
52 ################################# begin of main #######################################
54 use strict;
55 use lib ("/home/vg119683/work/modules");
57 use XMLBuildListParser;
59 # get and work with each argument(build.lst files) of the commando line
60 # e.g. if the user wants to parse the build.lst file(s):
61 # user input (on unix) for all modules : 'perl -w ascii_parser.pl /so/ws/SRC680/src.m42/*/prj/build.lst'
62 # user input (on windows) for one module : 'perl -w ascii_parser.pl O:/SRC680/src.m42/[module]/prj/build.lst'
63 # get all arguments (build.lst files) of the commando line in this global variable '@buildlist_files'
64 my @buildlist_files = @ARGV;
65 # global variable for each file name that we want to parse in ASCII
66 my $parse_file = "";
67 # set the global variable '$debug' (= 1) to see all results on the terminal,
68 # else (= 0) it shows nothing of the working output!
69 my $debug = 0;
71 # open the filehandle 'ERROR_LOG' for all errors
72 open (ERROR_LOG, ">>ascii_parse.log")
73 or die "Error. Open the file <ascii_parse.log> wasn't successful!\n\n";
75 # reference of the instance of a new object
76 my $XMLTree;
78 foreach (@buildlist_files)
80 # get each element (= module) in '$parse_file'
81 $parse_file = $_;
83 # open the filehandle 'PARSE_ASCII' for each module/file that we want to parse
84 open (PARSE_ASCII, $parse_file)
85 or die "Error. Open the module <$parse_file> wasn't successful!\n\n";
87 # create a new object
88 $XMLTree = XMLBuildListParser->new();
90 # invoking of the main subroutine
91 reading_file();
93 # is the file name 'build.lst' in the path on the command line?
94 # if not, we can not parse and create the new 'build.xlist' file
95 if ($parse_file =~ /build(\w+)?\.lst\S*$/)
97 my $path = $parse_file;
99 $path =~ s/build(\w+)?\.lst\S*$/build\.xlist/;
101 $XMLTree->saveXMLFile($path);
103 else
105 add_errorlog_no_buildlst_file_found_statement($parse_file);
108 # close the current $parse_file
109 close(PARSE_ASCII);
112 # after all files were read close the errorlog file
113 close(ERROR_LOG);
116 ########################### begin of subroutines #####################################
118 # global used variable: $parse_file
120 ########################################################################################
123 ########################################################################################
124 # sub: reading_file
125 # gets: $_ (current file)
126 # returns: -
127 ########################################################################################
128 sub reading_file
130 # variable for the name of the current module
131 my $module_name = "";
133 # hashes for the infos beginning at the second line of the build.lst files
134 my %dir_of_job_platform = ();
135 my %dir_of_alias = ();
137 # control variable for the module dependency line of the file
138 # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
139 # "sa sal : xml2cmp NULL"
140 my $module_dependency_line_exists = 0;
141 my $module_dependency_line_was_read = 0;
143 # this line variables are for checking that all lines will be read
144 # counts each line
145 my $line_number = 0;
146 # for the sum of the informative lines (='module dependency line' and 'nmake' lines of the file)
147 my $info_line_sum = 0;
148 # for the sum of the no-info lines, like:
149 # job lines: 'usr1', 'get', ... and comment lines: '# ...' or empty lines
150 my $no_info_line_sum = 0;
152 # read all lines of the file to resolve the first alias
153 # with the matching dir to know all aliases and directories
154 # at the later second file reading
155 while (<PARSE_ASCII>)
157 # the variable for each line of a file
158 my $line = $_;
160 # count each line for more exact error descriptions in the log file
161 $line_number += 1;
163 # remember it, if this line exists
164 if ( (is_module_dependency_line($line)) && ($module_dependency_line_exists == 0) )
166 $module_dependency_line_exists = 1;
168 # get the name of the current module
169 $module_name = get_module_name($line);
172 # skip all lines, that hasn't the job 'nmake'
173 next if (!(is_nmake_line($line)));
175 # check that the infos (job directory, job platform and alias) exist
176 if (my ($job_dir, $job_platform, $alias) = get_alias_resolving_infos($line))
178 # prove that it's a valid job_platform
179 # and that each first alias and matching job platform exists only once
180 check_alias_and_job_platform($job_dir, $job_platform, $alias, \%dir_of_job_platform,
181 \%dir_of_alias, $module_name, $line_number);
183 else
185 chomp;
186 add_errorlog_unknown_format_statement($line, $module_name, $line_number);
187 next;
190 # reset the $line_number, because we count it again
191 $line_number = 0;
193 # read the same file again
194 seek (PARSE_ASCII,0,0);
196 # read each line of the file for all other informations
197 # e.g. line 8 of module 'sal'
198 # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL"
199 # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform
200 while (<PARSE_ASCII>)
202 # the variable for each line of a file
203 my $line = $_;
205 # count each line to check at the end of the file that all lines were read
206 # and for more exact error descriptions in the log file
207 $line_number += 1;
209 # is it a 'nmake' or a 'module dependency' line?
210 # if not: print this line to STDOUT,
211 # count one to the no-info lines,
212 # try to get the information about the module name from this line
213 # and skip the line
214 if ( (!(is_nmake_line($line))) && (!(is_module_dependency_line($line))) )
216 my $no_info_line = show_no_info_line($line, $line_number);
218 $no_info_line_sum += $no_info_line;
220 # if no module dependency line exists get the name of the current module from another line
221 $module_name = get_module_name($line) if (!($module_name));
223 # skip the no-info line
224 next;
227 # only if the module dependency line exists and it wasn't read get the infos about it
228 if ( ($module_dependency_line_exists) && (!($module_dependency_line_was_read)) )
230 ($module_dependency_line_was_read, $info_line_sum) = get_module_dependency_line_infos
231 ($line, $module_name, $line_number);
234 # get all 'nmake' line infos
235 my $info_line = get_nmake_line_infos($line, \%dir_of_alias, \%dir_of_job_platform,
236 $module_name, $line_number);
238 # count the info lines;
239 $info_line_sum += $info_line;
242 if ($debug == 1)
244 # show the sums of the info and no-info lines
245 lines_sums_output($module_name, $line_number, $info_line_sum, $no_info_line_sum);
249 ########################################################################################
250 # sub: is_module_dependency_line
251 # gets: $line
252 # returns: 1 (true) or 0 (false)
253 ########################################################################################
254 sub is_module_dependency_line
256 my $line = shift;
258 # if the module dpendency line exists return 1, otherwise 0
259 ($line =~ /^\w+\s+\S+\s+:+\s+/)
260 ? return 1
261 : return 0;
264 ########################################################################################
265 # sub: is_nmake_line
266 # gets: $line
267 # returns: '1' (true) or '0' (false)
268 ########################################################################################
269 sub is_nmake_line
271 my $line = shift;
273 # these lines are NO nmake lines:
274 # 1. a empty line
275 # 2. a comment line (perhaps with the job 'nmake')
276 # like line 20 of module 'bridges' (SRC680/src.m42)
277 # "#br bridges\source\cli_uno nmake - w,vc7 br_cli_uno br_unotypes NULL========= "
278 # 3. the module dependency line
279 # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
280 # "sa sal : xml2cmp N ULL"
281 # 4. a 'p' job platform line (for OS2)
282 # 5. a line with a job, which is not 'nmake'
283 ($line =~ (/^[^\s+\#]/) && (!(/\s+:+\s+/)) && (!(/\s+p\s+/)) && (/\bnmake\b/) )
284 ? return 1
285 : return 0;
288 ########################################################################################
289 # sub: get_alias_resolving_infos
290 # gets: $line
291 # returns: $job_dir, $job_platform, $alias
292 ########################################################################################
293 sub get_alias_resolving_infos
295 my $line = shift;
297 if ($line =~ /^\w+\s+(\S+)\s+\w+\s+\-\s+(\w+)\,?(\w+)?\s+(\S+)\s+/)
299 # get the current work directory
300 my $temp_job_dir = $1;
302 my $job_dir = change_job_directory($temp_job_dir);
304 # get the job platform of the current job
305 # if it is a 'n' job platform transform it to 'w'
306 # because 'n' can be used now as 'w' (both means windows)
307 my $job_platform = $2;
308 $job_platform = "w" if($job_platform eq "n");
310 # get the first alias in each line
311 my $alias = $4;
313 return ($job_dir, $job_platform, $alias);
315 return (undef, undef, undef);
318 ########################################################################################
319 # sub: change_job_directory
320 # gets: $job_dir
321 # returns: $changed_job_dir
322 ########################################################################################
323 # we don't need the module name and the first '\' in the current directory
324 sub change_job_directory
326 my $changed_job_dir = shift;
328 # ignore the module name
329 $changed_job_dir =~ s/^\w+//;
330 # change all other '\' against the '/' of the current dir
331 $changed_job_dir =~ s/\\/\//g;
333 # get only a "/" if we are in the root directory
334 $changed_job_dir = "/" if ($changed_job_dir eq "");
336 return $changed_job_dir;
339 ########################################################################################
340 # sub: check_alias_and_job_platform
341 # gets: $job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
342 # $dir_of_alias_ref, $module_name, $line_number
343 # returns: -
344 ########################################################################################
345 # get it in the hash only if it is a valid job platform,
346 # like 'w', 'u', 'm' and 'n'
347 # 'all' is also valid but it doesn't exist in an alias platform(!)
348 sub check_alias_and_job_platform
350 my ($job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
351 $dir_of_alias_ref, $module_name, $line_number) = @_;
353 # is it a valid job_platform?
354 if ($job_platform =~ /(w|u|m|n|all)/)
356 # get only the 'w', 'u', 'm' and 'n' based job platforms
357 if ($job_platform =~ /[wumn]/)
359 # doesn't the key already exist?
360 (!(exists $$dir_of_job_platform_ref{$job_platform.$alias}))
361 # get the first alias with the matching job platform in the hash
362 ? get_alias_and_job_platform($job_platform, $alias, $dir_of_job_platform_ref)
363 # this is a line with a redundant alias and job platform
364 : add_errorlog_alias_redundancy_statement($module_name, $alias, $job_platform, $line_number);
366 if (!(exists $$dir_of_alias_ref{$alias}))
368 # get each first alias with the matching job platform
369 get_alias_and_matching_directory($dir_of_alias_ref, $alias, $job_dir);
372 # it's not a valid job platform
373 else
375 add_errorlog_invalid_platform_statement($module_name, $job_platform, $line_number);
379 ########################################################################################
380 # sub: get_alias_and_job_platform
381 # gets: $job_platform, $alias, $dir_of_job_platform_ref
382 # returns: -
383 ########################################################################################
384 # get the the job platform and the first alias as a unique key
385 # and the job platform as value of the hash
386 # it's for checking later that the alias platform is equal to the job platform
387 # e.g.: line 6 + 7 of the module 'gtk' (SRC680/src.m42)
388 # "gt gtk\pkgconfig nmake - u gt_pkg NULL"
389 # "gt gtk\glib nmake - u gt_glib gt_pkg.u NULL"
390 # the alias 'gt_pkg' has the directory 'gtk\pkgconfig' (we need only 'pkgconfig')
391 # and it has the job platform 'u' - compare it with the alias platform 'gt_pkg.u'
392 sub get_alias_and_job_platform
394 my ($job_platform, $alias, $dir_of_job_platform_ref) = @_;
396 # key = 'job platform' and 'first alias' => value = 'job platform'
397 $$dir_of_job_platform_ref{$job_platform.$alias} = $job_platform;
400 ########################################################################################
401 # sub: get_alias_and_matching_directory
402 # gets: $dir_of_alias_ref, $alias, $job_dir
403 # returns: -
404 ########################################################################################
405 # fill the hash with the first alias and the matching directory
406 # e.g. line 14 of module 'setup2' (SRC680/src.m42)
407 # "se setup2\win\source\unloader nmake - w se_wulo se_unotypes NULL"
408 # key = 'se_wulo' => value = 'win/source/unloader'
409 sub get_alias_and_matching_directory
411 my ($dir_of_alias_ref, $alias, $job_dir) = @_;
413 # key = 'first alias' => value = 'job directory'
414 $$dir_of_alias_ref{$alias} = $job_dir;
417 ########################################################################################
418 # sub: show_no_info_line
419 # gets: $line, $line_number
420 # returns: $no_info_line
421 ########################################################################################
422 sub show_no_info_line
424 my ($line, $line_number) = @_;
425 my $no_info_line += 1;
427 chomp($line);
429 print"Ignore line <$line_number>:\n\"$line\"\n\n" if ($debug);
431 return $no_info_line;
434 ########################################################################################
435 # sub: get_module_name
436 # gets: $line
437 # returns: $module_name
438 ########################################################################################
439 sub get_module_name
441 my $line = shift;
442 my $module_name = "";
444 if ($line =~ /^\w+\s+([\w\.\-]+)\\?/)
446 $module_name = $1;
449 # set the 'module name' in the data structure tree
450 $XMLTree->setModuleName($module_name);
452 return $module_name;
455 ########################################################################################
456 # sub: get_module_dependency_line_infos
457 # gets: $line, $module_name, $line_number
458 # returns: $module_dependency_line_was_read, $info_line_sum
459 ########################################################################################
460 # get the informations about the module dependency line
461 # like line 1 of module 'sal' (SRC680/src.m42)
462 # "sa sal : xml2cmp NULL"
463 # $module_name $module_dependency @module_dependency_names
464 sub get_module_dependency_line_infos
466 my ($line, $module_name, $line_number) = @_;
467 my $module_dependency = "";
468 my @module_dependency_names = ();
469 my %dep_modules_and_products = ();
470 my $product = "";
472 my $module_dependency_line_was_read = 1;
473 my $info_line_sum = 1;
475 if ($debug)
477 print"\nline number : <$line_number>\n";
478 print"module-name : <$module_name>\n";
481 # get the dependencies
482 if ($line =~ /\s+(:+)\s+/)
484 $module_dependency = $1;
485 print"module-dependency : <$module_dependency>\n" if ($debug);
487 # transform the dependency type to the corresponding tag name
488 if ($module_dependency eq ":")
490 $module_dependency = "md-simple";
492 elsif ($module_dependency eq "::")
494 $module_dependency = "md-always";
496 elsif ($module_dependency eq ":::")
498 $module_dependency = "md-force";
502 # get a list of all depending module names
503 if ($line =~ /:+\s+([\S\s]+)\s+NULL/)
505 @module_dependency_names = split(/\s+/, $1);
507 foreach my $module (@module_dependency_names)
509 # check whether that there is another product (as "all") of a module
510 if ($module =~ /(\S+):+(\S+)/)
512 $dep_modules_and_products{$2} = $1;
514 else
516 $dep_modules_and_products{$module} = "all";
521 # add the dependency module names, the module dependency type and the product to the data structure
522 foreach my $module (sort keys %dep_modules_and_products)
524 print"module-dependency-name(s) : key <$module> value <".$dep_modules_and_products{$module}.">\n" if ($debug);
526 $XMLTree->addModuleDependencies($module, $module_dependency, $dep_modules_and_products{$module});
529 return ($module_dependency_line_was_read, $info_line_sum);
532 ########################################################################################
533 # sub: get_nmake_line_infos
534 # gets: $line, \%dir_of_alias, \%dir_of_job_platform, $module_name, $line_number
535 # returns: $info_line
536 ########################################################################################
537 # get all infos about the 'nmake' lines
538 # e.g. line 8 of module 'sal'
539 # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL"
540 # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform
541 sub get_nmake_line_infos
543 my ($line, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
544 my $directories_ref = "";
545 my $info_line = 0;
547 # get the infos about the 'nmake' lines
548 if ($line =~ /^\w+\s+(\S+)\s+(\w+)\s+\-\s+(\w+)\,?(\S+)?/)
550 # get the current working directory
551 my $temp_job_dir = $1;
552 my $job_dir = change_job_directory($temp_job_dir);
554 # get the job
555 my $job = $2;
556 $job = "make" if ($job eq "nmake");
558 # get the job platform of the current job
559 # if it is a 'n' job platform transform it to 'wnt'
560 # available values are: 'wnt', 'unx', 'mac' or 'all'
561 my $job_platform = $3;
562 $job_platform = change_job_platform_name($job_platform);
564 # get the first alias in each line
565 my $restriction = $4;
566 my %build_req = ( "$restriction" => "$job_platform") if ($restriction && $job_platform);
569 # get all aliases (but not the first) in an array
570 my $aliases_ref = get_aliases($line);
572 # filter the list of aliases, which has a 'p' job platform
573 # and transform a 'n' ending alias platform to a 'w' ending alias platform
574 filter_aliases($aliases_ref);
576 # resolve all aliases (alias[.job platform] => matching directory)
577 $directories_ref = resolve_aliases($aliases_ref, $dir_of_alias_ref,
578 $dir_of_job_platform_ref, $module_name, $line_number);
580 # count the informative lines
581 $info_line = 1;
583 $XMLTree->addJob($job_dir, $job, $job_platform, $directories_ref, \%build_req);
585 # show the infos, that we know about each line
586 if ($debug == 1)
588 show_line_infos($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref);
591 return $info_line;
594 ########################################################################################
595 # sub: change_job_platform_name
596 # gets: $job_platform
597 # returns: $job_platform
598 ########################################################################################
599 sub change_job_platform_name
601 my $job_platform = shift;
603 $job_platform = "wnt" if($job_platform eq "n" || $job_platform eq "w");
604 $job_platform = "unx" if($job_platform eq "u");
605 $job_platform = "mac" if($job_platform eq "m");
607 return $job_platform;
610 ########################################################################################
611 # sub: get_aliases
612 # gets: $_ (current line)
613 # returns: \@aliases
614 ########################################################################################
615 # get all aliases of the line in an array
616 sub get_aliases
618 my $line = shift;
619 my @aliases = ();
621 # get all aliases in an array (but cut out the first alias)
622 if ($line =~ /\-\s+[\w+\,]+\s+([\S\s]+)\s+NULL$/)
624 print"\nall job aliases : <$1>\n" if ($debug);
626 @aliases = split /\s+/, $1;
628 # we don't need the first alias (it stands for the current job directory)
629 shift @aliases;
631 return \@aliases;
634 ########################################################################################
635 # sub: filter_aliases
636 # gets: $aliases_ref
637 # returns: -
638 ########################################################################################
639 # filter all aliases, because we only need the 'w', 'u' and 'm' job platform based aliases
640 sub filter_aliases
642 my $aliases_ref = shift;
644 # get the highest index of the array (number of elements of the array - 1)
645 # also works: my $index = scalar(@$aliases_ref)-1;
646 my $index = $#{@{$aliases_ref}};
648 for (; $index >= 0; $index--)
650 # filter the 'p' job platform based aliases from '@aliases'
651 splice(@$aliases_ref, $index, 1) if ($$aliases_ref[$index] =~ /\.p$/);
653 # transform a '.n' ending alias platform to '.w' ending alias platform
654 if ($$aliases_ref[$index] =~ /\.n$/)
656 $$aliases_ref[$index] =~ s/\.n$/\.w/;
657 splice(@$aliases_ref, $index, 1, $$aliases_ref[$index]);
662 ########################################################################################
663 # sub: resolve_aliases
664 # gets: $aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref,
665 # $module_name, $line_number
666 # returns: \@directories
667 ########################################################################################
668 # here we get each alias with the matching job directory
669 sub resolve_aliases
671 my ($aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
673 my @directories = ();
674 my ($alias_platform, $alias, $temp_alias) = "";
676 # resolving all directory aliases
677 foreach $temp_alias (@$aliases_ref)
679 ($alias, $alias_platform) = compare_job_platform_with_alias_platform
680 ($temp_alias, $dir_of_job_platform_ref, $module_name, $line_number);
682 # does the alias exist?
683 if (exists $$dir_of_alias_ref{$alias})
685 # then get the matching directory in the array
686 push (@directories, $$dir_of_alias_ref{$alias});
688 else
690 add_errorlog_no_directory_of_alias_statement($module_name, $alias, $line_number);
693 return \@directories;
696 ########################################################################################
697 # sub: compare_job_platform_with_alias_platform
698 # gets: $alias, $dir_of_job_platform_ref, $module_name, $line_number
699 # returns: $alias
700 ########################################################################################
701 sub compare_job_platform_with_alias_platform
703 my ($alias, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
705 my $alias_platform = "";
707 # compare the alias platform (with a dot and an ending letter, like "al_alib.u")
708 # with the job platform of the line in which this alias was resolved
709 if ($alias =~ /\.([wum])$/)
711 $alias_platform = $1;
713 # don't memorize the ending dot and letter
714 $alias =~ s/\.\w$//;
716 # if the value(= job platform) of the hash or the alias platform has no value
717 # set it to "no valid value"
718 if (!(exists $$dir_of_job_platform_ref{$alias_platform.$alias}))
720 $$dir_of_job_platform_ref{$alias_platform.$alias} = "no valid value";
722 $alias_platform = "no valid value" if (!($alias_platform));
724 # are the job platform and the alias platform equal?
725 if ($$dir_of_job_platform_ref{$alias_platform.$alias} ne $alias_platform)
727 add_errorlog_not_equal_platforms_statement
728 ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number);
731 return ($alias, $alias_platform);
734 ########################################################################################
735 # sub: show_line_infos
736 # gets: $line_number, $job_dir, $job, $job_platform, $restriction,
737 # $aliases_ref, $directories_ref
738 # returns: -
739 ########################################################################################
740 # print the infos about each line
741 sub show_line_infos
743 my ($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref) = @_;
745 print"line number : <$line_number>\n";
746 print"job directory : <$job_dir>\n";
747 print"job : <$job>\n";
748 print"job platform : <$job_platform>\n" if ($job_platform =~ /(w|u|m|all)/);
749 print"restriction : <$restriction>\n" if ($restriction);
750 print"alias dependencies : <@$aliases_ref>\n";
751 print"directory dependencies : <@$directories_ref>\n\n";
754 ########################################################################################
755 # sub: lines_sums_output
756 # gets: $module_name, $line_number, $info_line_sum, $no_info_line_sum
757 # returns: -
758 ########################################################################################
759 sub lines_sums_output
761 # this line variables are for checking that all lines will be read:
762 my ($module_name, $line_number, $info_line_sum, $no_info_line_sum) = @_;
763 my $lines_sum = 0;
765 add_errorlog_no_module_name_statement() if (!($module_name));
767 # were all lines read? and is the checksum okay?
768 $lines_sum = $info_line_sum + $no_info_line_sum;
769 if ($lines_sum == $line_number)
771 print"All $line_number line(s) of module <$module_name> were read and checked!\n\n";
773 else
775 add_errorlog_different_lines_sums_statement($module_name);
778 print"module: <$module_name>\n".
779 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
780 " info line(s) sum = $info_line_sum\n".
781 "no-info line(s) sum = $no_info_line_sum\n".
782 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
783 " total line(s) sum = $line_number\n\n\n";
787 ############################ ERROR_LOG subroutines #####################################
790 ########################################################################################
791 # sub: add_errorlog_invalid_job_platform_statement
792 # gets: $module_name, $platform, $line_number
793 # returns: -
794 ########################################################################################
795 sub add_errorlog_invalid_job_platform_statement
797 my ($module_name, $job_platform, $line_number) = @_;
799 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
800 "The job platform <$job_platform> is not valid.\n\n";
803 ########################################################################################
804 # sub: add_errorlog_not_equal_platforms_statement
805 # gets: $module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number
806 # returns: -
807 ########################################################################################
808 sub add_errorlog_not_equal_platforms_statement
810 my ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number) = @_;
812 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
813 "The alias platform <$alias.$alias_platform> is not equal ".
814 "with the job platform <$$dir_of_job_platform_ref{$alias_platform.$alias}>.\n\n";
817 ########################################################################################
818 # sub: add_errorlog_no_directory_of_alias_statement
819 # gets: $module_name, $alias, $line_number
820 # returns: -
821 ########################################################################################
822 sub add_errorlog_no_directory_of_alias_statement
824 my ($module_name, $alias, $line_number) = @_;
826 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
827 "The directory of the alias <$alias> doesn't exist!\n\n";
830 ########################################################################################
831 # sub: add_errorlog_no_module_name_statement
832 # gets: -
833 # returns: -
834 ########################################################################################
835 sub add_errorlog_no_module_name_statement
837 print ERROR_LOG "Error. No module name found in dir/file <$parse_file>.\n\n";
840 ########################################################################################
841 # sub: add_errorlog_alias_redundancy_statement
842 # gets: $module_name, $alias, $job_platform, $line_number
843 # returns: -
844 ########################################################################################
845 sub add_errorlog_alias_redundancy_statement
847 my ($module_name, $alias, $job_platform, $line_number)= @_;
849 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
850 "The alias <$alias> with the job platform <$job_platform> is redundant.\n\n";
853 ########################################################################################
854 # sub: add_errorlog_unknown_format_statement
855 # gets: $module_name, $line_number
856 # returns: -
857 ########################################################################################
858 sub add_errorlog_unknown_format_statement
860 my ($line, $module_name, $line_number) = @_;
862 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.".
863 "\nUnknown format:\n\"$line\"\n\n";
866 ########################################################################################
867 # sub: add_errorlog_different_lines_sums_statement
868 # gets: $module_name
869 # returns: -
870 ########################################################################################
871 sub add_errorlog_different_lines_sums_statement
873 my $module_name = shift;
875 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file>.\n".
876 "The sums of all info and no-info lines are not correct!\n\n";
879 ########################################################################################
880 # sub: add_errorlog_no_buildlst_file_found_statement
881 # gets: $parse_file
882 # returns: -
883 ########################################################################################
884 sub add_errorlog_no_buildlst_file_found_statement
886 my $parse_file = shift;
888 print ERROR_LOG "Error in command line argument <$parse_file>.\n".
889 "File 'build.lst' not found!\n";
892 ############################# end of the subroutines ###################################