From e640cd59ea191e82102865ff9729adc070fea293 Mon Sep 17 00:00:00 2001 From: David Tardon Date: Sun, 21 Apr 2013 15:08:23 +0200 Subject: allow odk/util/check.pl to use two base dirs This is in preparation for my plan to move stuff out of odkcommon.zip and install it using filelists. The moved files will be in $(INSTDIR)/sdk, not in the Zip's workdir, so we must look for them in both places. Change-Id: I7dd224c9067f2dbb522b87b7057ddc02a5fa0cad Reviewed-on: https://gerrit.libreoffice.org/3527 Reviewed-by: Fridrich Strba Tested-by: Fridrich Strba --- odk/util/check.pl | 121 ++++++++++++++++++++++++++++++------------------------ 1 file changed, 67 insertions(+), 54 deletions(-) (limited to 'odk/util/check.pl') diff --git a/odk/util/check.pl b/odk/util/check.pl index 5c57cbc98257..738086794fe6 100644 --- a/odk/util/check.pl +++ b/odk/util/check.pl @@ -23,16 +23,29 @@ $return = 0; -$StartDir = "$ARGV[0]"; -$OperatingSystem = "$ARGV[1]"; -$ExePrefix = "$ARGV[2]"; +$PrimaryDir = "$ARGV[0]"; +$SecondaryDir = "$ARGV[1]"; +$OperatingSystem = "$ARGV[2]"; +$ExePrefix = "$ARGV[3]"; + +sub check_file +{ + my ($file) = @_; + return -e "$PrimaryDir/$file" || -e "$SecondaryDir/$file"; +} + +sub check_dir +{ + my ($dir) = @_; + return -d "$PrimaryDir/$dir" || -d "$SecondaryDir/$dir"; +} print "Check for $OperatingSystem\n"; -if (-d "$StartDir") { +if (-d "$PrimaryDir" || -d "$SecondaryDir") { # check binaries print "check binaries: "; - if (-d "$StartDir/bin") { + if (check_dir("bin")) { my @binarylist = ( "idlc","cppumaker","javamaker", "regcompare","autodoc", "unoapploader", "uno-skeletonmaker" ); @@ -42,26 +55,26 @@ if (-d "$StartDir") { foreach $i (@binarylist) { - if (! -e "$StartDir/bin/$i$ExePrefix") { + if (!check_file("bin/$i$ExePrefix")) { $return++; - print "\nERROR: \"$StartDir/bin/$i$ExePrefix\" is missing\n"; + print "\nERROR: \"bin/$i$ExePrefix\" is missing\n"; } else { print "+"; } } if ($OperatingSystem eq "windows" || $OperatingSystem eq "mingw") { - if ($OperatingSystem eq "windows" && ! -e "$StartDir/bin/climaker.exe") { + if ($OperatingSystem eq "windows" && !check_file("bin/climaker.exe")) { $return++; - print "\nERROR: \"$StartDir/bin/climaker.exe\" is missing\n"; + print "\nERROR: \"bin/climaker.exe\" is missing\n"; } else { print "+"; } } if ($OperatingSystem eq "macosx") { - if (! -e "$StartDir/bin/addsym-macosx.sh") { + if (!check_file("bin/addsym-macosx.sh")) { $return++; - print "\nERROR: \"$StartDir/bin/addsym-macosx.sh\" is missing\n"; + print "\nERROR: \"bin/addsym-macosx.sh\" is missing\n"; } else { print "+"; } @@ -73,7 +86,7 @@ if (-d "$StartDir") { # packaging files print "check packaging files: "; - if (-d "$StartDir/docs") { + if (check_dir("docs")) { my @filelist = ( "install.html", "notsupported.html","sdk_styles.css","tools.html", "images/arrow-1.gif", "images/arrow-3.gif", @@ -90,9 +103,9 @@ if (-d "$StartDir") { foreach $i (@filelist) { - if (! -e "$StartDir/docs/$i") { + if (!check_file("docs/$i")) { $return++; - print "\nERROR: \"$StartDir/docs/$i\" is missing\n"; + print "\nERROR: \"docs/$i\" is missing\n"; } else { print "+"; } @@ -105,37 +118,37 @@ if (-d "$StartDir") { #check configure files print "check config files: "; if ($OperatingSystem eq "windows" || $OperatingSystem eq "mingw") { - if (! -e "$StartDir/setsdkenv_windows.bat") { - print "\nERROR: \"$StartDir/setsdkenv_windows.bat\" is missing\n"; + if (!check_file("setsdkenv_windows.bat")) { + print "\nERROR: \"setsdkenv_windows.bat\" is missing\n"; $return++; } - if (! -e "$StartDir/setsdkenv_windows.template") { - print "\nERROR: \"$StartDir/setsdkenv_windows.template\" is missing\n"; + if (!check_file("setsdkenv_windows.template")) { + print "\nERROR: \"setsdkenv_windows.template\" is missing\n"; $return++; } - if (! -e "$StartDir/cfgWin.js") { - print "\nERROR: \"$StartDir/cfgWin.js\" is missing\n"; + if (!check_file("cfgWin.js")) { + print "\nERROR: \"cfgWin.js\" is missing\n"; $return++; } } else { - if (! -e "$StartDir/configure.pl") { - print "\nERROR: \"$StartDir/configure.pl\" is missing\n"; + if (!check_file("configure.pl")) { + print "\nERROR: \"configure.pl\" is missing\n"; $return++; } - if (! -e "$StartDir/config.guess") { - print "\nERROR: \"$StartDir/config.guess\" is missing\n"; + if (!check_file("config.guess")) { + print "\nERROR: \"config.guess\" is missing\n"; $return++; } - if (! -e "$StartDir/config.sub") { - print "\nERROR: \"$StartDir/config.sub\" is missing\n"; + if (!check_file("config.sub")) { + print "\nERROR: \"config.sub\" is missing\n"; $return++; } - if (! -e "$StartDir/setsdkenv_unix") { - print "\nERROR: \"$StartDir/setsdkenv_unix\" is missing\n"; + if (!check_file("setsdkenv_unix")) { + print "\nERROR: \"setsdkenv_unix\" is missing\n"; $return++; } - if (! -e "$StartDir/setsdkenv_unix.sh.in") { - print "\nERROR: \"$StartDir/setsdkenv_unix.sh.in\" is missing\n"; + if (!check_file("setsdkenv_unix.sh.in")) { + print "\nERROR: \"setsdkenv_unix.sh.in\" is missing\n"; $return++; } } @@ -143,17 +156,17 @@ if (-d "$StartDir") { #check setting files print "check setting files: "; - if (-d "$StartDir/settings") { - if (! -e "$StartDir/settings/settings.mk") { - print "\nERROR: \"$StartDir/settings/settings.mk\" is missing\n"; + if (check_dir("settings")) { + if (!check_file("settings/settings.mk")) { + print "\nERROR: \"settings/settings.mk\" is missing\n"; $return++; } - if (! -e "$StartDir/settings/std.mk") { - print "\nERROR: \"$StartDir/settings/std.mk\" is missing\n"; + if (!check_file("settings/std.mk")) { + print "\nERROR: \"settings/std.mk\" is missing\n"; $return++; } - if (! -e "$StartDir/settings/stdtarget.mk") { - print "\nERROR: \"$StartDir/settings/stdtarget.mk\" is missing\n"; + if (!check_file("settings/stdtarget.mk")) { + print "\nERROR: \"settings/stdtarget.mk\" is missing\n"; $return++; } } else { @@ -165,9 +178,9 @@ if (-d "$StartDir") { # improvement required if ($ENV{'DOXYGEN'} ne '') { print "check cpp docu: "; - if (-d "$StartDir/docs/cpp/ref") { - if (! -e "$StartDir/docs/cpp/ref/index.html") { - print "\nERROR: \"$StartDir/docs/cpp/ref/index.html\" is missing\n"; + if (check_dir("docs/cpp/ref")) { + if (!check_file("docs/cpp/ref/index.html")) { + print "\nERROR: \"docs/cpp/ref/index.html\" is missing\n"; $return++; } } else { @@ -182,9 +195,9 @@ if (-d "$StartDir") { my $JDK = $ENV{"JDK"}; if (defined($solar_java) && $solar_java ne "" && (!defined($JDK) || $JDK ne "gcj")) { print "check java docu: "; - if (-d "$StartDir/docs/java/ref") { - if (! -e "$StartDir/docs/java/ref/index.html") { - print "\nERROR: \"$StartDir/docs/java/ref/index.html\" is missing\n"; + if (check_dir("docs/java/ref")) { + if (!check_file("docs/java/ref/index.html")) { + print "\nERROR: \"docs/java/ref/index.html\" is missing\n"; $return++; } @@ -194,9 +207,9 @@ if (-d "$StartDir") { foreach $i (@dir_list) { - if (! -d "$StartDir/docs/java/ref/com/sun/star/$i") { + if (!check_dir("docs/java/ref/com/sun/star/$i")) { $return++; - print "\nERROR: \"$StartDir/docs/java/ref/com/sun/star/$i\" is missing\n"; + print "\nERROR: \"docs/java/ref/com/sun/star/$i\" is missing\n"; } else { print "+"; } @@ -210,17 +223,17 @@ if (-d "$StartDir") { #check idl docu, it is only a first and simple check # improvement required print "check idl docu: "; - if (-d "$StartDir/docs/common/ref") { - if (! -e "$StartDir/docs/common/ref/module-ix.html") { - print "\nERROR: \"$StartDir/docs/common/ref/module-ix.html\" is missing\n"; + if (check_dir("docs/common/ref")) { + if (!check_file("docs/common/ref/module-ix.html")) { + print "\nERROR: \"docs/common/ref/module-ix.html\" is missing\n"; $return++; } - if (! -d "$StartDir/docs/common/ref/index-files") { - print "\nERROR: \"$StartDir/docs/common/ref/index-files\" is missing\n"; + if (!check_dir("docs/common/ref/index-files")) { + print "\nERROR: \"docs/common/ref/index-files\" is missing\n"; $return++; } - if (! -e "$StartDir/docs/common/ref/index-files/index-10.html") { - print "\nERROR: \"$StartDir/docs/common/ref/index-files/index-10.html\" is missing\n"; + if (!check_file("docs/common/ref/index-files/index-10.html")) { + print "\nERROR: \"docs/common/ref/index-files/index-10.html\" is missing\n"; $return++; } @@ -335,9 +348,9 @@ if (-d "$StartDir") { foreach $i (@idl_dirlist) { - if (! -d "$StartDir/docs/common/ref/com/sun/star/$i") { + if (!check_dir("docs/common/ref/com/sun/star/$i")) { $return++; - print "\nERROR: \"$StartDir/docs/common/ref/com/sun/star/$i\" is missing\n"; + print "\nERROR: \"docs/common/ref/com/sun/star/$i\" is missing\n"; } else { print "+"; } -- cgit