xref: /trunk/main/solenv/bin/par2script.pl (revision cdf0e10c)
1#*************************************************************************
2#
3# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4#
5# Copyright 2000, 2010 Oracle and/or its affiliates.
6#
7# OpenOffice.org - a multi-platform office productivity suite
8#
9# This file is part of OpenOffice.org.
10#
11# OpenOffice.org is free software: you can redistribute it and/or modify
12# it under the terms of the GNU Lesser General Public License version 3
13# only, as published by the Free Software Foundation.
14#
15# OpenOffice.org is distributed in the hope that it will be useful,
16# but WITHOUT ANY WARRANTY; without even the implied warranty of
17# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18# GNU Lesser General Public License version 3 for more details
19# (a copy is included in the LICENSE file that accompanied this code).
20#
21# You should have received a copy of the GNU Lesser General Public License
22# version 3 along with OpenOffice.org.  If not, see
23# <http://www.openoffice.org/license.html>
24# for a copy of the LGPLv3 License.
25#
26#*************************************************************************
27
28use lib ("$ENV{SOLARENV}/bin/modules");
29
30use Cwd;
31use par2script::check;
32use par2script::files;
33use par2script::globals;
34use par2script::parameter;
35use par2script::module;
36use par2script::undefine;
37use par2script::work;
38
39####################################
40# Main program
41####################################
42
43par2script::parameter::getparameter();
44par2script::parameter::control_parameter();
45par2script::parameter::outputparameter();
46
47my $includes = par2script::work::setincludes($par2script::globals::includepathlist);
48my $parfiles = par2script::work::setparfiles($par2script::globals::parfilelist);
49
50par2script::work::make_complete_pathes_for_parfiles($parfiles, $includes);
51
52print "Reading par files\n";
53my $parfilecontent = par2script::work::read_all_parfiles($parfiles);
54
55print "Collecting items\n";
56par2script::work::collect_definitions($parfilecontent);
57
58print "Collecting assigned items\n";
59par2script::work::collect_assigned_gids();
60
61# print "First control of multiple assignments\n";
62# par2script::check::check_multiple_assignments();
63
64print "Searching for Undefinitions\n";
65par2script::undefine::undefine_gids($parfilecontent);
66par2script::undefine::remove_complete_item("Directory", $parfilecontent);
67par2script::undefine::remove_complete_item("Profile", $parfilecontent);
68
69print "Removing assigned GIDs without definitions\n";
70par2script::module::remove_undefined_gids_from_modules();
71
72print "Adding definitions without assignment to the root\n";
73par2script::module::add_to_root_module();
74
75print "Control of multiple assignments\n";
76par2script::check::check_multiple_assignments();
77
78print "Control of definitions with missing assignments\n";
79par2script::check::check_missing_assignments();
80
81# checking the setup script
82print "Checking directory definitions ...\n";
83par2script::check::check_needed_directories();
84par2script::check::check_directories_in_item_definitions();
85print "Checking module definitions ...\n";
86par2script::check::check_module_existence();
87print "Checking module assignments ...\n";
88par2script::check::check_moduleid_at_items();
89print "Checking Root Module ...";
90par2script::check::check_rootmodule();
91print "Checking Shortcut assignments ...\n";
92par2script::check::check_shortcut_assignments();
93print "Checking missing parents ...\n";
94par2script::check::check_missing_parents();
95
96print "Shorten lines at modules\n";
97par2script::module::shorten_lines_at_modules();
98
99# Now the script can be created
100print "Creating setup script\n";
101my $setupscript = par2script::work::create_script();
102
103print "Saving script\n";
104par2script::files::save_file($par2script::globals::scriptname, $setupscript);
105
106# logging, if set
107if ($par2script::globals::logging)
108{
109	par2script::files::save_file($par2script::globals::logfilename, \@par2script::globals::logfileinfo);
110	print "Log file written: $par2script::globals::logfilename\n";
111}
112
113####################################
114# End main program
115####################################
116