Bump for 3.6-28
[LibreOffice.git] / solenv / bin / modules / par2script / parameter.pm
blob0c29339496f2d6dbeb9375826afb2fe9fdf96ee2
1 #*************************************************************************
3 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 # Copyright 2000, 2010 Oracle and/or its affiliates.
7 # OpenOffice.org - a multi-platform office productivity suite
9 # This file is part of OpenOffice.org.
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.
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).
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.
26 #*************************************************************************
29 package par2script::parameter;
31 use Cwd;
32 use par2script::files;
33 use par2script::globals;
34 use par2script::systemactions;
36 ############################################
37 # Parameter Operations
38 ############################################
40 ###############################################################################
41 # Usage:
42 # perl par2script.pl -i ..\wntmsci8.pro\par,o:\SRX645\wntmsci8.pro\par.m24
43 # @@C:\DOCUMEN~1\is\LOCALS~1\Temp\mk6pd
44 # -o ..\wntmsci8.pro\bin\osl\setup_osl.inf
45 ###############################################################################
47 sub usage
49 print <<Ende;
51 --------------------------------------------------------------
52 $par2script::globals::prog
53 The following parameter are needed:
54 -i: include paths, comma separated list
55 -o: setup script file name
56 -v: writing logfile.txt (optional)
57 \@\@list: list of all par files
59 Example:
60 perl par2script.pl -i ..\\wntmsci8\\par\,o\:\\SRX645\\wntmsci8\\par.m24
61 \@\@C\:\\DOCUMEN\~1\\is\\LOCALS\~1\\Temp\\mk6pd
62 -o ..\\wntmsci8.pro\\bin\\osl\\setup_osl.inf \[-v\]
64 --------------------------------------------------------------
65 Ende
66 exit(-1);
69 #####################################
70 # Reading parameter
71 #####################################
73 sub getparameter
75 while ( $#ARGV >= 0 )
77 my $param = shift(@ARGV);
79 if ($param eq "-o") { $par2script::globals::scriptname = shift(@ARGV); }
80 elsif ($param eq "-q") { $par2script::globals::verbose = 0; }
81 elsif ($param eq "-v") { $par2script::globals::logging = 1; }
82 elsif ($param =~ /\@\@/) { $par2script::globals::parfilelistorig = $param; }
83 elsif ($param eq "-i") { $par2script::globals::includepathlist = shift(@ARGV); }
84 elsif (($param =~ /\//) || ($param =~ /\\/)) # another include parameter!
86 $par2script::globals::includepathlist = $par2script::globals::includepathlist . "," . $param;
88 else
90 print("\n*************************************\n");
91 print("Sorry, unknown parameter: $param");
92 print("\n*************************************\n");
93 usage();
94 exit(-1);
99 ############################################
100 # Controlling the fundamental parameter
101 # (required for every process)
102 ############################################
104 sub control_parameter
106 if ($par2script::globals::includepathlist eq "")
108 print "\n************************************************\n";
109 print "Error: Include paths not set not set (-i)!";
110 print "\n************************************************\n";
111 usage();
112 exit(-1);
115 if ($par2script::globals::scriptname eq "")
117 print "\n************************************************\n";
118 print "Error: Name of the setup script not set (-o)!";
119 print "\n************************************************\n";
120 usage();
121 exit(-1);
124 if ($par2script::globals::parfilelistorig eq "")
126 print "\n************************************************\n";
127 print "Error: List of par files not set!";
128 print "\n************************************************\n";
129 usage();
130 exit(-1);
133 # The par file list has to exist
135 $par2script::globals::parfilelist = $par2script::globals::parfilelistorig;
136 $par2script::globals::parfilelist =~ s/\@\@//;
137 par2script::files::check_file($par2script::globals::parfilelist);
140 #####################################
141 # Writing parameter to shell
142 #####################################
144 sub outputparameter
146 my $outputline = "\n$par2script::globals::prog -i $par2script::globals::includepathlist $par2script::globals::parfilelistorig -o $par2script::globals::scriptname";
148 if ($par2script::globals::logging) { $outputline .= " -v"; }
150 $outputline .= "\n";
152 print $outputline;