1 package ConvwatchHelper
;
17 our ($VERSION, @ISA, @EXPORT, @EXPORT_OK, %EXPORT_TAGS);
20 # if using RCS/CVS, this may be preferred
21 $VERSION = do { my @r = (q
$Revision: 1.39 $ =~ /\d+/g); sprintf "%d."."%02d" x
$#r, @r }; # must be all one line, for MakeMaker
23 @EXPORT = qw(&getQADEVToolsPath &setProjectRoot &getProjectRoot &checkForStop &getSofficeExe &setINPATH);
24 %EXPORT_TAGS = ( ); # eg: TAG => [ qw!name1 name2! ],
25 # your exported package globals go here,
26 # as well as any optionally exported functions
27 @EXPORT_OK = ( ); # qw($Var1 %Hashit &func3);
30 # ------------------------------------------------------------------------------
38 # if ($OSNAME eq "MSWin32" || $OSNAME eq "cygwin")
40 # # $tempdir = "C:/gfxcmp/temp";
41 # $tempprefix = "//so-gfxcmp-lin/gfxcmp-data/wntmsci/temp";
43 # elsif ($OSNAME eq "linux")
45 # $tempprefix = "/net/so-gfxcmp-lin/export/gfxcmp/data/unxlngi/temp";
47 # elsif ($OSNAME eq "solaris")
49 # # $tempdir = "/space/gfxcmp/temp";
50 # $tempprefix = "/net/so-gfxcmp-lin/export/gfxcmp/data/unxsoli/temp";
54 # print "Error: This environment isn't supported yet.\n";
58 # $sTempDir = $tempprefix;
61 # ------------------------------------------------------------------------------
65 # sub getProgramPrefix($)
67 # my $sDBDistinct = shift;
70 # if (! $programprefix)
72 # if ($OSNAME eq "MSWin32")
74 # # $programprefix = "C:/gfxcmp/programs";
75 # $programprefix = "C:/gp";
77 # elsif ($OSNAME eq "linux")
79 # $programprefix = "/space/gfxcmp/programs";
81 # elsif ($OSNAME eq "solaris")
83 # $programprefix = "/space/gfxcmp/programs";
87 # print "Error: This environment isn't supported yet.\n";
91 # $sProgramPrefix = appendPath($programprefix, substr($sDBDistinct, 0, 19));
92 # return $sProgramPrefix;
94 # ------------------------------------------------------------------------------
95 sub getQADEVToolsPath
()
97 my $sNewPath = appendPath
(getToolsPrefix
(), "qadev");
98 $sNewPath = appendPath
($sNewPath, "scripts");
99 $sNewPath = appendPath
($sNewPath, "gfxcmp_ui");
106 # sub getToolsPrefix()
109 # if (! $toolsprefix)
111 # if ($OSNAME eq "MSWin32")
113 # $toolsprefix = "C:/gfxcmp/tools";
115 # elsif ($OSNAME eq "linux")
117 # $toolsprefix = "/space/gfxcmp/tools";
119 # elsif ($OSNAME eq "solaris")
121 # $toolsprefix = "/space/gfxcmp/tools";
125 # print "Error: This environment isn't supported yet.\n";
129 # $sToolsPrefix = $toolsprefix;
130 # return $sToolsPrefix;
132 # ------------------------------------------------------------------------------
134 sub setProjectRoot
($)
136 $sProjectRoot = shift;
137 log_print
"\$sProjectRoot := $sProjectRoot\n";
143 return $sProjectRoot;
145 die "setProjectRoot(PATH) not set.\n";
159 die "setINPATH(PATH) not set.\n";
163 # sub getDataPrefix()
168 # if ($OSNAME eq "MSWin32" || $OSNAME eq "cygwin")
170 # # $dataprefix = "C:/gfxcmp/data";
171 # # $dataprefix = "//so-gfxcmp-lin/gfxcmp-data/wntmsci";
172 # $dataprefix = getProjectRoot();
174 # elsif ($OSNAME eq "linux")
176 # # $dataprefix = "/space/gfxcmp/data";
177 # # $dataprefix = "/net/so-gfxcmp-lin/export/gfxcmp/data/unxlngi";
178 # $dataprefix = getProjectRoot();
180 # elsif ($OSNAME eq "solaris")
182 # # $dataprefix = "/space/gfxcmp/data";
183 # # $dataprefix = "/net/so-gfxcmp-lin/export/gfxcmp/data/unxsoli";
184 # $dataprefix = getProjectRoot();
188 # print "Error: This environment isn't supported yet.\n";
191 # $dataprefix = appendPath(getProjectRoot(), getINPATH());
192 # $dataprefix = appendPath($dataprefix, "data");
194 # $sDataPrefix = $dataprefix;
195 # return $sDataPrefix;
198 # ------------------------------------------------------------------------------
203 # select(undef, undef, undef, 0.333);
206 # sub _waitInSeconds($)
208 # my $nLength = shift;
212 # for ($j=0;$j<$nLength;$j++)
214 # for ($i=0;$i<$j;$i++)
218 # for ($i=$j;$i<$nLength;$i++)
226 # for ($j=0;$j<=$nLength;$j++)
228 # for ($i=0;$i<$j;$i++)
232 # for ($i=$j;$i<$nLength;$i++)
241 # sub wait30seconds()
243 # _waitInSeconds(20);
244 # _waitInSeconds(20);
249 my $sStopFilename = shift;
251 if ($OSNAME eq "MSWin32")
253 $sStopFilePath = "C:/temp/";
257 $sStopFilePath = "/tmp/";
259 my $sStopFile = $sStopFilePath . $sStopFilename;
260 if ( -e
"$sStopFile" )
262 print "Stop of Convwatch tool forced!\n";
268 # ----------------------------------------------------------------------------------------
269 sub readdirectory
($$$);
271 sub readdirectory
($$$)
273 my $startdir = shift;
274 my $sUserParameter = shift;
284 if (opendir (DIR
, $startdir)) # Directory oeffnen
286 while ($myfile = readdir(DIR
))
287 { # ein filename holen
288 #if (! -l $myfile) # not a link
290 if (-d
$myfile ) # is a directory
296 # if ( $myfile eq "help" ||
297 # $myfile eq "presets" ||
298 # $myfile eq "registry" ||
299 # $myfile eq "uno_packages" ||
300 # $myfile eq "lib" ||
301 # $myfile eq "user_tree" )
306 if ($myfile ne "." && $myfile ne "..")
308 my $sNewStartDir = appendPath
($startdir, $myfile); # neuen Directorystring erstellen
309 # if ($sNewStartDir =~ "^\/proc" ||
310 # $sNewStartDir =~ "^\/dev" ||
311 # $sNewStartDir =~ "^\/udev" ||
312 # $sNewStartDir =~ "lost+found" )
316 # my $sNewSUserParameter = $sUserParameter . $myfile ."/";
317 # do a recursive call
319 my $nFileCount = readdirectory
($sNewStartDir, $sUserParameter, $hook);
320 # workOnDir($sNewDir, $nFileCount);
321 $nCountFiles += $nFileCount;
323 chdir ($startdir); # zurueckwechseln.
329 # File must exist, be a regular file and must not be the $onlyOnFile
332 # print STDERR " $startdir" . "$myfile\n";
334 # workOnFile($startdir, $myfile, $destdir);
335 $hook->($startdir, $myfile, $sUserParameter);
341 # print STDERR "linked file: $dir/$myfile\n";
348 print STDERR
"could not open $startdir\n";
353 our $lcl_sSofficeBinPath;
354 our $lcl_sSofficeBinName;
356 sub searchSofficeBin
($$$)
358 my $currentDir = shift;
359 my $currentFile = shift;
360 my $sUserParameter = shift;
362 if ($currentFile eq $sUserParameter)
365 $sSourceFilename = appendPath
($currentDir, $currentFile);
367 if ( -e
"$sSourceFilename" )
369 $lcl_sSofficeBinPath = $currentDir;
370 $lcl_sSofficeBinName = $currentFile;
375 # our $lcl_sUnoPkgPath;
377 # sub searchUnoPkgBin($$$)
379 # my $currentDir = shift;
380 # my $currentFile = shift;
381 # my $sUserParameter = shift;
383 # if ($currentFile eq $sUserParameter)
385 # my $sSourceFilename;
386 # $sSourceFilename = appendPath($currentDir, $currentFile);
387 # if ( -e "$sSourceFilename" )
389 # $lcl_sUnoPkgPath = $currentDir;
396 # sub searchJARFile($$$)
398 # my $currentDir = shift;
399 # my $currentFile = shift;
400 # my $sUserParameter = shift;
402 # if ($currentFile eq $sUserParameter)
404 # my $sSourceFilename;
405 # $sSourceFilename = appendPath($currentDir, $currentFile);
406 # if ( -e "$sSourceFilename" )
408 # $lcl_sJARPath = $currentDir;
413 # return the PATH, where the file was found
414 # sub searchForJAR($$)
416 # my $sPathToInstallOffice = shift;
417 # my $sJARFileName = shift;
419 # my $sCurrentPath = cwd();
421 # $lcl_sJARPath = "";
422 # readdirectory(${sPathToInstallOffice}, ${sJARFileName}, \&searchJARFile);
424 # chdir $sCurrentPath;
427 # return $lcl_sJARPath;
432 # my $sPathToInstallOffice = shift;
434 # my $sUnoPkgName = "unopkg.bin";
435 # if (isWindowsEnvironment())
437 # $sUnoPkgName = "unopkg.exe";
440 # my $sCurrentPath = cwd();
442 # $lcl_sUnoPkgPath = "";
443 # readdirectory(${sPathToInstallOffice}, ${sUnoPkgName}, \&searchUnoPkgBin);
445 # chdir $sCurrentPath;
448 # return ($lcl_sUnoPkgPath, $sUnoPkgName);
453 my $sPathToOffice = shift;
455 my $sSofficeExeName = "soffice";
456 if (isWindowsEnvironment
())
458 $sSofficeExeName = "soffice.exe";
461 my $sCurrentPath = cwd
();
463 $lcl_sSofficeBinPath = "";
464 $lcl_sSofficeBinName = "";
465 readdirectory
(${sPathToOffice
}, ${sSofficeExeName
}, \
&searchSofficeBin
);
470 return ($lcl_sSofficeBinPath, $lcl_sSofficeBinName);
473 # sub checkOfficeAlreadyInstalled($)
475 # my $sOfficePath = shift;
477 # my $sCurrentPath = cwd();
479 # $lcl_sSofficeBinPath = "";
480 # my $sOldOfficePath = appendPath($sOfficePath, "program");
481 # if ( -d "$sOldOfficePath" )
483 # $sOldOfficePath = appendPath($sOldOfficePath, "soffice.bin");
484 # if ( -e $sOldOfficePath )
491 # if (isWindowsEnvironment())
493 # my $sThreeLayerOffice = appendPath($sOfficePath, "Sun");
494 # $sThreeLayerOffice = appendPath($sThreeLayerOffice, "StarOffice 9");
495 # $sThreeLayerOffice = appendPath($sThreeLayerOffice, "program");
496 # $sThreeLayerOffice = appendPath($sThreeLayerOffice, "soffice.bin");
498 # if ( -e "$sThreeLayerOffice" )
505 # my $sThreeLayerOffice = appendPath($sOfficePath, "staroffice9");
506 # $sThreeLayerOffice = appendPath($sThreeLayerOffice, "program");
507 # $sThreeLayerOffice = appendPath($sThreeLayerOffice, "soffice.bin");
508 # if ( -e "$sThreeLayerOffice" )
515 # # soffice.bin not found in fast path
516 # readdirectory($sOfficePath, "soffice.bin", \&searchSofficeBin);
517 # chdir $sCurrentPath;
520 # if ( $lcl_sSofficeBinPath ne "" )
525 # # this is the old check
526 # # my $sOfficePathCheck = appendPath(${sPathToInstallOffice}, "program");
527 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "soffice.bin");
528 # # if ( -e $sOfficePathCheck )
533 # # # check path system of tree layer office
534 # # if ( isWindowsEnvironment() )
536 # # $sOfficePathCheck = appendPath(${sPathToInstallOffice}, "Sun");
537 # # if ( ! -e $sOfficePathCheck)
539 # # # could be an OpenOffice.org
545 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "StarOffice 9");
546 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "program");
547 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "soffice.bin");
548 # # if ( -e $sOfficePathCheck )
552 # # print "Error: There exist no Office, maybe an unsupported version?\n";
555 # # elsif ( isUnixEnvironment() )
557 # # $sOfficePathCheck = appendPath(${sPathToInstallOffice}, "staroffice9");
558 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "staroffice9");
559 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "program");
560 # # $sOfficePathCheck = appendPath($sOfficePathCheck, "soffice.bin");
561 # # if ( -e $sOfficePathCheck )
565 # # print "Error: There exist no Office, maybe an unsupported version?\n";
569 # # print "Error: There exist no Office, maybe an unsupported version?\n";