merge the formfield patch from ooo-build
[ooovba.git] / soldep / bootstrp / build_list_converter.pl
blobef17a8a7c13da167dd9e64be0cfa4abd9c83e811
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 #*************************************************************************
7 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 #
9 # Copyright 2008 by Sun Microsystems, Inc.
11 # OpenOffice.org - a multi-platform office productivity suite
13 # $RCSfile: build_list_converter.pl,v $
15 # $Revision: 1.3 $
17 # This file is part of OpenOffice.org.
19 # OpenOffice.org is free software: you can redistribute it and/or modify
20 # it under the terms of the GNU Lesser General Public License version 3
21 # only, as published by the Free Software Foundation.
23 # OpenOffice.org is distributed in the hope that it will be useful,
24 # but WITHOUT ANY WARRANTY; without even the implied warranty of
25 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 # GNU Lesser General Public License version 3 for more details
27 # (a copy is included in the LICENSE file that accompanied this code).
29 # You should have received a copy of the GNU Lesser General Public License
30 # version 3 along with OpenOffice.org. If not, see
31 # <http://www.openoffice.org/license.html>
32 # for a copy of the LGPLv3 License.
34 #*************************************************************************
37 #*****************************************************************************************
38 # ASCII parser for the changeover of the current build.lst files to XML files *
39 # programmer: Pascal Junck, Sun Microsystems GmbH *
40 #*****************************************************************************************
42 # this is the first step for the changeover of the current 'build.lst' files to the new
43 # 'build.xlist'(XML) files
44 # before we create the new ones we have to parse all important informations from the old files
45 # important parameters are:
46 # 1. 'module name'
47 # 2. 'module dependency names'
48 # 3. 'dependency type'
49 # 4. 'job dir'
50 # 5. 'depending directories'
51 # 6. 'job platform'(only: 'w', 'u', 'm' and 'all')
52 # 7. 'job'(only: 'nmake' means 'make')
53 # 8. 'build requirements'(here called: 'restrictions')
56 ################################# begin of main #######################################
58 use strict;
59 use lib ("/home/vg119683/work/modules");
61 use XMLBuildListParser;
63 # get and work with each argument(build.lst files) of the commando line
64 # e.g. if the user wants to parse the build.lst file(s):
65 # user input (on unix) for all modules : 'perl -w ascii_parser.pl /so/ws/SRC680/src.m42/*/prj/build.lst'
66 # user input (on windows) for one module : 'perl -w ascii_parser.pl O:/SRC680/src.m42/[module]/prj/build.lst'
67 # get all arguments (build.lst files) of the commando line in this global variable '@buildlist_files'
68 my @buildlist_files = @ARGV;
69 # global variable for each file name that we want to parse in ASCII
70 my $parse_file = "";
71 # set the global variable '$debug' (= 1) to see all results on the terminal,
72 # else (= 0) it shows nothing of the working output!
73 my $debug = 0;
75 # open the filehandle 'ERROR_LOG' for all errors
76 open (ERROR_LOG, ">>ascii_parse.log")
77 or die "Error. Open the file <ascii_parse.log> wasn't successful!\n\n";
79 # reference of the instance of a new object
80 my $XMLTree;
82 foreach (@buildlist_files)
84 # get each element (= module) in '$parse_file'
85 $parse_file = $_;
87 # open the filehandle 'PARSE_ASCII' for each module/file that we want to parse
88 open (PARSE_ASCII, $parse_file)
89 or die "Error. Open the module <$parse_file> wasn't successful!\n\n";
91 # create a new object
92 $XMLTree = XMLBuildListParser->new();
94 # invoking of the main subroutine
95 reading_file();
97 # is the file name 'build.lst' in the path on the command line?
98 # if not, we can not parse and create the new 'build.xlist' file
99 if ($parse_file =~ /build(\w+)?\.lst\S*$/)
101 my $path = $parse_file;
103 $path =~ s/build(\w+)?\.lst\S*$/build\.xlist/;
105 $XMLTree->saveXMLFile($path);
107 else
109 add_errorlog_no_buildlst_file_found_statement($parse_file);
112 # close the current $parse_file
113 close(PARSE_ASCII);
116 # after all files were read close the errorlog file
117 close(ERROR_LOG);
120 ########################### begin of subroutines #####################################
122 # global used variable: $parse_file
124 ########################################################################################
127 ########################################################################################
128 # sub: reading_file
129 # gets: $_ (current file)
130 # returns: -
131 ########################################################################################
132 sub reading_file
134 # variable for the name of the current module
135 my $module_name = "";
137 # hashes for the infos beginning at the second line of the build.lst files
138 my %dir_of_job_platform = ();
139 my %dir_of_alias = ();
141 # control variable for the module dependency line of the file
142 # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
143 # "sa sal : xml2cmp NULL"
144 my $module_dependency_line_exists = 0;
145 my $module_dependency_line_was_read = 0;
147 # this line variables are for checking that all lines will be read
148 # counts each line
149 my $line_number = 0;
150 # for the sum of the informative lines (='module dependency line' and 'nmake' lines of the file)
151 my $info_line_sum = 0;
152 # for the sum of the no-info lines, like:
153 # job lines: 'usr1', 'get', ... and comment lines: '# ...' or empty lines
154 my $no_info_line_sum = 0;
156 # read all lines of the file to resolve the first alias
157 # with the matching dir to know all aliases and directories
158 # at the later second file reading
159 while (<PARSE_ASCII>)
161 # the variable for each line of a file
162 my $line = $_;
164 # count each line for more exact error descriptions in the log file
165 $line_number += 1;
167 # remember it, if this line exists
168 if ( (is_module_dependency_line($line)) && ($module_dependency_line_exists == 0) )
170 $module_dependency_line_exists = 1;
172 # get the name of the current module
173 $module_name = get_module_name($line);
176 # skip all lines, that hasn't the job 'nmake'
177 next if (!(is_nmake_line($line)));
179 # check that the infos (job directory, job platform and alias) exist
180 if (my ($job_dir, $job_platform, $alias) = get_alias_resolving_infos($line))
182 # prove that it's a valid job_platform
183 # and that each first alias and matching job platform exists only once
184 check_alias_and_job_platform($job_dir, $job_platform, $alias, \%dir_of_job_platform,
185 \%dir_of_alias, $module_name, $line_number);
187 else
189 chomp;
190 add_errorlog_unknown_format_statement($line, $module_name, $line_number);
191 next;
194 # reset the $line_number, because we count it again
195 $line_number = 0;
197 # read the same file again
198 seek (PARSE_ASCII,0,0);
200 # read each line of the file for all other informations
201 # e.g. line 8 of module 'sal'
202 # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL"
203 # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform
204 while (<PARSE_ASCII>)
206 # the variable for each line of a file
207 my $line = $_;
209 # count each line to check at the end of the file that all lines were read
210 # and for more exact error descriptions in the log file
211 $line_number += 1;
213 # is it a 'nmake' or a 'module dependency' line?
214 # if not: print this line to STDOUT,
215 # count one to the no-info lines,
216 # try to get the information about the module name from this line
217 # and skip the line
218 if ( (!(is_nmake_line($line))) && (!(is_module_dependency_line($line))) )
220 my $no_info_line = show_no_info_line($line, $line_number);
222 $no_info_line_sum += $no_info_line;
224 # if no module dependency line exists get the name of the current module from another line
225 $module_name = get_module_name($line) if (!($module_name));
227 # skip the no-info line
228 next;
231 # only if the module dependency line exists and it wasn't read get the infos about it
232 if ( ($module_dependency_line_exists) && (!($module_dependency_line_was_read)) )
234 ($module_dependency_line_was_read, $info_line_sum) = get_module_dependency_line_infos
235 ($line, $module_name, $line_number);
238 # get all 'nmake' line infos
239 my $info_line = get_nmake_line_infos($line, \%dir_of_alias, \%dir_of_job_platform,
240 $module_name, $line_number);
242 # count the info lines;
243 $info_line_sum += $info_line;
246 if ($debug == 1)
248 # show the sums of the info and no-info lines
249 lines_sums_output($module_name, $line_number, $info_line_sum, $no_info_line_sum);
253 ########################################################################################
254 # sub: is_module_dependency_line
255 # gets: $line
256 # returns: 1 (true) or 0 (false)
257 ########################################################################################
258 sub is_module_dependency_line
260 my $line = shift;
262 # if the module dpendency line exists return 1, otherwise 0
263 ($line =~ /^\w+\s+\S+\s+:+\s+/)
264 ? return 1
265 : return 0;
268 ########################################################################################
269 # sub: is_nmake_line
270 # gets: $line
271 # returns: '1' (true) or '0' (false)
272 ########################################################################################
273 sub is_nmake_line
275 my $line = shift;
277 # these lines are NO nmake lines:
278 # 1. a empty line
279 # 2. a comment line (perhaps with the job 'nmake')
280 # like line 20 of module 'bridges' (SRC680/src.m42)
281 # "#br bridges\source\cli_uno nmake - w,vc7 br_cli_uno br_unotypes NULL========= "
282 # 3. the module dependency line
283 # like line 1 of module 'sal' (dependencies means the colon(s)) (SRC680/src.m42)
284 # "sa sal : xml2cmp N ULL"
285 # 4. a 'p' job platform line (for OS2)
286 # 5. a line with a job, which is not 'nmake'
287 ($line =~ (/^[^\s+\#]/) && (!(/\s+:+\s+/)) && (!(/\s+p\s+/)) && (/\bnmake\b/) )
288 ? return 1
289 : return 0;
292 ########################################################################################
293 # sub: get_alias_resolving_infos
294 # gets: $line
295 # returns: $job_dir, $job_platform, $alias
296 ########################################################################################
297 sub get_alias_resolving_infos
299 my $line = shift;
301 if ($line =~ /^\w+\s+(\S+)\s+\w+\s+\-\s+(\w+)\,?(\w+)?\s+(\S+)\s+/)
303 # get the current work directory
304 my $temp_job_dir = $1;
306 my $job_dir = change_job_directory($temp_job_dir);
308 # get the job platform of the current job
309 # if it is a 'n' job platform transform it to 'w'
310 # because 'n' can be used now as 'w' (both means windows)
311 my $job_platform = $2;
312 $job_platform = "w" if($job_platform eq "n");
314 # get the first alias in each line
315 my $alias = $4;
317 return ($job_dir, $job_platform, $alias);
319 return (undef, undef, undef);
322 ########################################################################################
323 # sub: change_job_directory
324 # gets: $job_dir
325 # returns: $changed_job_dir
326 ########################################################################################
327 # we don't need the module name and the first '\' in the current directory
328 sub change_job_directory
330 my $changed_job_dir = shift;
332 # ignore the module name
333 $changed_job_dir =~ s/^\w+//;
334 # change all other '\' against the '/' of the current dir
335 $changed_job_dir =~ s/\\/\//g;
337 # get only a "/" if we are in the root directory
338 $changed_job_dir = "/" if ($changed_job_dir eq "");
340 return $changed_job_dir;
343 ########################################################################################
344 # sub: check_alias_and_job_platform
345 # gets: $job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
346 # $dir_of_alias_ref, $module_name, $line_number
347 # returns: -
348 ########################################################################################
349 # get it in the hash only if it is a valid job platform,
350 # like 'w', 'u', 'm' and 'n'
351 # 'all' is also valid but it doesn't exist in an alias platform(!)
352 sub check_alias_and_job_platform
354 my ($job_dir, $job_platform, $alias, $dir_of_job_platform_ref,
355 $dir_of_alias_ref, $module_name, $line_number) = @_;
357 # is it a valid job_platform?
358 if ($job_platform =~ /(w|u|m|n|all)/)
360 # get only the 'w', 'u', 'm' and 'n' based job platforms
361 if ($job_platform =~ /[wumn]/)
363 # doesn't the key already exist?
364 (!(exists $$dir_of_job_platform_ref{$job_platform.$alias}))
365 # get the first alias with the matching job platform in the hash
366 ? get_alias_and_job_platform($job_platform, $alias, $dir_of_job_platform_ref)
367 # this is a line with a redundant alias and job platform
368 : add_errorlog_alias_redundancy_statement($module_name, $alias, $job_platform, $line_number);
370 if (!(exists $$dir_of_alias_ref{$alias}))
372 # get each first alias with the matching job platform
373 get_alias_and_matching_directory($dir_of_alias_ref, $alias, $job_dir);
376 # it's not a valid job platform
377 else
379 add_errorlog_invalid_platform_statement($module_name, $job_platform, $line_number);
383 ########################################################################################
384 # sub: get_alias_and_job_platform
385 # gets: $job_platform, $alias, $dir_of_job_platform_ref
386 # returns: -
387 ########################################################################################
388 # get the the job platform and the first alias as a unique key
389 # and the job platform as value of the hash
390 # it's for checking later that the alias platform is equal to the job platform
391 # e.g.: line 6 + 7 of the module 'gtk' (SRC680/src.m42)
392 # "gt gtk\pkgconfig nmake - u gt_pkg NULL"
393 # "gt gtk\glib nmake - u gt_glib gt_pkg.u NULL"
394 # the alias 'gt_pkg' has the directory 'gtk\pkgconfig' (we need only 'pkgconfig')
395 # and it has the job platform 'u' - compare it with the alias platform 'gt_pkg.u'
396 sub get_alias_and_job_platform
398 my ($job_platform, $alias, $dir_of_job_platform_ref) = @_;
400 # key = 'job platform' and 'first alias' => value = 'job platform'
401 $$dir_of_job_platform_ref{$job_platform.$alias} = $job_platform;
404 ########################################################################################
405 # sub: get_alias_and_matching_directory
406 # gets: $dir_of_alias_ref, $alias, $job_dir
407 # returns: -
408 ########################################################################################
409 # fill the hash with the first alias and the matching directory
410 # e.g. line 14 of module 'setup2' (SRC680/src.m42)
411 # "se setup2\win\source\unloader nmake - w se_wulo se_unotypes NULL"
412 # key = 'se_wulo' => value = 'win/source/unloader'
413 sub get_alias_and_matching_directory
415 my ($dir_of_alias_ref, $alias, $job_dir) = @_;
417 # key = 'first alias' => value = 'job directory'
418 $$dir_of_alias_ref{$alias} = $job_dir;
421 ########################################################################################
422 # sub: show_no_info_line
423 # gets: $line, $line_number
424 # returns: $no_info_line
425 ########################################################################################
426 sub show_no_info_line
428 my ($line, $line_number) = @_;
429 my $no_info_line += 1;
431 chomp($line);
433 print"Ignore line <$line_number>:\n\"$line\"\n\n" if ($debug);
435 return $no_info_line;
438 ########################################################################################
439 # sub: get_module_name
440 # gets: $line
441 # returns: $module_name
442 ########################################################################################
443 sub get_module_name
445 my $line = shift;
446 my $module_name = "";
448 if ($line =~ /^\w+\s+([\w\.\-]+)\\?/)
450 $module_name = $1;
453 # set the 'module name' in the data structure tree
454 $XMLTree->setModuleName($module_name);
456 return $module_name;
459 ########################################################################################
460 # sub: get_module_dependency_line_infos
461 # gets: $line, $module_name, $line_number
462 # returns: $module_dependency_line_was_read, $info_line_sum
463 ########################################################################################
464 # get the informations about the module dependency line
465 # like line 1 of module 'sal' (SRC680/src.m42)
466 # "sa sal : xml2cmp NULL"
467 # $module_name $module_dependency @module_dependency_names
468 sub get_module_dependency_line_infos
470 my ($line, $module_name, $line_number) = @_;
471 my $module_dependency = "";
472 my @module_dependency_names = ();
473 my %dep_modules_and_products = ();
474 my $product = "";
476 my $module_dependency_line_was_read = 1;
477 my $info_line_sum = 1;
479 if ($debug)
481 print"\nline number : <$line_number>\n";
482 print"module-name : <$module_name>\n";
485 # get the dependencies
486 if ($line =~ /\s+(:+)\s+/)
488 $module_dependency = $1;
489 print"module-dependency : <$module_dependency>\n" if ($debug);
491 # transform the dependency type to the corresponding tag name
492 if ($module_dependency eq ":")
494 $module_dependency = "md-simple";
496 elsif ($module_dependency eq "::")
498 $module_dependency = "md-always";
500 elsif ($module_dependency eq ":::")
502 $module_dependency = "md-force";
506 # get a list of all depending module names
507 if ($line =~ /:+\s+([\S\s]+)\s+NULL/)
509 @module_dependency_names = split(/\s+/, $1);
511 foreach my $module (@module_dependency_names)
513 # check whether that there is another product (as "all") of a module
514 if ($module =~ /(\S+):+(\S+)/)
516 $dep_modules_and_products{$2} = $1;
518 else
520 $dep_modules_and_products{$module} = "all";
525 # add the dependency module names, the module dependency type and the product to the data structure
526 foreach my $module (sort keys %dep_modules_and_products)
528 print"module-dependency-name(s) : key <$module> value <".$dep_modules_and_products{$module}.">\n" if ($debug);
530 $XMLTree->addModuleDependencies($module, $module_dependency, $dep_modules_and_products{$module});
533 return ($module_dependency_line_was_read, $info_line_sum);
536 ########################################################################################
537 # sub: get_nmake_line_infos
538 # gets: $line, \%dir_of_alias, \%dir_of_job_platform, $module_name, $line_number
539 # returns: $info_line
540 ########################################################################################
541 # get all infos about the 'nmake' lines
542 # e.g. line 8 of module 'sal'
543 # "sa sal\systools\win32\guistdio nmake - n sa_guistdio sa_uwinapi.n NULL"
544 # $job_dir $job $job_platform 1.$alias 2.$alias + alias platform
545 sub get_nmake_line_infos
547 my ($line, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
548 my $directories_ref = "";
549 my $info_line = 0;
551 # get the infos about the 'nmake' lines
552 if ($line =~ /^\w+\s+(\S+)\s+(\w+)\s+\-\s+(\w+)\,?(\S+)?/)
554 # get the current working directory
555 my $temp_job_dir = $1;
556 my $job_dir = change_job_directory($temp_job_dir);
558 # get the job
559 my $job = $2;
560 $job = "make" if ($job eq "nmake");
562 # get the job platform of the current job
563 # if it is a 'n' job platform transform it to 'wnt'
564 # available values are: 'wnt', 'unx', 'mac' or 'all'
565 my $job_platform = $3;
566 $job_platform = change_job_platform_name($job_platform);
568 # get the first alias in each line
569 my $restriction = $4;
570 my %build_req = ( "$restriction" => "$job_platform") if ($restriction && $job_platform);
573 # get all aliases (but not the first) in an array
574 my $aliases_ref = get_aliases($line);
576 # filter the list of aliases, which has a 'p' job platform
577 # and transform a 'n' ending alias platform to a 'w' ending alias platform
578 filter_aliases($aliases_ref);
580 # resolve all aliases (alias[.job platform] => matching directory)
581 $directories_ref = resolve_aliases($aliases_ref, $dir_of_alias_ref,
582 $dir_of_job_platform_ref, $module_name, $line_number);
584 # count the informative lines
585 $info_line = 1;
587 $XMLTree->addJob($job_dir, $job, $job_platform, $directories_ref, \%build_req);
589 # show the infos, that we know about each line
590 if ($debug == 1)
592 show_line_infos($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref);
595 return $info_line;
598 ########################################################################################
599 # sub: change_job_platform_name
600 # gets: $job_platform
601 # returns: $job_platform
602 ########################################################################################
603 sub change_job_platform_name
605 my $job_platform = shift;
607 $job_platform = "wnt" if($job_platform eq "n" || $job_platform eq "w");
608 $job_platform = "unx" if($job_platform eq "u");
609 $job_platform = "mac" if($job_platform eq "m");
611 return $job_platform;
614 ########################################################################################
615 # sub: get_aliases
616 # gets: $_ (current line)
617 # returns: \@aliases
618 ########################################################################################
619 # get all aliases of the line in an array
620 sub get_aliases
622 my $line = shift;
623 my @aliases = ();
625 # get all aliases in an array (but cut out the first alias)
626 if ($line =~ /\-\s+[\w+\,]+\s+([\S\s]+)\s+NULL$/)
628 print"\nall job aliases : <$1>\n" if ($debug);
630 @aliases = split /\s+/, $1;
632 # we don't need the first alias (it stands for the current job directory)
633 shift @aliases;
635 return \@aliases;
638 ########################################################################################
639 # sub: filter_aliases
640 # gets: $aliases_ref
641 # returns: -
642 ########################################################################################
643 # filter all aliases, because we only need the 'w', 'u' and 'm' job platform based aliases
644 sub filter_aliases
646 my $aliases_ref = shift;
648 # get the highest index of the array (number of elements of the array - 1)
649 # also works: my $index = scalar(@$aliases_ref)-1;
650 my $index = $#{@{$aliases_ref}};
652 for (; $index >= 0; $index--)
654 # filter the 'p' job platform based aliases from '@aliases'
655 splice(@$aliases_ref, $index, 1) if ($$aliases_ref[$index] =~ /\.p$/);
657 # transform a '.n' ending alias platform to '.w' ending alias platform
658 if ($$aliases_ref[$index] =~ /\.n$/)
660 $$aliases_ref[$index] =~ s/\.n$/\.w/;
661 splice(@$aliases_ref, $index, 1, $$aliases_ref[$index]);
666 ########################################################################################
667 # sub: resolve_aliases
668 # gets: $aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref,
669 # $module_name, $line_number
670 # returns: \@directories
671 ########################################################################################
672 # here we get each alias with the matching job directory
673 sub resolve_aliases
675 my ($aliases_ref, $dir_of_alias_ref, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
677 my @directories = ();
678 my ($alias_platform, $alias, $temp_alias) = "";
680 # resolving all directory aliases
681 foreach $temp_alias (@$aliases_ref)
683 ($alias, $alias_platform) = compare_job_platform_with_alias_platform
684 ($temp_alias, $dir_of_job_platform_ref, $module_name, $line_number);
686 # does the alias exist?
687 if (exists $$dir_of_alias_ref{$alias})
689 # then get the matching directory in the array
690 push (@directories, $$dir_of_alias_ref{$alias});
692 else
694 add_errorlog_no_directory_of_alias_statement($module_name, $alias, $line_number);
697 return \@directories;
700 ########################################################################################
701 # sub: compare_job_platform_with_alias_platform
702 # gets: $alias, $dir_of_job_platform_ref, $module_name, $line_number
703 # returns: $alias
704 ########################################################################################
705 sub compare_job_platform_with_alias_platform
707 my ($alias, $dir_of_job_platform_ref, $module_name, $line_number) = @_;
709 my $alias_platform = "";
711 # compare the alias platform (with a dot and an ending letter, like "al_alib.u")
712 # with the job platform of the line in which this alias was resolved
713 if ($alias =~ /\.([wum])$/)
715 $alias_platform = $1;
717 # don't memorize the ending dot and letter
718 $alias =~ s/\.\w$//;
720 # if the value(= job platform) of the hash or the alias platform has no value
721 # set it to "no valid value"
722 if (!(exists $$dir_of_job_platform_ref{$alias_platform.$alias}))
724 $$dir_of_job_platform_ref{$alias_platform.$alias} = "no valid value";
726 $alias_platform = "no valid value" if (!($alias_platform));
728 # are the job platform and the alias platform equal?
729 if ($$dir_of_job_platform_ref{$alias_platform.$alias} ne $alias_platform)
731 add_errorlog_not_equal_platforms_statement
732 ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number);
735 return ($alias, $alias_platform);
738 ########################################################################################
739 # sub: show_line_infos
740 # gets: $line_number, $job_dir, $job, $job_platform, $restriction,
741 # $aliases_ref, $directories_ref
742 # returns: -
743 ########################################################################################
744 # print the infos about each line
745 sub show_line_infos
747 my ($line_number, $job_dir, $job, $job_platform, $restriction, $aliases_ref, $directories_ref) = @_;
749 print"line number : <$line_number>\n";
750 print"job directory : <$job_dir>\n";
751 print"job : <$job>\n";
752 print"job platform : <$job_platform>\n" if ($job_platform =~ /(w|u|m|all)/);
753 print"restriction : <$restriction>\n" if ($restriction);
754 print"alias dependencies : <@$aliases_ref>\n";
755 print"directory dependencies : <@$directories_ref>\n\n";
758 ########################################################################################
759 # sub: lines_sums_output
760 # gets: $module_name, $line_number, $info_line_sum, $no_info_line_sum
761 # returns: -
762 ########################################################################################
763 sub lines_sums_output
765 # this line variables are for checking that all lines will be read:
766 my ($module_name, $line_number, $info_line_sum, $no_info_line_sum) = @_;
767 my $lines_sum = 0;
769 add_errorlog_no_module_name_statement() if (!($module_name));
771 # were all lines read? and is the checksum okay?
772 $lines_sum = $info_line_sum + $no_info_line_sum;
773 if ($lines_sum == $line_number)
775 print"All $line_number line(s) of module <$module_name> were read and checked!\n\n";
777 else
779 add_errorlog_different_lines_sums_statement($module_name);
782 print"module: <$module_name>\n".
783 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
784 " info line(s) sum = $info_line_sum\n".
785 "no-info line(s) sum = $no_info_line_sum\n".
786 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n".
787 " total line(s) sum = $line_number\n\n\n";
791 ############################ ERROR_LOG subroutines #####################################
794 ########################################################################################
795 # sub: add_errorlog_invalid_job_platform_statement
796 # gets: $module_name, $platform, $line_number
797 # returns: -
798 ########################################################################################
799 sub add_errorlog_invalid_job_platform_statement
801 my ($module_name, $job_platform, $line_number) = @_;
803 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
804 "The job platform <$job_platform> is not valid.\n\n";
807 ########################################################################################
808 # sub: add_errorlog_not_equal_platforms_statement
809 # gets: $module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number
810 # returns: -
811 ########################################################################################
812 sub add_errorlog_not_equal_platforms_statement
814 my ($module_name, $alias, $alias_platform, $dir_of_job_platform_ref, $line_number) = @_;
816 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
817 "The alias platform <$alias.$alias_platform> is not equal ".
818 "with the job platform <$$dir_of_job_platform_ref{$alias_platform.$alias}>.\n\n";
821 ########################################################################################
822 # sub: add_errorlog_no_directory_of_alias_statement
823 # gets: $module_name, $alias, $line_number
824 # returns: -
825 ########################################################################################
826 sub add_errorlog_no_directory_of_alias_statement
828 my ($module_name, $alias, $line_number) = @_;
830 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
831 "The directory of the alias <$alias> doesn't exist!\n\n";
834 ########################################################################################
835 # sub: add_errorlog_no_module_name_statement
836 # gets: -
837 # returns: -
838 ########################################################################################
839 sub add_errorlog_no_module_name_statement
841 print ERROR_LOG "Error. No module name found in dir/file <$parse_file>.\n\n";
844 ########################################################################################
845 # sub: add_errorlog_alias_redundancy_statement
846 # gets: $module_name, $alias, $job_platform, $line_number
847 # returns: -
848 ########################################################################################
849 sub add_errorlog_alias_redundancy_statement
851 my ($module_name, $alias, $job_platform, $line_number)= @_;
853 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.\n".
854 "The alias <$alias> with the job platform <$job_platform> is redundant.\n\n";
857 ########################################################################################
858 # sub: add_errorlog_unknown_format_statement
859 # gets: $module_name, $line_number
860 # returns: -
861 ########################################################################################
862 sub add_errorlog_unknown_format_statement
864 my ($line, $module_name, $line_number) = @_;
866 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file> line <$line_number>.".
867 "\nUnknown format:\n\"$line\"\n\n";
870 ########################################################################################
871 # sub: add_errorlog_different_lines_sums_statement
872 # gets: $module_name
873 # returns: -
874 ########################################################################################
875 sub add_errorlog_different_lines_sums_statement
877 my $module_name = shift;
879 print ERROR_LOG "Error in module <$module_name> of dir/file <$parse_file>.\n".
880 "The sums of all info and no-info lines are not correct!\n\n";
883 ########################################################################################
884 # sub: add_errorlog_no_buildlst_file_found_statement
885 # gets: $parse_file
886 # returns: -
887 ########################################################################################
888 sub add_errorlog_no_buildlst_file_found_statement
890 my $parse_file = shift;
892 print ERROR_LOG "Error in command line argument <$parse_file>.\n".
893 "File 'build.lst' not found!\n";
896 ############################# end of the subroutines ###################################