merge the formfield patch from ooo-build
[ooovba.git] / smoketestoo_native / config.pl
blob642a256e33d485489e54e6fa18a968004484a72a
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
4 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # $RCSfile: config.pl,v $
14 # $Revision: 1.5 $
16 # This file is part of OpenOffice.org.
18 # OpenOffice.org is free software: you can redistribute it and/or modify
19 # it under the terms of the GNU Lesser General Public License version 3
20 # only, as published by the Free Software Foundation.
22 # OpenOffice.org is distributed in the hope that it will be useful,
23 # but WITHOUT ANY WARRANTY; without even the implied warranty of
24 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 # GNU Lesser General Public License version 3 for more details
26 # (a copy is included in the LICENSE file that accompanied this code).
28 # You should have received a copy of the GNU Lesser General Public License
29 # version 3 along with OpenOffice.org. If not, see
30 # <http://www.openoffice.org/license.html>
31 # for a copy of the LGPLv3 License.
33 #*************************************************************************
35 use File::Path;
36 use File::Copy;
38 ### globals ###
40 $is_debug = 0;
42 $gui = $ENV{GUI};
43 $cygwin = "cygwin";
45 if ($^O =~ /cygwin/) {
46 $gui = $cygwin;
49 if (($gui eq "UNX") or ($gui eq $cygwin)) {
50 $pathslash = "/";
52 else
54 $pathslash = "\\";
57 #### Hardly coded path for
58 # \share\registry\data\org\openoffice\Office\Jobs.xcu
60 $jobs_XML_Path = "share" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash . "Office" . $pathslash . "Jobs.xcu";
62 # \user\registry\data\org\openoffice\
64 $User_Path = "user" . $pathslash . "registry" . $pathslash . "data" . $pathslash . "org" . $pathslash . "openoffice" . $pathslash;
66 # \user\registry\data\org\openoffice\Office\
68 $User_Office_Path = $User_Path . "Office" . $pathslash;
70 # \user\registry\data\org\openoffice\Office\OOoImprovement
72 $OOoImprovement_Path = $User_Office_Path . "OOoImprovement" . $pathslash;
74 $common_XML = "Common.xcu";
75 $setup_XML = "Setup.xcu";
76 $oooimprovement_XML = "Settings.xcu";
78 # $(INPATH)\misc\Common.xcu
79 $inpath_Common_XCU = $ENV{INPATH} . $pathslash . "misc" . $pathslash . $common_XML;
81 ### main ###
83 $idStr = ' $Revision: 1.5 $ ';
84 $idStr =~ /Revision:\s+(\S+)\s+\$/
85 ? ($cpflat2minor_rev = $1) : ($cpflat2minor_rev = "-");
87 if ( ($#ARGV >= 3) ) {
88 $ARGV[0] =~ s/\"//g;
89 $ARGV[1] =~ s/\"//g;
90 $ARGV[2] =~ s/\"//g;
91 $ARGV[3] =~ s/\"//g;
92 chop($ARGV[0]);
93 chop($ARGV[1]);
94 chop($ARGV[2]);
95 chop($ARGV[3]);
98 if ( ! ( ($#ARGV >= 4) && $ARGV[0] && $ARGV[1] && $ARGV[2] && $ARGV[3] && (-d $ARGV[3]) && $ARGV[4] ) ) {
99 print "Usage: config <basispath> <brandpath> <userinstallpath> <datapath> <buildid>\n" ;
100 exit(1);
103 $basisdir = $ARGV[0];
104 $branddir = $ARGV[1];
105 $userinstalldir = $ARGV[2];
106 $datapath = $ARGV[3];
107 $buildid = $ARGV[4];
109 $fullquickstart_path = $branddir . "program" . $pathslash . "quickstart.exe";
111 print "patching config ... \n";
112 if (!-d "$userinstalldir$User_Office_Path") {
113 mkpath("$userinstalldir$User_Office_Path", 0, 0777);
115 if (!-d "$userinstalldir$OOoImprovement_Path") {
116 mkpath("$userinstalldir$OOoImprovement_Path", 0, 0777);
119 # copy Common.xcu
120 print "Patching Common.xcu\n" if $is_debug;
121 PatchCommonXcu($buildid);
122 print "cp $inpath_Common_XCU $userinstalldir$User_Office_Path$common_XML\n" if $is_debug;
123 copy ("$inpath_Common_XCU", "$userinstalldir$User_Office_Path$common_XML");
125 # copy OOoImprovement/Settings.xcu
127 print "cp $datapath$oooimprovement_XML $userinstalldir$OOoImprovement_Path$oooimprovement_XML\n" if $is_debug;
128 copy ("$datapath$oooimprovement_XML", "$userinstalldir$OOoImprovement_Path$oooimprovement_XML");
130 # copy Setup.xcu
132 print "cp $datapath$setup_XML $userinstalldir$User_Path$setup_XML\n" if $is_debug;
133 copy ("$datapath$setup_XML", "$userinstalldir$User_Path$setup_XML");
136 # quickstarter loeschen
137 if ($gui ne "UNX") {
138 print "kill $fullquickstart_path \n";
139 unlink( $fullquickstart_path ) or die "cannot unlink $fullquickstart_path";
142 #delete joblist
143 $fullsource_path = $basisdir . $jobs_XML_Path;
144 unlink ($fullsource_path);
146 exit(0);
148 ############################################################################
149 sub PatchCommonXcu #17.04.2009 10:37
150 ############################################################################
152 my $buildid = shift;
153 open(INFILE, "< $datapath$common_XML") || die "Can't open $datapath$common_XML (read)\n";
154 open(OUTFILE, "> $inpath_Common_XCU") || die "Can't open $inpath_Common_XCU (write)\n";
155 my $patch_next_line = 0;
156 my $value = "<value>Patch" . $buildid . "</value>\n";
157 while ( $line = <INFILE> ) {
158 if ( $patch_next_line ) {
159 print OUTFILE " $value";
160 $patch_next_line = 0;
161 } else
163 print OUTFILE $line;
165 if ( $line =~ /ReminderDate/ ) {
166 $patch_next_line = 1;
169 close(INFILE);
170 close(OUTFILE);
171 } ##PatchCommonXcu