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