xref: /aoo4110/main/solenv/bin/par2script.pl (revision b1cdbd2c)
1#**************************************************************
2#
3#  Licensed to the Apache Software Foundation (ASF) under one
4#  or more contributor license agreements.  See the NOTICE file
5#  distributed with this work for additional information
6#  regarding copyright ownership.  The ASF licenses this file
7#  to you under the Apache License, Version 2.0 (the
8#  "License"); you may not use this file except in compliance
9#  with the License.  You may obtain a copy of the License at
10#
11#    http://www.apache.org/licenses/LICENSE-2.0
12#
13#  Unless required by applicable law or agreed to in writing,
14#  software distributed under the License is distributed on an
15#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16#  KIND, either express or implied.  See the License for the
17#  specific language governing permissions and limitations
18#  under the License.
19#
20#**************************************************************
21
22
23
24use lib ("$ENV{SOLARENV}/bin/modules");
25
26use Cwd;
27use par2script::check;
28use par2script::files;
29use par2script::globals;
30use par2script::parameter;
31use par2script::module;
32use par2script::undefine;
33use par2script::work;
34
35####################################
36# Main program
37####################################
38
39par2script::parameter::getparameter();
40par2script::parameter::control_parameter();
41par2script::parameter::outputparameter();
42
43my $includes = par2script::work::setincludes($par2script::globals::includepathlist);
44my $parfiles = par2script::work::setparfiles($par2script::globals::parfilelist);
45
46par2script::work::make_complete_pathes_for_parfiles($parfiles, $includes);
47
48print "Reading par files\n";
49my $parfilecontent = par2script::work::read_all_parfiles($parfiles);
50
51print "Collecting items\n";
52par2script::work::collect_definitions($parfilecontent);
53
54print "Collecting assigned items\n";
55par2script::work::collect_assigned_gids();
56
57# print "First control of multiple assignments\n";
58# par2script::check::check_multiple_assignments();
59
60print "Searching for Undefinitions\n";
61par2script::undefine::undefine_gids($parfilecontent);
62par2script::undefine::remove_complete_item("Directory", $parfilecontent);
63par2script::undefine::remove_complete_item("Profile", $parfilecontent);
64
65print "Removing assigned GIDs without definitions\n";
66par2script::module::remove_undefined_gids_from_modules();
67
68print "Adding definitions without assignment to the root\n";
69par2script::module::add_to_root_module();
70
71print "Control of multiple assignments\n";
72par2script::check::check_multiple_assignments();
73
74print "Control of definitions with missing assignments\n";
75par2script::check::check_missing_assignments();
76
77# checking the setup script
78print "Checking directory definitions ...\n";
79par2script::check::check_needed_directories();
80par2script::check::check_directories_in_item_definitions();
81print "Checking module definitions ...\n";
82par2script::check::check_module_existence();
83print "Checking module assignments ...\n";
84par2script::check::check_moduleid_at_items();
85print "Checking Root Module ...";
86par2script::check::check_rootmodule();
87print "Checking Shortcut assignments ...\n";
88par2script::check::check_shortcut_assignments();
89print "Checking missing parents ...\n";
90par2script::check::check_missing_parents();
91
92print "Shorten lines at modules\n";
93par2script::module::shorten_lines_at_modules();
94
95# Now the script can be created
96print "Creating setup script\n";
97my $setupscript = par2script::work::create_script();
98
99print "Saving script\n";
100par2script::files::save_file($par2script::globals::scriptname, $setupscript);
101
102# logging, if set
103if ($par2script::globals::logging)
104{
105	par2script::files::save_file($par2script::globals::logfilename, \@par2script::globals::logfileinfo);
106	print "Log file written: $par2script::globals::logfilename\n";
107}
108
109####################################
110# End main program
111####################################
112