diff options
Diffstat (limited to 'solenv/bin')
38 files changed, 1168 insertions, 2187 deletions
diff --git a/solenv/bin/addsym.awk b/solenv/bin/addsym.awk index c7b02e15db35..52efcb4ab740 100644 --- a/solenv/bin/addsym.awk +++ b/solenv/bin/addsym.awk @@ -25,29 +25,17 @@ # #************************************************************************* -# Add symbol patterns _ZTI* and _ZTS* to the global section of version UDK_3_0_0 -# (and if that version is not yet present, add it). For C++ exception handling -# to work across libraries, it is important that all libraries use those symbols -# with the same version name. -# -# The below code fails with 'perverted' mapfiles (using a strange line layout, -# or containing version UDK_3_0_0 without a global section, ...). +# Add certain symbol patterns to the first global section. BEGIN { state = 0 } -END { - if (state == 0) { - print "# Weak RTTI symbols for C++ exceptions:" - print "UDK_3_0_0 {" - print "\tglobal:" - print "\t_ZTI*; _ZTS*;" - print "};" - } -} +/\{/ && state == 1 { exit 1 } #TODO: print error explanation to stderr? +/^[\t ]*UDK_3_0_0[\t ]*\{/ && state == 0 { state = 1 } +/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 } +{ print } state == 2 { - print " _ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions" + print "_ZTI*; _ZTS*; # weak RTTI symbols for C++ exceptions" + if (ENVIRON["USE_SYSTEM_STL"] != "YES") + print "_ZN4_STL7num_put*; # for STLport" state = 3 } -# #i66636# - ??? -/^[\t ]*UDK_3_0_0[\t ]*\{/ { state = 1 } -/^[\t ]*global[\t ]*:/ && state == 1 { state = 2 } -{ print } +END { if (state != 3) exit 1 } #TODO: print error explanation to stderr? diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 5775468d0ead..442dcba26946 100755 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -342,102 +342,19 @@ sub rename_file { }; sub generate_config_file { - my $source_config = SourceConfig -> new(); - $source_config_file = $source_config->get_config_file_path(); - my $temp_config_file = File::Temp::tmpnam($ENV{TMP}); - my @config_content_new = (); - my $addition_message; - my $removal_message; - my %present_modules = (); - if ($source_config_file) { - open(SOURCE_CONFIG_FILE, $source_config_file); - my @config_content = <SOURCE_CONFIG_FILE>; - close SOURCE_CONFIG_FILE; - my ($module_section, $repository_section); - foreach (@config_content) { - if ((!/^\S+/)||(/^\s*#+/)) { - push(@config_content_new, $_); - next; - } - if (/^\[repositories\]\s*(\s+#)*/) { - if ($module_section) { - $addition_message = add_modules_to_source_config(\%add_to_config, \@config_content_new); - }; - $module_section = 0; - $repository_section = 1; - push(@config_content_new, $_); - next; - }; - if (/^\[modules\]\s*(\s+#)*/) { - $module_section = 1; - $repository_section = 0; - push(@config_content_new, $_); - next; - }; - if ($module_section && /\s*(\S+)=active\s*(\s+#)*/) { - if ($clear_config || defined $remove_from_config{$1}) { - delete $remove_from_config{$1}; - $removal_message .= "$1 "; - } else { - push(@config_content_new, $_); - if (defined $add_to_config{$1} && !$prepare) { - push(@warnings, "Module $1 already activated in $source_config_file\n"); - delete $add_to_config{$1}; - } - }; - } else { - push(@config_content_new, $_); - }; - }; - if (keys %add_to_config) { - if (!$module_section) { - push(@config_content_new, "[modules]\n"); - }; - $addition_message = add_modules_to_source_config(\%add_to_config, \@config_content_new); - }; - } else { - if ($clear_config || scalar %remove_from_config) { - print_error('No source config file found'); - }; - $source_config_file = $source_config->get_config_file_default_path(); - push(@config_content_new, "[modules]\n"); - $addition_message = add_modules_to_source_config(\%add_to_config, \@config_content_new); - }; - die("Cannot open $temp_config_file") if (!open(NEW_CONFIG, ">$temp_config_file")); - print NEW_CONFIG $_ foreach (@config_content_new); - close NEW_CONFIG; - rename_file($temp_config_file, $source_config_file, 1); - foreach (keys %remove_from_config) { - push(@warnings, "Module(s) $_ not found in " . $source_config_file . "\n"); - }; - print_warnings(); - print $addition_message if ($addition_message); - print "Module(s):\n$removal_message\nremoved from $source_config_file\n" if ($removal_message); + my $source_config = SourceConfig->new(); + $source_config->add_active_modules([keys %add_to_config], 1) if (scalar %add_to_config); + $source_config->remove_activated_modules([keys %remove_from_config], 1) if (scalar %remove_from_config); + $source_config->remove_all_activated_modules() if ($clear_config); }; -# -# Add modules from the passed hash to the array of config strigns -# -sub add_modules_to_source_config { - my ($modules_hash_ref, $config_content_new) = @_; - my $message; - foreach (keys %$modules_hash_ref) { - push(@$config_content_new, "$_=active\n"); - $message .= "$_ "; - }; - if ($message) { - return "Module(s):\n" .$message . "\nare added to the " . $source_config_file . "\n\n"; - } else { - return ''; - }; -}; sub start_interactive { $pid = open(HTML_PIPE, "-|"); print "Pipe is open\n"; if ($pid) { # parent - # make file handle non-bloking + # make file handle non-blocking my $flags = ''; fcntl(HTML_PIPE, F_GETFL, $flags); $flags |= O_NONBLOCK; @@ -1675,7 +1592,7 @@ sub get_options { }; sub get_module_and_buildlist_paths { - if ($build_all_parents) { + if ($build_all_parents || $checkparents) { my $source_config = SourceConfig -> new($StandDir); $source_config_file = $source_config->get_config_file_path(); $active_modules{$_}++ foreach ($source_config->get_active_modules()); @@ -2371,7 +2288,9 @@ sub prepare_incompatible_build { @modules_built = keys %$deps_hash; %add_to_config = %$deps_hash; if ($prepare) { - generate_config_file() if ((!defined $ENV{UPDATER}) || (defined $ENV{CWS_WORK_STAMP})); + if ((!defined $ENV{UPDATER}) || (defined $ENV{CWS_WORK_STAMP})) { + SourceConfig->new()->add_active_modules([keys %add_to_config], 0); + } clear_delivered(); } my $old_output_tree = ''; diff --git a/solenv/bin/checkapi b/solenv/bin/checkapi deleted file mode 100755 index f86fcefb93d1..000000000000 --- a/solenv/bin/checkapi +++ /dev/null @@ -1,71 +0,0 @@ -#!/bin/bash - -PS=":" -# cygwin: -if [ "$GUI" = "WNT" ]; then - PS=";" -fi - -JARFOLDER=$SOLARVERSION/$INPATH/bin$UPDMINOREXT -SOLVER_LIB=$SOLARVERSION/$INPATH/lib$UPDMINOREXT - -# it is possible to give an other OOoRunner.jar -if [ -n "$RUNNERJAR" ]; then - myCLASSPATH=$RUNNERJAR -else - myCLASSPATH=$JARFOLDER/OOoRunner.jar -fi - -myCLASSPATH=$myCLASSPATH${PS}${JARFOLDER}/ridl.jar${PS}\ -${JARFOLDER}/unoil.jar${PS}\ -${JARFOLDER}/jurt.jar${PS}\ -${JARFOLDER}/juh.jar${PS}\ -${JARFOLDER}/java_uno.jar - -myCLASSPATH=$myCLASSPATH${PS}\ -/net/unoapi/export/unoapi/bin/mysql.jar${PS}\ -$SOLVER_LIB - -if [ -n "$JAVAI" ]; then - JAVABIN=$JAVAI -elif [ -n "$JAVA_HOME" ]; then - if [ "$OS$CPUNAME$CPU" = SOLARISSPARCU ]; then - JAVABIN=$JAVA_HOME/bin/sparcv9/java - else - JAVABIN=$JAVA_HOME/bin/java - fi -else - # there seems to be some machines without real java - JAVABIN=$(which java) - if [ -z "$JAVABIN" ]; then - echo "please set environment variable JAVA_HOME" - exit 1 - fi -fi - -if [ x${USER}x = xx ]; then - if [ x${LOGNAME}x = xx ]; then - echo "ERROR: could not determine username. Please export variable USER" >&2 - exit $EXIT_FAILURE - else - USER=$LOGNAME - export USER - fi -fi - -PARAM="-cs pipe,name=$USER -SRC_ROOT $SRC_ROOT" - -if [ -n "$RUNNERPROPS" ]; then - PARAM="$PARAM -runnerini $RUNNERPROPS" -fi - -DEBUG_THE_API="" -if [ -n "$DEBUGAPI" ]; then - export DEBUGAPI="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9002,suspend=y" - DEBUG_THE_API=$DEBUGAPI -fi - -COMMAND="$JAVABIN -Xmx120m $DEBUG_THE_API -cp $myCLASSPATH org.openoffice.Runner $PARAM $*" -echo $COMMAND -$COMMAND -# if COMMAND fails, it returns also the exitcode diff --git a/solenv/bin/checkapi.btm b/solenv/bin/checkapi.btm deleted file mode 100644 index 7af444eb601f..000000000000 --- a/solenv/bin/checkapi.btm +++ /dev/null @@ -1,44 +0,0 @@ -@echo off - -setlocal - -SET JARFOLDER=%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT% - -IFF "%RUNNERJAR%" != "" THEN - SET APICLASSPATH=%RUNNERJAR% -ELSE - SET APICLASSPATH=%JARFOLDER%\OOoRunner.jar -ENDIFF - -SET APICLASSPATH=%APICLASSPATH%;%JARFOLDER%\ridl.jar;%JARFOLDER%\unoil.jar;%JARFOLDER%\jurt.jar;%JARFOLDER%\juh.jar;%JARFOLDER%\java_uno.jar;\\unoapi\export\unoapi\bin\mysql.jar - -IFF "%JAVAI%" != "" THEN - SET JAVABIN=%JAVAI% -ELSEIFF "%JAVA_HOME%" != "" THEN - SET JAVABIN=%JAVA_HOME%\bin\java -ELSE - echo please set environment variable JAVA_HOME - exit 1 -ENDIFF - -SET PARAM=-cs pipe,name=%USERNAME% -SRC_ROOT %SRC_ROOT% - -IFF "%RUNNERPROPS%" != "" THEN - SET PARAM=%PARAM% -runnerini %RUNNERPROPS% -ENDIFF - -rem SET MYXDEBUG="" -IFF "%XDEBUG%" != "" THEN - REM SET XDEBUG=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001 - SET MYXDEBUG=%XDEBUG% -ENDIFF - -set COMMAND=%JAVABIN% -Xmx120m %MYXDEBUG% -cp %APICLASSPATH% org.openoffice.Runner %PARAM% %& - - -echo %COMMAND -%COMMAND - -endlocal - -quit diff --git a/solenv/bin/cwscheckapi b/solenv/bin/cwscheckapi deleted file mode 100755 index 63712be76623..000000000000 --- a/solenv/bin/cwscheckapi +++ /dev/null @@ -1,361 +0,0 @@ -#!/bin/bash -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#***********************************************************************/ - - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_ERROR=2 -EXIT_BUG=10 - -# report the given error parameter to cwstestresult if the is one. -# 0: no error send ok or parameter $2 -# 1: failure -# 2...: incomplete -function reportError() -{ - ERRORCODE=$1 - if [ -e $SOLARENV/bin/cwstestresult.pl ]; then - if [ $ERRORCODE -eq 0 ]; then - PT_STATUS=${2:-ok} # use default 'ok' or $2 - elif [ $ERRORCODE -eq 1 ]; then - PT_STATUS=failed - else - PT_STATUS=incomplete - fi - - if [ "$OSTYPE" == "cygwin" ]; then - CWSENV=Windows - elif [ "$OSTYPE" == "linux" ]; then - CWSENV=Linux - elif [ "$OSTYPE" == "solaris" ]; then - CWSENV=SolarisX86 - else - CWSENV=Unknown - fi - perl $SOLARENV/bin/cwstestresult.pl -c $CWS_WORK_STAMP -n CWSCheckAPI -p $CWSENV $PT_STATUS - else - echo "No cwstestresult.pl found." - fi -} - -usage() { - echo "Usage: $SCRIPTNAME [-m MODULE1[,MODULEn]] [-k] [-o] [-h] [-d] [-u] [-t] [-s] [-a]" >&2 - echo "" >&2 - echo "[-m] list of modules to test like: '-m sw,sc,sd' or '-m all' for all modules" >&2 - echo "" >&2 - echo "[-k] keep Office installation, otherwise it will be removed after test" >&2 - echo "" >&2 - echo "[-o] force OpenOffice.org installation instead of StarOffice" >&2 - echo "" >&2 - echo "[-d] debug installation and UnoAPI-Tests" >&2 - # echo "" >&2 - # echo "[-i] debug installation" >&2 - echo "" >&2 - echo "[-t] debug UnoAPI-Tests" >&2 - echo "" >&2 - echo "[-s] skip installation of Office" >&2 - echo "" >&2 - echo "[-a] NoCwsAttach: do not attach UnoAPI-Test result to EIS database" >&2 - echo "" >&2 - echo "[-u] UseInstalledOffice: do not install an office" >&2 - echo "" >&2 - echo "further informations: http://wiki.services.openoffice.org/wiki/Cwscheckapi" >&2 - echo "" >&2 - exit $EXIT_FAILURE -} - -# we start cwscheckapi -reportError 0 running - -if [ "$PROEXT" != ".pro" ]; then - echo "ERROR: cwscheckapi works only on pro-versions" >&2 - reportError 2 - exit $EXIT_FAILURE -fi - -if [ x${USER}x = xx ]; then - if [ x${LOGNAME}x = xx ]; then - echo "ERROR: could not determine username. Please export variable USER" >&2 - reportError 2 - exit $EXIT_FAILURE - else - USER=$LOGNAME - export USER - fi -fi - - - -#DEBUG_I=false -DEBUG_T=false -INSTALL=true -ATTACH=true -MODULES="auto" -OOO=false -KEEPOFFICE=false -USE_INSTALLED_OFFICE=false - -while getopts ':m:dkutsaho' OPTION ; do - case $OPTION in - d) -# DEBUG_I=true - DEBUG_T=true - ;; - m) - MODULES="$OPTARG" - ;; - k) - KEEPOFFICE=true - ;; - o) - OOO=true - ;; -# i) -# DEBUG_I=true -# ;; - t) - DEBUG_T=true - ;; - s) - INSTALL=false - ;; - a) - ATTACH=false - ;; - u) - USE_INSTALLED_OFFICE=true - INSTALL=false - KEEPOFFICE=true - echo "make sure your office is started with parameter -accept=pipe,name=$USER;urp;" - ;; - h) - usage $EXIT_SUCCESS - ;; - \?) - echo "unkown option \"-$OPTARG\"." >&2 - usage $EXIT_ERROR - ;; - *) - echo "this is not possible...">&2 - usage $EXIT_BUG - ;; - esac -done - -shift `expr $OPTIND - 1` - -if [ -d /export/home/$USER ]; then - CWSCHECKAPIPATH=/export/home/$USER/cwscheckapi -else - if [ -w /export/home ]; then - mkdir /export/home/$USER - CWSCHECKAPIPATH=/export/home/$USER/cwscheckapi - else - CWSCHECKAPIPATH=/tmp/$USER/cwscheckapi - fi -fi - -# the following line is to cleanup old cwscheckapi-installations. It results form the first version of cwscheckapi -# The disk space on /tmp is limited. If a lot of users run cwscheckapi a lot of installed offices are in /tmp -# The new concept is to remove the offices after test. But old unused installations should be removed... -if [ $CWSCHECKAPIPATH != /tmp/$USER/cwscheckapi ]; then - rm -rf /tmp/$USER/cwscheckapi -fi - -LOCALINSTALLDIR=$CWSCHECKAPIPATH/office -LOCALUNPACKDIR=$CWSCHECKAPIPATH/unpack -export LOCALINSTALLDIR -export LOCALUNPACKDIR - -unset FORCE2ARCHIVE - -if [ $INSTALL = true ]; then - - date 2>&1 - -# if [ $DEBUG_I = true ]; then -# echo "start installation: `date`" -# echo call "$SOLARENV/bin/installoffice.pl -cwscheckapi true -dest $LOCALINSTALLDIR -debug $DEBUG_I" -# fi - perl -w $SOLARENV/bin/installoffice.pl -cwscheckapi true -dest $LOCALINSTALLDIR -ooo $OOO -debug $DEBUG_I - - EXITVAL=$? - - if [ $EXITVAL -ne 0 ]; then - echo "ERROR: could not install office" - reportError 2 - exit $EXITVAL - fi - echo "`date` installation successfull, start testing...." -fi - -SOFFICE="soffice" -PS=":" -CYGWIN="" - -SHELL="/bin/bash" -# cygwin: -if [ "$GUI" = "WNT" ]; then - SOFFICE="soffice.exe" - PS=";" - CYGWIN="-Cygwin true" - SHELL=$(which bash) - SHELL=$(cygpath -w $SHELL) - if [ ! -f $SHELL ]; then - echo "could not determine bash shell" - reportError 2 - exit 1 - fi -fi - -# if [ $DEBUG_T = true ]; then -# echo find $LOCALINSTALLDIR -name $SOFFICE -# fi - -if [ $USE_INSTALLED_OFFICE = false ]; then - - OFFICEBIN=`find $LOCALINSTALLDIR -name $SOFFICE` - - if [ ! -f "$OFFICEBIN" ]; then - echo "could not find 'soffice' in subfolders of $LOCALINSTALLDIR" - reportError 2 - exit 1 - fi - - if [ "$GUI" = "WNT" ]; then - # transform /tmp/... -> c:\tmp\... - OFFICEBIN=`cygpath -w $OFFICEBIN` - fi -else - OFFICEBIN=$SOFFICE - echo "Use already installed and running office." -fi - -JARFOLDER=$SOLARVERSION/$INPATH/bin$UPDMINOREXT -SOLVER_LIB=$SOLARVERSION/$INPATH/lib$UPDMINOREXT - -myCLASSPATH=${PS}${JARFOLDER}/ridl.jar${PS}\ -${JARFOLDER}/unoil.jar${PS}\ -${JARFOLDER}/jurt.jar${PS}\ -${JARFOLDER}/juh.jar${PS}\ -${JARFOLDER}/java_uno.jar - -myCLASSPATH=$myCLASSPATH${PS}\ -${JARFOLDER}/OOoRunner.jar - -myCLASSPATH=$myCLASSPATH${PS}\ -/net/unoapi/export/unoapi/bin/mysql.jar${PS}\ -$SOLVER_LIB - -PARAM="" -if [ -n "$JAVAI" ]; then - JAVABIN=$JAVAI -elif [ -n "$JAVA_HOME" ]; then - if [ "$OS$CPUNAME$CPU" = SOLARISSPARCU ]; then - JAVABIN=$JAVA_HOME/bin/sparcv9/java - else - JAVABIN=$JAVA_HOME/bin/java - fi -else - echo "please set environment variable JAVA_HOME" - reportError 2 - exit 1 -fi - -if [ -n "$WORK_STAMP" ]; then - if [ -n "$CWS_WORK_STAMP" ]; then - PARAM="$PARAM -Version cws_${CWS_WORK_STAMP}" - else - echo "######" - echo CAUTION! You are working on the MWS - echo "######" - PARAM="$PARAM -Version ${WORK_STAMP}_${UPDMINOR}" - fi -fi - -PARAM="$PARAM -cmd '$OFFICEBIN -nofirststartwizard -accept=pipe,name=$USER;urp; -norestore -nocrashreport -nolockcheck -enableautomation'" -PARAM="$PARAM -cs pipe,name=$USER" -PARAM="$PARAM -NoOffice true" -PARAM="$PARAM -SRC_ROOT $SRC_ROOT" -PARAM="$PARAM -COMP_ENV $OUTPATH" -PARAM="$PARAM -Shell $SHELL" -PARAM="$PARAM $CYGWIN" -PARAM="$PARAM -tb java_complex" -PARAM="$PARAM -TimeOut 90000" -PARAM="$PARAM -o complex.unoapi.CheckModuleAPI::module($MODULES)" -if [ $ATTACH = false ]; then - PARAM="$PARAM -nca true" -fi -if [ $DEBUG_T = true ]; then - PARAM="$PARAM -debug true -log true" -fi - -# Sample command -# /so/env/Linux_JDK_1.5.0_06/bin/java -# -Xmx120m $XDEBUG -# -cp :/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/ridl.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/unoil.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/jurt.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/juh.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/java_uno.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/bin.m50/OOoRunner.jar:/net/unoapi/export/unoapi/bin/mysql.jar:/net/so-cwsserv02/export/cws/unoapi04/DEV300/unxlngi6.pro/lib.m50 -# org.openoffice.Runner -# -Version cws_unoapi04 -# -cmd '/tmp/ll93751/cwscheckapi/office/staroffice9/program/soffice -nofirststartwizard -accept=pipe,name=ll93751;urp; -norestore -nocrashreport -nolockcheck -enableautomation' -# -cs pipe,name=ll93751 -# -NoOffice true -# -SRC_ROOT /net/so-cwsserv02/export/cws/unoapi04/DEV300/src.m50 -# -COMP_ENV unxlngi6 -# -Shell /bin/bash -# -tb java_complex -# -TimeOut 90000 -# -o 'complex.unoapi.CheckModuleAPI::module(auto)' - -# XDEBUG=" -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=9003,suspend=y " - -# set DEBUGAPI if you want to debug the checkapi -# DEBUGAPI=t - -COMMAND="$JAVABIN -Xmx120m $XDEBUG -cp $myCLASSPATH org.openoffice.Runner $PARAM $*" -echo "$COMMAND" - -LOGFILE=$CWSCHECKAPIPATH/cwscheckapi.log -$COMMAND | tee $LOGFILE -EXITVAL=$? - -if [ $KEEPOFFICE = false ]; then - echo "remove office instrallation in $LOCALINSTALLDIR..." - rm -rf $LOCALINSTALLDIR -fi - -echo -echo A logfile could be found here: $LOGFILE - -date 2>&1 - -# send the results via cwstestresult.pl to EIS -if [ $EXITVAL -eq 0 ]; then - reportError 0 ok -else - reportError 1 -fi diff --git a/solenv/bin/cwscheckapi.btm b/solenv/bin/cwscheckapi.btm deleted file mode 100755 index 73f8da0e6d39..000000000000 --- a/solenv/bin/cwscheckapi.btm +++ /dev/null @@ -1,206 +0,0 @@ -@echo off -REM ************************************************************************** -REM * -REM * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -REM * -REM * Copyright 2000, 2010 Oracle and/or its affiliates. -REM * -REM * OpenOffice.org - a multi-platform office productivity suite -REM * -REM * This file is part of OpenOffice.org. -REM * -REM * OpenOffice.org is free software: you can redistribute it and/or modify -REM * it under the terms of the GNU Lesser General Public License version 3 -REM * only, as published by the Free Software Foundation. -REM * -REM * OpenOffice.org is distributed in the hope that it will be useful, -REM * but WITHOUT ANY WARRANTY; without even the implied warranty of -REM * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM * GNU Lesser General Public License version 3 for more details -REM * (a copy is included in the LICENSE file that accompanied this code). -REM * -REM * You should have received a copy of the GNU Lesser General Public License -REM * version 3 along with OpenOffice.org. If not, see -REM * <http://www.openoffice.org/license.html> -REM * for a copy of the LGPLv3 License. -REM * -REM ************************************************************************/ - -rem echo on - -call reportErrorCheckAPI.btm 0 running - -iff "%PROEXT" != ".pro" THEN - echo ERROR: cwscheckapi works only on pro-versions >&2 - call reportErrorCheckAPI.btm 2 - quit 1 -endiff - -SET DEBIG_I=false -SET DEBUG_T=false -SET INSTALL=true -SET ATTACH=true -SET MODULES=auto -SET OOO=false -SET KEEPOFFICE=false -SET USE_INSTALLED_OFFICE=false - -for %opt in (%&%) DO ( - if "%opt%" == "-d" (SET DEBUG_I=true ^ SET DEBUG_T=true ^ shift) - if "%opt%" == "-o" (SET OOO=true ^ shift) - if "%opt%" == "-k" (SET KEEPOFFICE=true ^ shift) - if "%opt%" == "-i" (SET DEBUG_I=true ^ shift) - if "%opt%" == "-m" (SET MODULES=%2 ^ shift ^ shift) - if "%opt%" == "-t" (SET DEBUG_T=true ^ shift) - if "%opt%" == "-s" (SET INSTALL=false ^ shift) - if "%opt%" == "-u" (SET USE_INSTALLED_OFFICE=true ^ SET INSTALL=false ^ SET KEEPOFFICE=true ^ shift) - if "%opt%" == "-a" (SET attach=false ^ shift) - if "%opt%" == "-h" goto usage - if "%opt%" == "/h" goto usage -) - -set tmppath=not_set -for %LW in (e:\,d:\,c:\) DO ( - iff NOT ISDIR %tmppath% then - iff ISDIR %LW then - iff ISDIR %LW%temp then - set tmppath=%LW%temp - elseiff ISDIR %LW%tmp then - set tmppath=%LW%tmp - else - mkdir %LW%temp - set tmppath=%LW%temp - endiff - endiff - endiff -) - -SET CWSCHECKAPIPATH=%tmppath%\%USERNAME%\cwscheckapi -SET LOCALINSTALLDIR=%CWSCHECKAPIPATH%\office -SET LOCALUNPACKDIR=%CWSCHECKAPIPATH%\unpack - -iff "%INSTALL%" == "true" THEN - call perl5 %SOLARENV%/bin/installoffice.pl -cwscheckapi true -dest %LOCALINSTALLDIR% -ooo %OOO% -debug %DEBUG_I% - - IFF %? NE 0 THEN - echo ERROR: coud not install office >&2 - call reportErrorCheckAPI.btm 2 - quit %? - ENDIFF -ENDIFF - -setlocal - -IFF %USE_INSTALLED_OFFICE% == "false" then - - SET CWD=%_CWD% - cdd %LOCALINSTALLDIR% - SET ffindtxt="ffind.txt" - ffind /s /f /m soffice.exe > %ffindtxt - SET FindFile=%@FILEOPEN[%ffindtxt%, READ] - SET OfficeBin=%@FILEREAD[%FindFile] - set dummy=%@FILECLOSE[%FindFile] - DEL /q %ffindtxt - cdd %CWD - - IFF NOT EXIST %OFFICEBIN% THEN - echo could not find 'soffice.exe' in subfolders of %OFFICEBIN% >&2 - call reportErrorCheckAPI.btm 2 - quit 1 - ENDIFF -ELSE - SET OFFICEBIN=soffice.exe - echo "Use already installed office." -ENDIFF - -SET JARFOLDER=%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT% -SET MYCLASSPATH=%JARFOLDER%\OOoRunner.jar;%JARFOLDER%\ridl.jar;%JARFOLDER%\unoil.jar;%JARFOLDER%\jurt.jar;%JARFOLDER%\juh.jar;%JARFOLDER%\java_uno.jar - -IFF "%JAVAI%" != "" THEN - SET JAVABIN=%JAVAI% -ELSEIFF "%JAVA_HOME%" != "" THEN - SET JAVABIN=%JAVA_HOME%\bin\java -ELSE - echo please set environment variable JAVA_HOME >&2 - call reportErrorCheckAPI.btm 2 - quit 1 -ENDIFF - -IFF "%CWS_WORK_STAMP%" != "" THEN - SET PARAM=-Version cws_%CWS_WORK_STAMP% -ELSEIFF "%WORK_STAMP%" != "" THEN - echo ###### >&2 - echo CAUTION! You\'re working on the MWS >&2 - echo ###### >&2 - SET PARAM=-Version %WORK_STAMP%_%UPDMINOR% -ELSE - echo ###### >&2 - echo ERROR: could not determine your CWS or MWS version >&2 - echo ###### >&2 - call reportErrorCheckAPI.btm 2 - quit 1 -ENDIFF - -SET KILLCOMMAND="%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT%\kill.exe -9 soffice.bin^%SOLARVERSION%\%INPATH%\bin%UPDMINOREXT%\kill.exe -9 soffice.exe" - -SET PARAM=%PARAM% -cmd '\"%OFFICEBIN%\" -nofirststartwizard -norestore -nocrashreport -nolockcheck -enableautomation -accept=pipe,name=%USERNAME%;urp;' -SET PARAM=%PARAM% -cs pipe,name=%USERNAME% -SET PARAM=%PARAM% -NoOffice true -SET PARAM=%PARAM% -SRC_ROOT %SRC_ROOT% -SET PARAM=%PARAM% -COMP_ENV %OUTPATH% -SET PARAM=%PARAM% -Shell %COMSPEC% -SET PARAM=%PARAM% -tb java_complex -SET PARAM=%PARAM% -o complex.unoapi.CheckModuleAPI::module(%MODULES%) -SET PARAM=%PARAM% -TimeOut 200000 -SET PARAM=%PARAM% -AppKillCommand %KILLCOMMAND% -IF "%ATTACH%" == "false" SET PARAM=%PARAM% -nca true -IF "%DEBUG_T%" == "true" SET PARAM=%PARAM -debug true -log true - -set COMMANDO=%JAVABIN% -Xmx120m -cp %MYCLASSPATH% org.openoffice.Runner %PARAM% %& - -echo %COMMANDO -SET LOGFILE=%CWSCHECKAPIPATH%\cwscheckapi.log -%COMMANDO |& tee %LOGFILE% -set EXITVAL=%? - -IFF %KEEPOFFICE% == "false" THEN - echo remove office instrallation in %LOCALINSTALLDIR%... - DEL /E/F/Q/K/S/X/Y/Z %LOCALINSTALLDIR% -fi - -echo . -echo A logfile could be found here: %LOGFILE% - -IFF %EXITVAL% NE 0 THEN - call reportErrorCheckAPI.btm 1 -ELSE - call reportErrorCheckAPI.btm 0 ok -ENDIFF - -endlocal - -quit 0 - -:usage - echo. - echo Usage: %0% [-m MODULE1[,MODULEn]] [-o] [-k] [-h] [-d] [-i] [-t] [-s] [-a] >&2 - echo. - echo [-m] list of modules to test like: '-m "sw,sc,sd"' or '-m all' for all modules >&2 - echo. >&2 - echo [-o] force OpenOffice.org installation instead of StarOffice >&2 - echo. >&2 - echo [-k] keep Office installation, otherwise it will be removed after test >&2 - echo. >&2 - echo [-d] debug installation and UnoAPI-Tests >&2 - echo. >&2 - echo [-i] debug installation >&2 - echo. >&2 - echo [-t] debug UnoAPI-Tests >&2 - echo. >&2 - echo [-s] skip installation of Office >&2 - echo. >&2 - echo [-a] NoCwsAttach: do not attach UnoAPI-Test result to EIS database >&2 - echo. >&2 - echo further informations: http://wiki.services.openoffice.org/wiki/Cwscheckapi >&2 - echo. >&2 - quit 1 diff --git a/solenv/bin/dbgsv.ini b/solenv/bin/dbgsv.ini new file mode 100644 index 000000000000..006dadf98a40 --- /dev/null +++ b/solenv/bin/dbgsv.ini @@ -0,0 +1,29 @@ +=************************************************************************* += += DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. += += Copyright 2000, 2010 Oracle and/or its affiliates. += += OpenOffice.org - a multi-platform office productivity suite += += This file is part of OpenOffice.org. += += OpenOffice.org is free software: you can redistribute it and/or modify += it under the terms of the GNU Lesser General Public License version 3 += only, as published by the Free Software Foundation. += += OpenOffice.org is distributed in the hope that it will be useful, += but WITHOUT ANY WARRANTY; without even the implied warranty of += MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the += GNU Lesser General Public License version 3 for more details += (a copy is included in the LICENSE file that accompanied this code). += += You should have received a copy of the GNU Lesser General Public License += version 3 along with OpenOffice.org. If not, see += <http://www.openoffice.org/license.html> += for a copy of the LGPLv3 License. += +=***********************************************************************/ + +[output] +error=shell diff --git a/solenv/bin/deliver.pl b/solenv/bin/deliver.pl index 2f642b5b6ed4..b0cb51e3b076 100755 --- a/solenv/bin/deliver.pl +++ b/solenv/bin/deliver.pl @@ -107,9 +107,17 @@ $opt_checkdlst = 0; $delete_common = 1; # for "-delete": if defined delete files from common tree also if ($^O ne 'cygwin') { # iz59477 - cygwin needes a dot "." at the end of filenames to disable - $maybedot = ''; # some .exe transformation magic. + $maybedot = ''; # some .exe transformation magic. } else { - $maybedot = '.'; + my $cygvernum = `uname -r`; + my @cygvernum = split( /\./, $cygvernum); + $cygvernum = shift @cygvernum; + $cygvernum .= shift @cygvernum; + if ( $cygvernum < 17 ) { + $maybedot = '.'; + } else { + $maybedot = ''; # no longer works with cygwin 1.7. other magic below. + } } ($gui = lc($ENV{GUI})) || die "Can't determine 'GUI'. Please set environment.\n"; @@ -828,6 +836,11 @@ sub copy_if_newer sleep $try; $try ++; $success = rename($temp_file, $to); + if ( $^O eq 'cygwin' && $to =~ /\.bin$/) { + # hack to survive automatically added .exe for executables renamed to + # *.bin - will break if there is intentionally a .bin _and_ .bin.exe file. + $success = rename( "$to.exe", $to ) if -f "$to.exe"; + } } if ( $success ) { # handle special packaging of *.dylib files for Mac OS X @@ -1199,17 +1212,15 @@ sub zip_files print "ZIP: updating $zip_file\n" if $opt_verbose; next if ( $opt_check ); + if ( $opt_delete ) { + if ( -e $zip_file ) { + unlink $zip_file or die "Error: can't remove file '$zip_file': $!"; + } + next; + } + local $work_file = ""; - if ( $ext) { - # We are delivering into a minor. Zip files must not contain the - # minor extension, so we have to pre and post process it. - # - # Pre process: add minor extension to path, create working copy in - # temp directory. - $work_file = get_tempfilename() . ".zip"; - die "Error: temp file $work_file already exists" if ( -e $work_file); - zipped_path_extension($zip_file, $work_file, $ext, 1) if ( -e $zip_file ); - } elsif ( $zip_file eq $common_zip_file) { + if ( $zip_file eq $common_zip_file) { # Zip file in common tree: work on uniq copy to avoid collisions $work_file = $zip_file; $work_file =~ s/\.zip$//; @@ -1236,37 +1247,15 @@ sub zip_files # zip content has to be relative to $dest_dir chdir($dest_dir{$zip_file}) or die "Error: cannot chdir into $dest_dir{$zip_file}"; my $this_ref = $list_ref{$zip_file}; - if ( $opt_delete ) { - if ( -e $work_file ) { - open(UNZIP, "unzip -t $work_file 2>&1 |") or die "error opening zip file"; - if ( grep /empty/, (<UNZIP>)) { - close(UNZIP); - unlink $work_file; - next; - } - close(UNZIP); - open(ZIP, "| $zipexe -q -o -d -@ $work_file") or die "error opening zip file"; - foreach $file ( @$this_ref ) { - print "ZIP: removing $file from $platform_zip_file\n" if $is_debug; - print ZIP "$file\n"; - } - close(ZIP); - } - } else { - open(ZIP, "| $zipexe -q -o -u -@ $work_file") or die "error opening zip file"; - foreach $file ( @$this_ref ) { - print "ZIP: adding $file to $zip_file\n" if $is_debug; - print ZIP "$file\n"; - } - close(ZIP); + open(ZIP, "| $zipexe -q -o -u -@ $work_file") or die "error opening zip file"; + foreach $file ( @$this_ref ) { + print "ZIP: adding $file to $zip_file\n" if $is_debug; + print ZIP "$file\n"; } - if ( $ext ) { - # Post process: strip minor from stored path again - zipped_path_extension($work_file, $zip_file, $ext, 0); - if (( -e $work_file ) && ($work_file ne $zip_file)) { - unlink $work_file; - } - } elsif ( $zip_file eq $common_zip_file) { + close(ZIP); + fix_broken_cygwin_created_zips($work_file) if $^O eq "cygwin"; + + if ( $zip_file eq $common_zip_file) { # rename work file back if ( -e $work_file ) { if ( -e $zip_file) { @@ -1290,45 +1279,30 @@ sub zip_files } } -sub zipped_path_extension +sub fix_broken_cygwin_created_zips # add given extension to or strip it from stored path { require Archive::Zip; import Archive::Zip; - my ($from, $to, $extension, $with_ext) = @_; + my $zip_file = shift; $zip = Archive::Zip->new(); - if ( -e $from) { - die 'Error: zip read error' unless $zip->read( $from) == 0; - my $name; - my $newmember; - my $DateTime = 0; - foreach my $member ( $zip->members() ) { - $name = $member->fileName(); - if ( $with_ext ) { - if ( $name !~ m#$extension/# ) { - $name =~ s#^(.*?)/#$1$extension/#o; - } - } else { - $name =~ s#^(.*?)$extension/#$1/#o; - } - $member->fileName( $name ); - if ( $member->lastModTime() ) { - if ( $DateTime < $member->lastModTime() ) { - $DateTime = $member->lastModTime(); - } - } + unless ( $zip->read($work_file) == AZ_OK ) { + die "Error: can't open zip file '$zip_file' to fix broken cygwin file permissions"; + } + my $latest_member_mod_time = 0; + foreach $member ( $zip->members() ) { + my $attributes = $member->unixFileAttributes(); + $attributes &= ~0xFE00; + print $member->fileName() . ": " . sprintf("%lo", $attributes) if $is_debug; + $attributes |= 0x10; # add group write permission + print "-> " . sprintf("%lo", $attributes) . "\n" if $is_debug; + $member->unixFileAttributes($attributes); + if ( $latest_member_mod_time < $member->lastModTime() ) { + $latest_member_mod_time = $member->lastModTime(); } - if ( -e $to ) { - die 'Error: zip write error' unless $zip->overwrite( ) == 0; - File::Copy::move( $from, $to) or die "Error $!: cannot move $from $to"; - } else { - die 'Error: zip write error' unless $zip->writeToFileNamed( $to ) == 0; - } - utime $DateTime, $DateTime, $to; - } else { - die "Error: file $from does not exist" if ( ! $opt_delete); } - return; + die "Error: can't overwrite zip file '$zip_file' for fixing permissions" unless $zip->overwrite() == AZ_OK; + utime($latest_member_mod_time, $latest_member_mod_time, $zip_file); } sub get_tempfilename diff --git a/solenv/bin/installoffice b/solenv/bin/installoffice deleted file mode 100755 index 59ad271ee142..000000000000 --- a/solenv/bin/installoffice +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/bash -#************************************************************************* -# -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#***********************************************************************/ - -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_ERROR=2 -EXIT_BUG=10 - -if [ x${SOLARENV}x = xx ]; then - echo No environment found, please use 'configure' or 'setsolar' - exit $EXIT_FAILURE -fi -usage() { - echo "Usage: $SCRIPTNAME [-t DESTPATH] [-o] [-d] [-a]" >&2 - echo "" >&2 - echo "[-t] target path: path wehre tho office should installed to. The default is '$DESTPATH'" >&2 - echo "" >&2 - echo "[-o] force OpenOffice.org installation instead of StarOffice" >&2 - echo "" >&2 - echo "[-d] installation with debug output" >&2 - echo "" >&2 - echo "[-a] the office will be patched to run without FirstStartWizard" >&2 - echo "" >&2 - echo "[-i] impress should open documents without autopilot" >&2 - exit $EXIT_FAILURE -} - -if [ x${USER}x = xx ]; then - if [ x${LOGNAME}x = xx ]; then - echo "ERROR: could not determine username. Please export variable USER" >&2 - exit $EXIT_FAILURE - else - USER=$LOGNAME - export USER - fi -fi - -DESTPATH=/tmp/$USER -PARAM="" - -while getopts ':mt:aicdhot' OPTION ; do - case $OPTION in - d) PARAM="$PARAM -debug true" - ;; - c) PARAM="$PARAM -cwscheckapi true" - ;; - o) PARAM="$PARAM -ooo true" - ;; - a) PARAM="$PARAM -autorun true" - ;; - i) PARAM="$PARAM -autoimpress true" - ;; - t) DESTPATH="$OPTARG" - ;; - h) usage $EXIT_SUCCESS - ;; - \?) echo "unkown option \"-$OPTARG\"." >&2 - usage $EXIT_ERROR - ;; - *) echo "this is not possible...">&2 - usage $EXIT_BUG - ;; - esac -done - -shift `expr $OPTIND - 1` - -LOCALINSTALLDIR=$DESTPATH/office -LOCALUNPACKDIR=$DESTPATH/unpack - -export LOCALINSTALLDIR -export LOCALUNPACKDIR -echo "export LOCALINSTALLDIR" -echo "export LOCALUNPACKDIR" - -unset LD_LIBRARY_PATH -unset FORCE2ARCHIVE - -echo "### $SOLARENV/bin/installoffice.pl $PARAM -cleanup true $@" -exec perl -w $SOLARENV/bin/installoffice.pl $PARAM -cleanup true $@ - -exit $? diff --git a/solenv/bin/installoffice.btm b/solenv/bin/installoffice.btm deleted file mode 100755 index a77f8defeb45..000000000000 --- a/solenv/bin/installoffice.btm +++ /dev/null @@ -1,120 +0,0 @@ -@echo off -REM ************************************************************************** -REM * -REM * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -REM * -REM * Copyright 2000, 2010 Oracle and/or its affiliates. -REM * -REM * OpenOffice.org - a multi-platform office productivity suite -REM * -REM * This file is part of OpenOffice.org. -REM * -REM * OpenOffice.org is free software: you can redistribute it and/or modify -REM * it under the terms of the GNU Lesser General Public License version 3 -REM * only, as published by the Free Software Foundation. -REM * -REM * OpenOffice.org is distributed in the hope that it will be useful, -REM * but WITHOUT ANY WARRANTY; without even the implied warranty of -REM * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -REM * GNU Lesser General Public License version 3 for more details -REM * (a copy is included in the LICENSE file that accompanied this code). -REM * -REM * You should have received a copy of the GNU Lesser General Public License -REM * version 3 along with OpenOffice.org. If not, see -REM * <http://www.openoffice.org/license.html> -REM * for a copy of the LGPLv3 License. -REM * -REM ************************************************************************/ - - -SET DESTPATH=%USERNAME% -SET DEBUG=false -SET OOO=false -SET PARAM= - -for %opt in (%&%) DO ( - iff "%opt%" == "-d" THEN - SET PARAM=%PARAM% -debug true - shift - - elseiff "%opt%" == "-o" THEN - SET PARAM=%PARAM% -ooo true - shift - - elseiff "%opt%" == "-c" THEN - SET PARAM=%PARAM% -cwscheckapi true - shift - - elseiff "%opt%" == "-a" THEN - SET PARAM=%PARAM% -autorun true - shift - - elseiff "%opt%" == "-i" THEN - SET PARAM=%PARAM% -autoimpress true - shift - - elseiff "%opt%" == "-t" THEN - SET DESTPATH=%2 - shift - shift - - elseiff "%opt%" == "-h" THEN - goto usage - - elseiff "%opt%" == "/h" THEN - goto usage - - elseiff "%opt%" == "%DESTPATH%" THEN - shift - - else - echo wrong param: %opt% - goto usage - endiff -) - -iff "%DESTPATH%" == "%USERNAME%" THEN -iff EXIST e:\ then - iff EXIST e:\temp then - set temppath=e:\temp - elseiff EXIST e:\tmp then - set temppath=c:\tmp - else - mkdir e:\temp - set tmppath=c:\temp - endiff -elseiff EXIST c:\tmp then - set temppath=c:\tmp -elseiff EXIST c:\temp then - set temppath=c:\temp -else - set temppath=%TMP% -endiff - DESTPATH=%temppath%\%USERNAME% -endiff - -SET LOCALINSTALLDIR=%DESTPATH%\office -SET LOCALUNPACKDIR=%DESTPATH%\unpack -echo LOCALINSTALLDIR=%LOCALINSTALLDIR% -echo LOCALUNPACKDIR=%LOCALUNPACKDIR% - -echo call perl5 %SOLARENV%\bin\installoffice.pl -dest %LOCALINSTALLDIR% %PARAM% -cleanup true %& -call perl5 %SOLARENV%\bin\installoffice.pl -dest %LOCALINSTALLDIR% %PARAM% -cleanup true %& - -quit %? - -:usage - echo. - echo Usage: %0% [-t DESTPATH] [-o] [-d] >&2 - echo. - echo [-d] installation with debug output>&2 - echo. - echo [-o] force OpenOffice.org installation instead of StarOffice>&2 - echo. - echo [-t] target path: path where the office should installed to. The default is '%DESTPATH%'>&2 - echo. - echo [-a] the office will be patched to run without FirstStartWizard >&2 - echo. - echo [-i] impress should open documents without autopilot - echo. - quit 1 diff --git a/solenv/bin/installoffice.pl b/solenv/bin/installoffice.pl deleted file mode 100755 index b6c852ae8624..000000000000 --- a/solenv/bin/installoffice.pl +++ /dev/null @@ -1,933 +0,0 @@ -: -eval 'exec perl -wS $0 ${1+"$@"}' - if 0; - -#************************************************************************* -# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. -# -# Copyright 2000, 2010 Oracle and/or its affiliates. -# -# OpenOffice.org - a multi-platform office productivity suite -# -# This file is part of OpenOffice.org. -# -# OpenOffice.org is free software: you can redistribute it and/or modify -# it under the terms of the GNU Lesser General Public License version 3 -# only, as published by the Free Software Foundation. -# -# OpenOffice.org is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Lesser General Public License version 3 for more details -# (a copy is included in the LICENSE file that accompanied this code). -# -# You should have received a copy of the GNU Lesser General Public License -# version 3 along with OpenOffice.org. If not, see -# <http://www.openoffice.org/license.html> -# for a copy of the LGPLv3 License. -# -#***********************************************************************/ - -use strict; -use File::Find; -use File::Path; -my $script = $0; - -( our $script_name = $script ) =~ s/^.*\b(\w+)\.pl$/$1/; -( our $script_path = $script ) =~ s/$script_name.*//; - -# Prototypes -sub installOffice(); - -our $debug = 0; # run without executing commands - -our $is_command_infos = 1; # print command details before exec -our $show_NoMessage = 0; -our $show_Message = 1; - -# special handling for cwschackapi -our $cwsCheckApi = 0; - -# remove existant office installation -our $cleanup = 0; - -# should the office be startable without user interaction -our $autorun = 0; - -# should impress open documents without autopilot -our $autoimpress = 0; - -# force openOffice.org installation if StarOffice is available -our $is_ooo = 0; - -parseArgs(); - -our $is_admin_installation = 1; - -our $gui = $ENV{GUI}; -our $temp_path = $ENV{TEMP}; -if (!defined($temp_path)) { - $temp_path = $ENV{TMP}; -} - -our $vcsid = $ENV{VCSID}; -our $sversion_saved = 0; -our $FileURLPrefix = "file:///"; -our $userinstalldir = "UserInstallation"; -our $cygwin = "cygwin"; -our $prefered_lang = "en-US"; -our $global_instset_mask = ""; -#$smoketest_install = $ENV{SMOKETESTINSTALLSET}; - -if (!defined($gui)) { - print "The workstamp is missing. Please use setsolar\n"; - exit(1); -} - -our $OfficeDestinationPath; -our $is_do_deinstall; -our $CygwinLineends; -our $WinLineends; -our $PS ; -our $NewPathSeparator ; -our $shell ; -our $shellSetEnvVar; -our $shellCommandSep; -our $cdCommand; -our $PERL ; -our $REMOVE_DIR ; -our $REMOVE_FILE ; -our $LIST_DIR ; -our $COPY_FILE ; -our $COPY_DIR ; -our $MK_DIR ; -our $RENAME_FILE ; -our $nul ; -our $RESPFILE; -our $SVERSION_INI ; -our $SOFFICEBIN ; -our $UNOPKGBIN; -our $bootstrapini ; -our $bootstrapiniTemp ; -our $packpackage ; -our $user; - -if ($gui eq "WNT") { - $gui = $cygwin; -} - -if ($gui eq "WNT") { - $user = $ENV{USERNAME}; - $PS = '\\'; - $NewPathSeparator = ';'; - $shell = "$ENV{COMSPEC} -c "; - $shellSetEnvVar = "set "; - $shellCommandSep = "& "; - $cdCommand="cd /d "; - $PERL = "$shell $ENV{PERL}"; - $REMOVE_DIR = "$shell del /qsxyz"; - $REMOVE_FILE = "$shell del /q"; - $LIST_DIR = "$shell ls"; - $COPY_FILE = "$shell copy"; - $COPY_DIR = "$shell copy /s"; - $MK_DIR = "md"; - $RENAME_FILE = "ren"; - $nul = '> NUL'; - $RESPFILE="response_fat_wnt"; - $SVERSION_INI = $ENV{USERPROFILE} . $PS . "Anwendungsdaten" . $PS . "sversion.ini"; - $SOFFICEBIN = "soffice.exe"; - $bootstrapini = "bootstrap.ini"; - $UNOPKGBIN="unopkg.exe"; - $bootstrapiniTemp = $bootstrapini . "_"; - $packpackage = "msi"; - if (!defined($temp_path)) { - print "temp value is missing. Please set temp-variable\n"; - exit(1); - } -} -elsif ($gui eq "UNX") { - $user = $ENV{USER}; - $is_do_deinstall = 0; - $PS = '/'; - $shell = "/bin/sh -c "; - $shellSetEnvVar = "export "; - $shellCommandSep = ";"; - $cdCommand="cd "; - $NewPathSeparator = ':'; - $shell = ""; - $PERL = "$ENV{PERL}"; - $REMOVE_DIR = "rm -rf"; - $REMOVE_FILE = "rm -f"; - $LIST_DIR = "ls"; - $COPY_FILE = "cp -f"; - $COPY_DIR = "cp -rf"; - $MK_DIR = "mkdir"; - $RENAME_FILE = "mv"; - $nul = '> /dev/null'; - $RESPFILE="response_fat_unx"; - $SVERSION_INI = $ENV{HOME} . $PS . ".sversionrc"; - $SOFFICEBIN = "soffice"; - $bootstrapini = "bootstraprc"; - $UNOPKGBIN="unopkg"; - $bootstrapiniTemp = $bootstrapini . "_"; - $packpackage = $ENV{PKGFORMAT}; - if (!defined($temp_path)) { - $temp_path="/tmp"; - if (! -e $temp_path){ - print "temp value is missing. Please set temp-variable\n"; - exit(1); - } - } -} -elsif ($gui eq $cygwin) { - - $PS = '/'; - $NewPathSeparator = ':'; - $shell = "/bin/sh -c "; - $shellSetEnvVar = "export "; - $shellCommandSep = ";"; - $cdCommand = "cd "; - $PERL = "$ENV{PERL}"; - $REMOVE_DIR = "rm -rf"; - $REMOVE_FILE = "rm -f"; - $LIST_DIR = "ls"; - $COPY_FILE = "cp -f"; - $COPY_DIR = "cp -rf"; - $MK_DIR = "mkdir"; - $RENAME_FILE = "mv"; - $nul = '> /dev/null'; - $RESPFILE="response_fat_wnt"; - $SVERSION_INI = $ENV{USERPROFILE} . $PS . "Anwendungsdaten" . $PS . "sversion.ini"; - $SOFFICEBIN = "soffice"; - $bootstrapini = "bootstrap.ini"; - $bootstrapiniTemp = $bootstrapini . "_"; - $CygwinLineends = $/; - $WinLineends = "\r\n"; - &SetWinLineends(); - $packpackage = "msi"; - if (!defined($temp_path)) { - $temp_path="/tmp"; - if (! -e $temp_path){ - print "temp value is missing. Please set temp-variable\n"; - exit(1); - } - } -} -else { - print_error ("not supported system\n",1); -} - -my %PRODUCT1 = (Name => "StarOffice", instset => "instset_native"); -my %PRODUCT2 = (Name => "OpenOffice", instset => "instsetoo_native"); -our @PRODUCT = (\%PRODUCT1, \%PRODUCT2); - -our $SHIP = defined $ENV{SHIPDRIVE} ? $ENV{SHIPDRIVE} . $PS : "shipdrive_not_set"; - -if (defined($ENV{CWS_WORK_STAMP})){ - print " found CWS\n"; -} -elsif (isLocalEnv()){ - print " local environment\n"; -} -elsif (defined $ENV{SHIPDRIVE}) { - print " master version\n"; -} -elsif (defined $ENV{SOLARSRC}) { - print " OpenOffice master version\n"; -} -else { - print "Could not determine environment. Exit\n"; - exit 1 -} - - -our @error_messages = ( '', - 'lock flag for pkgadd still exist. Installation not possible!', - 'Error during installation!', - 'Error: patching configuration failed!', - 'Error: starting office failed or office crashed!', - 'Error during testing', - 'can not copy extension', - 'Error in setup log', - 'installationsset is not complete', - 'can not copy all basic scripts', - 'can not patch bottstrapini', - 'msiexec failed. Maybe you have got an installed version', - 'deinstallation is incomplete' -); - - -my $success = 0; -$success = installOffice(); - -if ($success != 0){ - exit(1); -} -exit(0); - -sub installOffice(){ - - # <DISABLED> - # my ($officeVersion, $instsetPath)= getInstset(); - # print "OFFICEVERSION:$officeVersion INSTSETPATH:$instsetPath\n" if $debug; - # my $sourcePath=$instsetPath.$PS.$officeVersion; - # </DISABLED> - # - # currently this installer does not install an office, it do pack a runnable office. - # Therefore we do not need to search for an instSet - my $sourcePath="dummy"; - my $officeVersion="dummy"; - - my $destinationPath = getDestinationPath($officeVersion); - print "destinationPath: $destinationPath\n" if $debug; - - removeOffice($destinationPath); - mkdirs($destinationPath); - - my $installCommand = getInstallCommand($sourcePath, $destinationPath, $officeVersion); - print "installCommand: $installCommand\n" if $debug; - - my $success=0; - $success = system($installCommand); - print "installoofice.pl::installoffice::success $success\n" if ($debug); - - if ($autorun) { - makeAutoRun($destinationPath); - } - - if ($autoimpress) { - makeAutoImpress($destinationPath); - } - - return $success; -} - -sub makeAutoImpress(){ - my $destinationPath = shift; - - if (patchXCU ($destinationPath, $script_path.$script_name."_impress.oxt") != 0) { - print_error("could not register ".$script_path.$script_name."_impress.oxt", "1"); - } - return 0; -} - - -sub makeAutoRun(){ - - my $destinationPath = shift; - - patchBootstraprc($destinationPath); - - if (patchXCU ($destinationPath, $script_path.$script_name.".oxt") != 0) { - print_error("could not register ".$script_path.$script_name.".oxt", "1"); - } - return 0; -} - - -sub patchBootstraprc(){ - my $destinationPath = shift; - my $bootstraprc=""; - - find sub { $bootstraprc=$File::Find::name if -e _ && /$bootstrapini$/ }, $destinationPath; - - print_error("could not find $bootstrapini", "1") if ( ! -e $bootstraprc ); - - open(BSRC, "<$bootstraprc") or errorFromOpen(" for reading " .$bootstraprc); - my @content = <BSRC>; - close(BSRC); - my @newContent; - foreach(@content) { - if ( /UserInstallation=./ ) { - push(@newContent, "UserInstallation=\$ORIGIN/../UserInstallation\n"); - } - else { - push(@newContent,$_); - } - } - - chmod(0755,$bootstraprc); - - open OUTFILE, ">$bootstraprc" or return errorFromOpen (" for writing " . $bootstraprc); - print OUTFILE @newContent; - close OUTFILE; - -} - -sub patchXCU(){ - my $destinationPath = shift; - my $oxt = shift; - my $unopkg=""; - - find sub { $unopkg=$File::Find::name if -e _ && /$UNOPKGBIN$/ }, $destinationPath; - - print_error("could not find $UNOPKGBIN", "1") if ( !-e $unopkg ); - print "unopkg: '$unopkg'\n" if $debug; - - if ($gui eq "WNT") { - $unopkg = "\"$unopkg\""; - } - - my $unopkgCommand = "$unopkg add $oxt"; - print "register oxt file ...\n" if $debug; - print "call $unopkgCommand\n" if $debug; - my $success=0; - $success = system($unopkgCommand); - - return $success; -} - -sub writeFile(){ - my $fileName = shift; - my @content = @_; - - open OUTFILE, ">$fileName" or return errorFromOpen (" for writing " . $fileName); - - my $lf; - if ($packpackage eq "msi"){ - $lf = "\r\n"; - } else { - $lf = "\n"; - } - - my $line; - foreach $line(@content) { - print "LINE: $line\n" if $debug; - print OUTFILE $line.$lf; - } - close(OUTFILE); - return 0; -} - -sub mkdirs(){ - my $directory = shift; - my $splitter=$PS; - if ( $PS eq "\\" ){ - $splitter="\\\\"; - } - my @aFolder=split($splitter,$directory); - - my $dir; - my $folder; - foreach $folder(@aFolder){ - if ( (! defined($dir)) && ($PS eq "\\")){ - $dir=$folder; - } else { - $dir=$dir.$PS.$folder; - } - if (! -e $dir ){ - print "try to create $dir\n" if $debug; - mkdir($dir); - } - } -} - -sub removeOffice(){ - - my $destPath=shift; - - if ($cleanup){ - print "remove old office installation...\n"; - - print "remove $destPath...\n" if $debug; - rmtree($destPath); - - } -} - -sub getInstallCommand() { - my $command; - $command = getDmakeInstalledCommand(@_); - # if ($packpackage eq "msi"){ - # $command = getWindowsInallCommand(@_); - # } else { - # $command = getUnixInstallCommand(@_); - # } - return $command; -} - -sub getDmakeInstalledCommand(){ - my ($sourcePath, $destPath, $officeVersion) = @_; - my $RootDir=$ENV{SRC_ROOT}; - - my $ProductName; - my $instset; - - # check if instset_native could be found - foreach my $pointer (@PRODUCT) { - $instset = $pointer->{'instset'}; - $ProductName = $pointer->{'Name'}; - my $instsetDir = "$RootDir$PS$instset"; - print "instsetDir: $instsetDir \n" if $debug; - - last if ($is_ooo && $ProductName eq "OpenOffice"); - last if ( ! $is_ooo && -e "$instsetDir"); - } - print "Product: $ProductName\n" if $debug;; - - my $dmakeTarget=lc($ProductName)."_en-US"; - - my $utilFolder = getInstsetUtilFolder($instset, $destPath, $RootDir); - my $dmakeCommand = " $cdCommand \"$utilFolder\" $shellCommandSep dmake $dmakeTarget PKGFORMAT=installed -vt"; - my $envset; - if ($gui eq "WNT") { - $envset="set LOCALINSTALLDIR=$destPath & set LOCALUNPACKDIR=$destPath &"; - }else { - $envset="LOCALINSTALLDIR=$destPath ; LOCALUNPACKDIR=$destPath ; export LOCALINSTALLDIR ; export LOCALUNPACKDIR ; "; - } - #my $command=$envset.$dmakeCommand; - my $command=$dmakeCommand; - return $command; -} - -sub getInstsetUtilFolder(){ - my $instset = shift; - my $destPath = shift; - my $RootDir = shift; - - my $instsetFolder = $RootDir.$PS.$instset; - my $utilFolder=""; - - if( open(DATEI, ">$instsetFolder".$PS."touch")) - { - close(DATEI); - unlink($instsetFolder.$PS."touch"); - print "$instsetFolder is writable \n" if $debug; - $utilFolder = $RootDir.$PS.$instset.$PS."util"; - } - else - { - print "$instsetFolder is NOT writable \n" if $debug; - print "copy $instset to $destPath$PS..\n" if $debug; - my $prjPath=$destPath.$PS.".."; - - my $command = "$ENV{COPYPRJ} -x $instset $prjPath"; - print $command if $debug; - system($command); - $utilFolder=$prjPath.$PS.$ENV{WORK_STAMP}.$PS.$instset.$PS."util"; - } - print "utilFolder: $utilFolder\n" if $debug; - return $utilFolder; -} - -# sub getInstsetFomInstsetNative(){ -# my (@DirArray, $TestDir1, $TestDir2); -# my $instset; -# my $ProductName; -# my $instDir=""; -# my $lang; -# my $RootDir=$ENV{SRC_ROOT}; -# my $StandDir = $ENV{SOLARSRC} . $PS; -# #$RootDir=~s/\w+$//; - -# foreach my $pointer (@PRODUCT) { -# $instset = $pointer->{'instset'}; -# $ProductName = $pointer->{'Name'}; -# @DirArray=(); -# $TestDir1 = "$RootDir$PS$instset$PS$ENV{INPATH}$PS$ProductName$PS$packpackage$PS" . "install$PS"; -# $TestDir2 = "$StandDir$instset$PS$ENV{INPATH}$PS$ProductName$PS$packpackage$PS" . "install$PS"; -# print "TestDir1: $TestDir1 \n"; -# print "TestDir2: $TestDir2 \n"; -# if (-e "$TestDir1") { -# $instDir= $TestDir1; -# } -# elsif (-e "$TestDir2") { -# $instDir="$TestDir2"; -# } -# if ($instDir eq "") { -# next; -# } - -# getSubDirs ("$instDir", \@DirArray); -# $lang = findSubDir (\@DirArray); -# print "Lang-Sel: $lang\n" if $is_command_infos; -# ; -# if (($instDir ne "") and (-e $instDir)) { -# return ($lang, $instDir, $ProductName, $instset); -# } -# } -# print_error ("no installationset found\n",2); - -# } - -sub getWindowsInallCommand(){ - my ($sourcePath, $destPath) = @_; - my $mask = "\\.msi\$"; - #my $DirArray; - my @DirArray = (); - getSubFiles ("$sourcePath", \@DirArray, $mask); - if ($#DirArray == -1) { - print_error ("Installationset in $sourcePath is incomplete", 2); - } - if ($#DirArray >= 1) { - print_error ("Installationset in $sourcePath hat too many msi-files", 2); - print "found the following msi-files: @DirArray\n" if $debug; - } - my $command = "msiexec.exe /a $sourcePath$PS$DirArray[0] -qn ALLUSERS=2 INSTALLLOCATION=$destPath"; - - return $command; -} - -sub getUnixInstallCommand() { - my ($sourcePath, $destPath, $officeVersion) = @_; - - my $userland="unknown"; - - if (defined($ENV{CWS_WORK_STAMP})){ - print " found CWS\n"; - $userland=$ENV{SOLARVERSION}.$PS.$ENV{INPATH}.$PS."bin".$ENV{UPDMINOREXT}.$PS."userscripts".$PS."install"; - } - elsif (isLocalEnv()){ - print " local environment\n"; - } - elsif (defined $ENV{SHIPDRIVE}) { - print " master version\n"; - $userland=$ENV{SHIPDRIVE}.$PS.$ENV{INPATH}.$PS."UserScripts".$PS.$ENV{PKGFORMAT}.$PS.$officeVersion.$PS."install"; - } - elsif (defined $ENV{SOLARSRC}) { - print " OpenOffice master version\n"; - print " command to install Office not implementet yet\n"; - exit(1); - } - else { - print "Could not determine environment. Exit\n"; - exit(1); - } - return "$userland $sourcePath $destPath"; -; - -} - -sub getDestinationPath { - # if (defined $ENV{SOLARROOT}){ - # # seems to be a Sun environment - # if (! -e $OfficeDestinationPath){ - - # } - # } - my $officeVersion = shift; - my $officename; - - if (defined($ENV{LOCALINSTALLDIR})){ - $OfficeDestinationPath=$ENV{LOCALINSTALLDIR}; - if(index($OfficeDestinationPath," ") >= 0) { - my $msg="You environemt variable '\$LOCALINSTALLDIR=$OfficeDestinationPath' contains white spaces."; - $msg = $msg." This is not allowed!"; - print_error($msg, "1"); - } - } - if (!defined($OfficeDestinationPath)){ - $officename = $officeVersion; - if (defined($ENV{CWS_WORK_STAMP})){ - $officename=$ENV{CWS_WORK_STAMP}; - } - $OfficeDestinationPath=$temp_path.$PS.$user.$PS."office".$PS.$officename; - } - - return $OfficeDestinationPath; -} - -# sub getInstset { - -# my ($INSTSET, $NEWINSTSET, $ProductName); - -# if (defined ($ENV{EPM}) && ($ENV{EPM} eq 'NO') && ($gui eq "UNX")) { # we do the install ourselves ... -# return (); -# } - -# print "get Instset\n" if $debug; -# $NEWINSTSET = ""; - -# if (!isLocalEnv() and !defined($ENV{CWS_WORK_STAMP}) and (-e $SHIP) and ($gui ne $cygwin)) { -# ($NEWINSTSET, $INSTSET) = getSetFromServer(); -# } -# else { -# ($NEWINSTSET, $INSTSET, $ProductName) = getInstsetFomInstsetNative(); -# } -# return ($NEWINSTSET, $INSTSET); -# } - -# sub getSetFromServer { -# my ($DirName, $SetupFullPath); -# my $workspace = $ENV{WORK_STAMP}; -# my $platform = $ENV{INPATH}; -# my $latestset; -# my (@DirArray, $mask, $buildid, $milestone); - -# foreach my $pointer (@PRODUCT) { -# my $ProductName = $pointer->{'Name'}; - -# print "##PRODUCT: $ProductName\n"; -# my $SetupFullPath = "$SHIP$ENV{INPATH}$PS$ProductName$PS$packpackage$PS"; -# if ( ! ( $workspace && $platform ) ) { -# print_error ( "Error: environment not set correctly.", 1); -# } -# # get latest broadcastet milestone and pack number -# ($milestone, $buildid) = get_milestoneAndBuildID( $workspace, $platform ); - -# if (defined $ENV{CWS_WORK_STAMP}) { -# # /unxlngi6.pro/StarOffice/rpm/ SRC680_m245_native_packed-2_en-US.9267/ -# $mask = "^$workspace" . "_" . $milestone . "_native_packed-(\\d+)_en-US\\.$buildid"; -# } else { -# # cws03/os110/OOH680/src.m4/instset_native/unxlngi6.pro/StarOffice/rpm install/en-US/RPMS -# $mask = "^$workspace" . "_" . $milestone . "_native_packed-(\\d+)_en-US\\.$buildid"; -# } -# print "MASK: $mask\n"; -# $global_instset_mask = $mask; -# getSubFiles ($SetupFullPath, \@DirArray, $mask); -# @DirArray = sort InstsetSort @DirArray; - -# if ($#DirArray > -1) { -# $latestset = $DirArray [$#DirArray]; -# $DirName = $latestset; -# } -# else { -# print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); -# } - -# print "Latest install sets: $latestset\n" if $debug; - -# print "$DirName\t $SetupFullPath\n" if $debug; -# # compare with file system -# # at the moment just the existence is checked. For security reasons it might be -# # better to additionally check whether there are newer sets (this must not happen, -# # but who knows ...) -# if ( -d $SetupFullPath ) { -# # if found => return and don't continue searching -# # this is usefull to set a priority to find installsets in @PRODUCT -# # first comes, first wins -# return ($DirName, $SetupFullPath); -# } -# } - -# # compare with file system -# # at the moment just the existence is checked. For security reasons it might be -# # better to additionally check whether there are newer sets (this must not happen, -# # but who knows ...) -# if ( -d $SetupFullPath ) { -# return ($DirName, $SetupFullPath); -# } else { -# print_error ("Cannot find install set $SetupFullPath for $workspace $milestone", 2); -# } -# } - -# sub get_milestoneAndBuildID { -# my ( $ws, $pf ) = @_; -# my ($milestone, $buildid, $upd, $path, $updext, $line); - -# if ( $ws =~ /^\D+(\d+)$/) { -# $upd = $1; -# } - -# if (defined ($ENV{UPDMINOREXT})) { -# $updext = $ENV{UPDMINOREXT}; -# } -# else { -# $updext = ""; -# } - -# $path = "$ENV{SOLARVER}$PS$pf$PS" . "inc$updext$PS$upd" . "minor.mk"; -# print "$path\n" if $debug; -# local *MINORMK; - -# if ( !open(MINORMK,$path) ) { -# print "FATAL: can't open $path\n"; -# return (0,0); -# } - -# if (!eof(MINORMK)) { -# while ($line = <MINORMK>) { -# chomp($line); -# if ( $line =~ /LAST_MINOR=(\w+)/ ) { -# $milestone = $1; -# } -# elsif ( $line =~ /BUILD=(\d+)/ ) { -# $buildid = $1; -# } -# } - -# close(MINORMK); -# } -# if (!defined($milestone)) { -# print_error ("Milestone ist not defined!", 2); -# } -# if (!defined($buildid)) { -# print_error ("Build-ID ist not defined!", 2); -# } - -# return ($milestone, $buildid); -# } - -sub print_error -{ - my $message = shift; - my $error_code = shift; - - print STDERR "ERROR: $message\n"; - doExit($error_code); -} - -sub getSubFiles { - my ($startDir, $DirArray_ref, $mask) = @_; - my ($dir); - local *DIR; - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir =~ /\.$/) or ($dir !~ /$mask/)) { - next; - } - push (@{$DirArray_ref}, "$dir"); - } - closedir(DIR); - -} - -sub InstsetSort { - my ($a1, $b1); - if ($a =~ /$global_instset_mask/) { - $a1 = $1; - } - if ($b =~ /$global_instset_mask/) { - $b1 = $1; - } - $a1 <=> $b1; -} - -sub isLocalEnv { - my $returnvalue = 0; - if (defined ($ENV{SOL_TMP}) && defined ($ENV{SOLARVERSION})) { - my $mask = $ENV{SOL_TMP}; - $mask =~ s/\\/\\\\/; - print "Mask: $mask\n" if $debug; - if ($ENV{SOLARVERSION}=~ /$mask/) { - $returnvalue = 1; - } - } - return $returnvalue; -} - -sub getSubDirs { - my ($startDir, $DirArray_ref) = @_; - my ($dir); - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { - push (@{$DirArray_ref}, "$dir"); - } - } - closedir(DIR); - -} - -sub findSubDir { - my ($DirArray_ref) = @_; - my (@sortedArray, $dir, $instdir); - @sortedArray = sort langsort @{$DirArray_ref}; - print "Langs: @sortedArray\n" if $is_command_infos; - foreach $dir (@sortedArray) { - if ($dir =~ /log$/) { - next; - } - $instdir = "$dir"; - return $instdir; - } - return ""; -} - -sub langsort { - if ($a eq $prefered_lang) { - return -1; - } - elsif ($b eq $prefered_lang) { - return 1; - } - else { - $a cmp $b; - } -} - -sub doExit -{ - my $error_code = shift; - # if ($sversion_saved) { - # restore_sversion ($SVERSION_INI); - # } - # if ($is_remove_on_error) { - # if ($is_do_deinstall) { - # deinstallInstallation ($installpath); - # } - # removeInstallation($installpath); - # } - # else { - # print_notRemoved ($installpath); - # } - if ( $error_code ) { - print STDERR "\nFAILURE: $script_name aborted.\n"; - } - exit($error_code); - -} - - -sub parseArgs -{ - for (my $i=0; $i<=$#ARGV; $i++) { - if ( $ARGV[$i] =~ /^-cwscheckapi$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/) ) { - $cwsCheckApi = 1; - $cleanup = 1; - $autorun = 1; - }; - - } - - if ( $ARGV[$i] =~ /^-dest$/ ) { - $OfficeDestinationPath = $ARGV[++$i]; - } - - if ( $ARGV[$i] =~ /^-cleanup$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/ )) { $cleanup = 1 }; - } - - if ( $ARGV[$i] =~ /^-autorun$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/ )) { $autorun = 1 }; - } - - if ( $ARGV[$i] =~ /^-autoimpress$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/ )) { $autoimpress = 1 }; - } - - if ( $ARGV[$i] =~ /^-debug$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/ )) { $debug = 1 }; - } - - if ( $ARGV[$i] =~ /^-ooo$/ ) { - my $value = $ARGV[++$i]; - if ($value =~ /^true$/ || ($value =~ /^1$/ )) { $is_ooo = 1 }; - } - } - -} - -sub getSubDirsFullPath { - my ($startDir, $DirArray_ref) = @_; - my ($dir); - opendir(DIR,"$startDir"); - while($dir = readdir(DIR)) { - if (($dir !~ /\.$/) and ( -d "$startDir$dir") ) { - push (@{$DirArray_ref}, "$startDir$dir"); - } - } - closedir(DIR); -} - -sub errorFromOpen { - my ($file) = @_; - print_error( "can not open $file", "1"); -} - diff --git a/solenv/bin/linkoo b/solenv/bin/linkoo index 7c00a131ece2..fe75d0d562d4 100755 --- a/solenv/bin/linkoo +++ b/solenv/bin/linkoo @@ -53,7 +53,7 @@ export OOO_DISABLE_RECOVERY=1 $program_dir = 'program'; $program_dir = 'MacOS' if ($ENV{OS} eq 'MACOSX'); -my @exceptions = ( 'cppuhelper', 'configmgr2', 'sunjavaplugin', 'libjvmfwk' ); +my @exceptions = ( 'cppuhelper', 'sunjavaplugin', 'libjvmfwk' ); %replaceable = ( $program_dir => '\.so', @@ -294,9 +294,6 @@ sub link_soffice_bin_files() do_link ($src, $dest, 'intro.bmp', 'intro.bmp', 1); do_link ("$OOO_INSTALL", "$OOO_BUILD/desktop/$TARGET", 'share', 'share', 1); - $dest = "$OOO_BUILD/configmgr/$TARGET/lib"; - do_link ($src, $dest, 'configmgrrc', 'configmgrrc', 1); - print "\n"; } diff --git a/solenv/bin/macosx-change-install-names.pl b/solenv/bin/macosx-change-install-names.pl index b7530e4f5e98..6f824f34ff0c 100644 --- a/solenv/bin/macosx-change-install-names.pl +++ b/solenv/bin/macosx-change-install-names.pl @@ -39,13 +39,17 @@ sub action($$$) 'app/BRAND/OOO' => '@executable_path/../basis-link/program', 'app/NONE/URELIB' => '@__VIA_LIBRARY_PATH__', 'app/NONE/OOO' => '@__VIA_LIBRARY_PATH__', + 'app/NONE/NONE' => '@__VIA_LIBRARY_PATH__', 'shl/URELIB/URELIB' => '@loader_path', 'shl/OOO/URELIB' => '@loader_path/../ure-link/lib', 'shl/OOO/OOO' => '@loader_path', - 'shl/OXT/URELIB' => '@executable_path/urelibs'); + 'shl/OXT/URELIB' => '@executable_path/urelibs', + 'shl/NONE/URELIB' => '@__VIA_LIBRARY_PATH__', + 'shl/NONE/OOO' => '@__VIA_LIBRARY_PATH__', + 'shl/NONE/NONE' => '@__VIA_LIBRARY_PATH__'); my ($type, $loc1, $loc2) = @_; my $act = $action{"$type/$loc1/$loc2"}; - die "illegal combination $type/$loc/$2" unless defined $act; + die "illegal combination $type/$loc1/$loc2" unless defined $act; return $act; } diff --git a/solenv/bin/make_installer.pl b/solenv/bin/make_installer.pl index a2f552eceb8d..143f60d986db 100644 --- a/solenv/bin/make_installer.pl +++ b/solenv/bin/make_installer.pl @@ -394,9 +394,14 @@ if ( $installer::globals::globallogging ) { installer::files::save_hash($logging installer::setupscript::add_forced_properties($allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_hash($loggingdir . "allvariables5.log", $allvariableshashref); } +# Replacing preset properties, not using the default mechanisms (for example for UNIXPRODUCTNAME) +installer::setupscript::replace_preset_properties($allvariableshashref); +if ( $installer::globals::globallogging ) { installer::files::save_hash($loggingdir . "allvariables6.log", $allvariableshashref); } + installer::scpzipfiles::replace_all_ziplistvariables_in_file($setupscriptref, $allvariableshashref); if ( $installer::globals::globallogging ) { installer::files::save_file($loggingdir . "setupscript3.log" ,$setupscriptref); } + installer::logger::log_hashref($allvariableshashref); installer::logger::print_message( "... analyzing directories ... \n" ); @@ -1340,6 +1345,9 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) installer::packagelist::resolve_packagevariables(\$packagename, $allvariableshashref, 0); } + # Debian allows no underline in package name + if ( $installer::globals::debian ) { $packagename =~ s/_/-/g; } + my $linkaddon = ""; my $linkpackage = 0; $installer::globals::add_required_package = ""; @@ -1369,7 +1377,11 @@ for ( my $n = 0; $n <= $#installer::globals::languageproducts; $n++ ) # try it again later. #################################################### - if (( $installer::globals::patch ) || ( $installer::globals::languagepack ) || ( $installer::globals::packageformat eq "native" ) || ( $installer::globals::packageformat eq "osx" )) { $allvariableshashref->{'POOLPRODUCT'} = 0; } + if (( $installer::globals::patch ) || + ( $installer::globals::languagepack ) || + ( $installer::globals::packageformat eq "native" ) || + ( $installer::globals::packageformat eq "portable" ) || + ( $installer::globals::packageformat eq "osx" )) { $allvariableshashref->{'POOLPRODUCT'} = 0; } if ( $allvariableshashref->{'POOLPRODUCT'} ) { diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index 88aa226f68a9..9379b7764d0a 100644 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -38,10 +38,12 @@ package SourceConfig; use strict; use constant SOURCE_CONFIG_FILE_NAME => 'source_config'; +use constant SOURCE_CONFIG_VERSION => 2; use Carp; use Cwd; use File::Basename; +use File::Temp qw(tmpnam); my $debug = 0; @@ -55,27 +57,50 @@ sub new { my $source_root = shift; my $self = {}; $self->{USER_SOURCE_ROOT} = undef; + $self->{SOURCE_CONFIG_FILE} = undef; if (defined $source_root) { - $self->{USER_SOURCE_ROOT} = $source_root; + $source_root = Cwd::realpath($source_root); $source_root =~ s/\\|\/$//; - $source_root .= '/..'; + if (-f $source_root) { + # We have path to source_config + if (File::Basename::basename($source_root) eq 'source_config') { + # We have path to source_config + $self->{SOURCE_CONFIG_FILE} = $source_root; + $source_root = File::Basename::dirname($source_root); + } else { + croak("$source_root is not a source_config file"); + }; + } else { + $self->{USER_SOURCE_ROOT} = $source_root; + $source_root .= '/..'; + } } else { - $source_root = $ENV{SOURCE_ROOT_DIR}; + $source_root = Cwd::realpath($ENV{SOURCE_ROOT_DIR}); }; - $source_root = Cwd::realpath($source_root); - $self->{DEBUG} = 0; $self->{SOURCE_ROOT} = $source_root; + $self->{DEBUG} = 0; + $self->{VERBOSE} = 0; $self->{REPOSITORIES} = {}; + $self->{ACTIVATED_REPOSITORIES} = {}; $self->{MODULE_PATHS} = {}; $self->{MODULE_BUILD_LIST_PATHS} = {}; $self->{ACTIVATED_MODULES} = {}; $self->{MODULE_REPOSITORY} = {}; $self->{REAL_MODULES} = {}; + $self->{NEW_MODULES} = []; + $self->{REMOVE_MODULES} = {}; + $self->{REMOVE_REPOSITORIES} = {}; + $self->{NEW_REPOSITORIES} = []; + $self->{WARNINGS} = []; + $self->{REPORT_MESSAGES} = []; + $self->{CONFIG_FILE_CONTENT} = []; + $self->{DEFAULT_REPOSITORY} = undef; if (defined $self->{USER_SOURCE_ROOT}) { ${$self->{REPOSITORIES}}{File::Basename::basename($self->{USER_SOURCE_ROOT})} = $self->{USER_SOURCE_ROOT}; + $self->{DEFAULT_REPOSITORY} = File::Basename::basename($self->{USER_SOURCE_ROOT}); }; - $self->{SOURCE_CONFIG_FILE} = get_config_file($source_root); - $self->{SOURCE_CONFIG_DEFAULT} = $source_root .'/'.SOURCE_CONFIG_FILE_NAME; + $self->{SOURCE_CONFIG_FILE} = get_config_file($self->{SOURCE_ROOT}) if (!defined $self->{SOURCE_CONFIG_FILE}); + $self->{SOURCE_CONFIG_DEFAULT} = $self->{SOURCE_ROOT} .'/'.SOURCE_CONFIG_FILE_NAME; read_config_file($self); bless($self, $class); return $self; @@ -83,6 +108,10 @@ sub new { ##### methods ##### +sub get_version { + return SOURCE_CONFIG_VERSION; +}; + sub get_repositories { my $self = shift; @@ -249,8 +278,11 @@ sub read_config_file { my $repository_section = 0; my $module_section = 0; my $line = 0; + my @file_content = (); + if (open(SOURCE_CONFIG_FILE, $self->{SOURCE_CONFIG_FILE})) { foreach (<SOURCE_CONFIG_FILE>) { + push (@{$self->{CONFIG_FILE_CONTENT}}, $_); $line++; chomp; next if (!/^\S+/); @@ -269,7 +301,17 @@ sub read_config_file { next if (!$repository_section && !$module_section); if (/\s*(\S+)=active\s*(\s+#)*/) { if ($repository_section) { - ${$self->{REPOSITORIES}}{$1} = $self->{SOURCE_ROOT} . "/$1"; + my $repository_source_path = $self->{SOURCE_ROOT} . "/$1"; + if (defined $ENV{UPDMINOREXT}) { + $repository_source_path .= $ENV{UPDMINOREXT}; + }; + if ((defined $self->{DEFAULT_REPOSITORY}) && (${$self->{REPOSITORIES}}{$self->{DEFAULT_REPOSITORY}} eq $repository_source_path)) { + delete ${$self->{REPOSITORIES}}{$self->{DEFAULT_REPOSITORY}}; + $self->{DEFAULT_REPOSITORY} = undef; + + }; + ${$self->{REPOSITORIES}}{$1} = $repository_source_path; + ${$self->{ACTIVATED_REPOSITORIES}}{$1}++; next; } if ($module_section) { @@ -290,6 +332,187 @@ sub read_config_file { }; }; +sub remove_all_activated_repositories { + my $self = shift; + $self->remove_activated_repositories([keys %{$self->{ACTIVATED_REPOSITORIES}}]); +}; + +sub remove_activated_repositories { + my $self = shift; + my $new_repositories_ref = shift; + push(@{$self->{WARNINGS}}, "\nWARNING: Empty repository list passed for removing from source_config\n") if (!scalar @$new_repositories_ref); + $self->{VERBOSE} = shift; + $self->{REMOVE_REPOSITORIES} = {}; + foreach (@$new_repositories_ref) { + if (!defined ${$self->{ACTIVATED_REPOSITORIES}}{$_}) { + push (@{$self->{WARNINGS}}, "\nWARNING: repository $_ is not activated in ". $self->get_config_file_default_path()."\n"); + } else { + ${$self->{REMOVE_REPOSITORIES}}{$_}++; + delete ${$self->{ACTIVATED_REPOSITORIES}}{$_}; + }; + }; + generate_config_file($self); +}; + +sub remove_all_activated_modules { + my $self = shift; + $self->remove_activated_modules([keys %{$self->{ACTIVATED_MODULES}}]); +}; + +sub remove_activated_modules { + my $self = shift; + my $new_modules_ref = shift; + push(@{$self->{WARNINGS}}, "\nWARNING: Empty module list passed for removing from source_config\n") if (!scalar @$new_modules_ref); + $self->{VERBOSE} = shift; + $self->{REMOVE_MODULES} = {}; + foreach (@$new_modules_ref) { + if (!defined ${$self->{ACTIVATED_MODULES}}{$_}) { + push (@{$self->{WARNINGS}}, "\nWARNING: module $_ is not activated in ". $self->get_config_file_default_path()."\n"); + } else { + ${$self->{REMOVE_MODULES}}{$_}++; + delete ${$self->{ACTIVATED_MODULES}}{$_}; + }; + }; + generate_config_file($self); +}; + +sub add_active_repositories { + my $self = shift; + $self->{NEW_REPOSITORIES} = shift; + croak('Empty module list passed for adding to source_config') if (!scalar @{$self->{NEW_REPOSITORIES}}); + $self->{VERBOSE} = shift; + generate_config_file($self); +}; + +sub add_active_modules { + my $self = shift; + $self->{NEW_MODULES} = shift; + croak('Empty module list passed for adding to source_config') if (!scalar @{$self->{NEW_MODULES}}); + $self->{VERBOSE} = shift; + generate_config_file($self); +}; + +sub add_content { + my $self = shift; + my $content = shift; + my $entries_to_add = shift; + return if (!scalar @$entries_to_add); + my $message; + my $message_part1; + my $warning_message; + my $activated_entries; + + if ($entries_to_add == $self->{NEW_MODULES}) { + $self->{NEW_MODULES} = []; + $message_part1 = "Module(s):\n"; + $activated_entries = $self->{ACTIVATED_MODULES}; + } elsif ($entries_to_add == $self->{NEW_REPOSITORIES}) { + $self->{NEW_REPOSITORIES} = []; + $message_part1 = "Repositories:\n"; + $activated_entries = $self->{ACTIVATED_REPOSITORIES}; + }; + foreach my $entry (@$entries_to_add) { + if (defined $$activated_entries{$entry}) { + $warning_message .= "$entry " + } else { + push(@$content, "$entry=active\n"); + ${$activated_entries}{$entry}++; + $message .= "$entry " + }; + }; + + push(@{$self->{REPORT_MESSAGES}}, "\n$message_part1 $message\nhave been added to the ". $self->get_config_file_default_path()."\n") if ($message); + push (@{$self->{WARNINGS}}, "\nWARNING: $message_part1 $warning_message\nare already added to the ". $self->get_config_file_default_path()."\n") if ($warning_message); +}; + +sub generate_config_file { + my $self = shift; + my @config_content_new = (); + my ($module_section, $repository_section); + my %removed_modules = (); + my %removed_repositories = (); + foreach (@{$self->{CONFIG_FILE_CONTENT}}) { + if (/^\[repositories\]\s*(\s+#)*/) { + if ($module_section) { + $self->add_content(\@config_content_new, $self->{NEW_MODULES}); + }; + $module_section = 0; + $repository_section = 1; + }; + if (/^\[modules\]\s*(\s+#)*/) { + if ($repository_section) { + $self->add_content(\@config_content_new, $self->{NEW_REPOSITORIES}); + }; + $module_section = 1; + $repository_section = 0; + }; + if ($module_section && /\s*(\S+)=active\s*(\s+#)*/) { + if (defined ${$self->{REMOVE_MODULES}}{$1}) { + $removed_modules{$1}++; + next; + }; + } + if ($repository_section && /\s*(\S+)=active\s*(\s+#)*/) { + if (defined ${$self->{REMOVE_REPOSITORIES}}{$1}) { + $removed_repositories{$1}++; + next; + }; + } + push(@config_content_new, $_); + }; + if (scalar @{$self->{NEW_MODULES}}) { + push(@config_content_new, "[modules]\n") if (!$module_section); + $self->add_content(\@config_content_new, $self->{NEW_MODULES}); + }; + if (scalar @{$self->{NEW_REPOSITORIES}}) { + push(@config_content_new, "[repositories]\n") if (!$repository_section); + $self->add_content(\@config_content_new, $self->{NEW_REPOSITORIES}); + }; + if (scalar keys %removed_modules) { + my @deleted_modules = keys %removed_modules; + push(@{$self->{REPORT_MESSAGES}}, "\nModules: @deleted_modules\nhave been removed from the ". $self->get_config_file_default_path()."\n"); + + }; + if (scalar keys %removed_repositories) { + my @deleted_repositories = keys %removed_repositories; + push(@{$self->{REPORT_MESSAGES}}, "\nRepositories: @deleted_repositories\nhave been removed from the ". $self->get_config_file_default_path()."\n"); + + }; + + # Writing file, printing warnings and reports + + #check if we need to write a new file + my $write_needed = 0; + if ((scalar @{$self->{CONFIG_FILE_CONTENT}}) != (scalar @config_content_new)) { + $write_needed++; + } else { + foreach my $i (0 .. $#{$self->{CONFIG_FILE_CONTENT}}) { + if (${$self->{CONFIG_FILE_CONTENT}}[$i] ne $config_content_new[$i]) { + $write_needed++; + last; + }; + }; + }; + if ($write_needed) { + my $temp_config_file = File::Temp::tmpnam($ENV{TMP}); + die("Cannot open $temp_config_file") if (!open(NEW_CONFIG, ">$temp_config_file")); + print NEW_CONFIG $_ foreach (@config_content_new); + close NEW_CONFIG; + rename($temp_config_file, $self->get_config_file_default_path()) or system("mv", $temp_config_file, $self->get_config_file_default_path()); + if (-e $temp_config_file) { + system("rm -rf $temp_config_file") if (!unlink $temp_config_file); + }; + $self->{CONFIG_FILE_CONTENT} = \@config_content_new; + }; + if ($self->{VERBOSE}) { + print $_ foreach (@{$self->{WARNINGS}}); + $self->{VERBOSE} = 0; + }; + $self->{WARNINGS} = []; + print $_ foreach (@{$self->{REPORT_MESSAGES}}); + $self->{REPORT_MESSAGES} = []; +}; + ##### finish ##### 1; # needed by use or require @@ -323,7 +546,12 @@ Methods: SourceConfig::new() -Creates a new instance of SourceConfig. Can't fail. +Creates a new instance of SourceConfig. Can be initialized by: path to the default repository, path to the source_config, default - empty, the source_config will be taken from the environment + + +SourceConfig::get_version() + +Returns version number of the module. Can't fail. SourceConfig::get_repositories() @@ -364,9 +592,35 @@ SourceConfig::is_active() Returns 1 (TRUE) if a module is active Returns 0 (FALSE) if a module is not active +SourceConfig::add_active_modules($module_array_ref) + +Adds modules from the @$module_array_ref as active to the source_config file + +SourceConfig::add_active_repositories($repository_array_ref) + +Adds repositories from the @$repository_array_ref as active to the source_config file + +SourceConfig::remove_activated_modules($module_array_ref) + +Removes modules from the @$module_array_ref from the source_config file + +SourceConfig::remove_all_activated_modules() + +Removes all activated modules from the source_config file + +SourceConfig::remove_activated_repositories($repository_array_ref) + +Removes repositories from the @$repository_array_ref from the source_config file + +SourceConfig::remove_all_activated_repositories() + +Removes all activated repositories from the source_config file + + =head2 EXPORT SourceConfig::new() +SourceConfig::get_version() SourceConfig::get_repositories() SourceConfig::get_active_modules() SourceConfig::get_all_modules() @@ -376,6 +630,12 @@ SourceConfig::get_module_repository($module) SourceConfig::get_config_file_path() SourceConfig::get_config_file_default_path() SourceConfig::is_active($module) +SourceConfig::add_active_modules($module_array_ref) +SourceConfig::add_active_repositories($repository_array_ref) +SourceConfig::remove_activated_modules($module_array_ref) +SourceConfig::remove_all_activated_modules() +SourceConfig::remove_activated_repositories($repository_array_ref) +SourceConfig::remove_all_activated_repositories() =head1 AUTHOR diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index 7818b74f4b40..f4edc8129255 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -710,7 +710,7 @@ sub set_addsystemintegration if ( $installer::globals::patch ) { $installer::globals::addsystemintegration = 0; } if ( $installer::globals::languagepack ) { $installer::globals::addsystemintegration = 0; } - if ( $installer::globals::packageformat eq "native" ) { $installer::globals::addsystemintegration = 0; } + if (( $installer::globals::packageformat eq "native" ) || ( $installer::globals::packageformat eq "portable" )) { $installer::globals::addsystemintegration = 0; } my $infoline = "Value of \$installer::globals::addsystemintegration: $installer::globals::addsystemintegration\n"; push( @installer::globals::globallogfileinfo, $infoline); diff --git a/solenv/bin/modules/installer/download.pm b/solenv/bin/modules/installer/download.pm index 0aa02451d22e..34f228c791f7 100644 --- a/solenv/bin/modules/installer/download.pm +++ b/solenv/bin/modules/installer/download.pm @@ -446,11 +446,10 @@ sub get_downloadname_language # en-US is default language and can be removed therefore # for one-language installation sets - if ( $languages =~ /^\s*en-US\s*$/ ) - { - $languages = ""; - } - + # if ( $languages =~ /^\s*en-US\s*$/ ) + # { + # $languages = ""; + # } if ( length ($languages) > $installer::globals::max_lang_length ) { @@ -461,20 +460,248 @@ sub get_downloadname_language } ######################################################### -# Setting download name, first part +# Setting download name ######################################################### -sub get_downloadname_start +sub get_downloadname_productname { my ($allvariables) = @_; my $start = "OOo"; + + if ( $allvariables->{'PRODUCTNAME'} eq "OpenOffice.org" ) { $start = "OOo"; } + + if ( $allvariables->{'PRODUCTNAME'} eq "OOo-dev" ) { $start = "OOo-Dev"; } + + if (( $allvariables->{'PRODUCTNAME'} eq "OpenOffice.org" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "OOo-SDK"; } + + if (( $allvariables->{'PRODUCTNAME'} eq "OOo-dev" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "OOo-Dev-SDK"; } + + if ( $allvariables->{'PRODUCTNAME'} eq "URE" ) { $start = "OOo-URE"; } + if ( $allvariables->{'PRODUCTNAME'} eq "BrOffice.org" ) { $start = "BrOo"; } + if ( $allvariables->{'PRODUCTNAME'} eq "BrOo-dev" ) { $start = "BrOo-Dev"; } + + if (( $allvariables->{'PRODUCTNAME'} eq "BrOffice.org" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "BrOo-SDK"; } + + if (( $allvariables->{'PRODUCTNAME'} eq "BrOo-dev" ) && ( $allvariables->{'POSTVERSIONEXTENSION'} eq "SDK" )) { $start = "BrOo-Dev-SDK"; } + return $start; } ######################################################### +# Setting download version +######################################################### + +sub get_download_version +{ + my ($allvariables) = @_; + + my $version = ""; + + my $devproduct = 0; + if (( $allvariables->{'DEVELOPMENTPRODUCT'} ) && ( $allvariables->{'DEVELOPMENTPRODUCT'} == 1 )) { $devproduct = 1; } + + my $cwsproduct = 0; + # the environment variable CWS_WORK_STAMP is set only in CWS + if ( $ENV{'CWS_WORK_STAMP'} ) { $cwsproduct = 1; } + + if (( $cwsproduct ) || ( $devproduct )) # use "DEV300m75" + { + my $source = uc($installer::globals::build); # DEV300 + my $localminor = ""; + if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; } + else { $localminor = $installer::globals::lastminor; } + $version = $source . $localminor; + } + else # use 3.2.0rc1 + { + $version = $allvariables->{'PRODUCTVERSION'}; + if (( $allvariables->{'ABOUTBOXPRODUCTVERSION'} ) && ( $allvariables->{'ABOUTBOXPRODUCTVERSION'} ne "" )) { $version = $allvariables->{'ABOUTBOXPRODUCTVERSION'}; } + if (( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) && ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ne "" )) { $version = $version . $allvariables->{'SHORT_PRODUCTEXTENSION'}; } + } + + return $version; +} + +############################################################### +# Set date string, format: yymmdd +############################################################### + +sub set_date_string +{ + my ($allvariables) = @_; + + my $datestring = ""; + + my $devproduct = 0; + if (( $allvariables->{'DEVELOPMENTPRODUCT'} ) && ( $allvariables->{'DEVELOPMENTPRODUCT'} == 1 )) { $devproduct = 1; } + + my $cwsproduct = 0; + # the environment variable CWS_WORK_STAMP is set only in CWS + if ( $ENV{'CWS_WORK_STAMP'} ) { $cwsproduct = 1; } + + my $releasebuild = 1; + if (( $allvariables->{'SHORT_PRODUCTEXTENSION'} ) && ( $allvariables->{'SHORT_PRODUCTEXTENSION'} ne "" )) { $releasebuild = 0; } + + if (( ! $devproduct ) && ( ! $cwsproduct ) && ( ! $releasebuild )) + { + my @timearray = localtime(time); + + my $day = $timearray[3]; + my $month = $timearray[4] + 1; + my $year = $timearray[5] + 1900; + + if ( $month < 10 ) { $month = "0" . $month; } + if ( $day < 10 ) { $day = "0" . $day; } + + $datestring = $year . $month . $day; + } + + return $datestring; +} + +################################################################# +# Setting the platform name for download +################################################################# + +sub get_download_platformname +{ + my $platformname = ""; + + if ( $installer::globals::islinuxbuild ) + { + $platformname = "Linux"; + } + elsif ( $installer::globals::issolarisbuild ) + { + $platformname = "Solaris"; + } + elsif ( $installer::globals::iswindowsbuild ) + { + $platformname = "Win"; + } + elsif ( $installer::globals::isfreebsdbuild ) + { + $platformname = "FreeBSD"; + } + elsif ( $installer::globals::ismacbuild ) + { + $platformname = "MacOS"; + } + else + { + # $platformname = $installer::globals::packageformat; + $platformname = $installer::globals::compiler; + } + + return $platformname; +} + +######################################################### +# Setting the architecture for the download name +######################################################### + +sub get_download_architecture +{ + my $arch = ""; + + if ( $installer::globals::compiler =~ /unxlngi/ ) + { + $arch = "x86"; + } + elsif ( $installer::globals::compiler =~ /unxlngppc/ ) + { + $arch = "PPC"; + } + elsif ( $installer::globals::compiler =~ /unxlngx/ ) + { + $arch = "x86-64"; + } + elsif ( $installer::globals::issolarissparcbuild ) + { + $arch = "Sparc"; + } + elsif ( $installer::globals::issolarisx86build ) + { + $arch = "x86"; + } + elsif ( $installer::globals::iswindowsbuild ) + { + $arch = "x86"; + } + elsif ( $installer::globals::compiler =~ /^unxmacxi/ ) + { + $arch = "x86"; + } + elsif ( $installer::globals::compiler =~ /^unxmacxp/ ) + { + $arch = "PPC"; + } + + return $arch; +} + +######################################################### +# Setting the installation type for the download name +######################################################### + +sub get_install_type +{ + my ($allvariables) = @_; + + my $type = ""; + + if ( $installer::globals::languagepack ) + { + $type = "langpack"; + + if ( $installer::globals::islinuxrpmbuild ) + { + $type = $type . "-rpm"; + } + + if ( $installer::globals::islinuxdebbuild ) + { + $type = $type . "-deb"; + } + + if ( $installer::globals::packageformat eq "archive" ) + { + $type = $type . "-arc"; + } + } + else + { + $type = "install"; + + if ( $installer::globals::islinuxrpmbuild ) + { + $type = $type . "-rpm"; + } + + if ( $installer::globals::islinuxdebbuild ) + { + $type = $type . "-deb"; + } + + if ( $installer::globals::packageformat eq "archive" ) + { + $type = $type . "-arc"; + } + + if (( $allvariables->{'WITHJREPRODUCT'} ) && ( $allvariables->{'WITHJREPRODUCT'} == 1 )) + { + $type = $type . "-wJRE"; + } + + } + + return $type; +} + +######################################################### # Setting installation addons ######################################################### @@ -548,48 +775,29 @@ sub get_current_version return $versionstring; } -######################################################### -# Determining the download file name -# Samples: -# OOo_2.0.2rc1_060213_Solarisx86_install_de -# OOo_2.0.2rc1_060213_LinuxIntel_langpack_zh-TW -# OOo_2.0.2rc1_060213_SolarisSparc_install_zh-TW_wJRE -# OOo_2.0.2rc1_060213_Win32Intel_install_zh-TW_wJRE -# OOo_2.0.157_LinuxIntel_install_de -# -######################################################### +############################################################################################### +# Setting the download file name +# Syntax: +# (PRODUCTNAME)_(VERSION)_(TIMESTAMP)_(OS)_(ARCH)_(INSTALLTYPE)_(LANGUAGE).(FILEEXTENSION) +# Rules: +# Timestamp only for Beta and Release Candidate +############################################################################################### sub set_download_filename { my ($languagestringref, $allvariables) = @_; - my $start = get_downloadname_start($allvariables); - # my $versionstring = get_current_version(); - my $versionstring = ""; - my $date = installer::logger::set_installation_date(); - if ( $installer::globals::product =~ /_Dev\s*$/ ) { $date = ""; } - my $platform = installer::worker::get_platform_name(); - my $type = get_installation_type(); + my $start = get_downloadname_productname($allvariables); + my $versionstring = get_download_version($allvariables); + my $date = set_date_string($allvariables); + my $platform = get_download_platformname(); + my $architecture = get_download_architecture(); + my $type = get_install_type($allvariables); my $language = get_downloadname_language($languagestringref); - my $addon = get_downloadname_addon(); - if ( $installer::globals::product =~ /_Dev\s*$/ ) - { - my $localminor = ""; - if ( $installer::globals::minor ne "" ) { $localminor = $installer::globals::minor; } - else { $localminor = $installer::globals::lastminor; } - if ( $localminor =~ /^\s*\w(\d+)\w*\s*$/ ) { $localminor = $1; } - $versionstring = $allvariables->{'PRODUCTVERSION'} . "." . $localminor; - } - else - { - if ( $allvariables->{'PACKAGEVERSION'} ) - { - $versionstring = $allvariables->{'PACKAGEVERSION'}; - } - } + # Setting the extension happens automatically - my $filename = $start . "_" . $versionstring . "_" . $date . "_" . $platform . "_" . $type . "_" . $language . $addon; + my $filename = $start . "_" . $versionstring . "_" . $date . "_" . $platform . "_" . $architecture . "_" . $type . "_" . $language; $filename =~ s/\_\_/\_/g; # necessary, if $versionstring or $platform or $language are empty $filename =~ s/\_\s*$//; # necessary, if $language and $addon are empty @@ -1039,6 +1247,10 @@ sub nsis_language_converter my $nsislanguage = ""; + # Assign language used by NSIS. + # The files "$nsislanguage.nsh" and "$nsislanguage.nlf" + # are needed in the NSIS environment. + # Directory: <NSIS-Dir>/Contrib/Language files if ( $language eq "en-US" ) { $nsislanguage = "English"; } elsif ( $language eq "sq" ) { $nsislanguage = "Albanian"; } elsif ( $language eq "ar" ) { $nsislanguage = "Arabic"; } @@ -1057,6 +1269,7 @@ sub nsis_language_converter elsif ( $language eq "fr" ) { $nsislanguage = "French"; } elsif ( $language eq "hu" ) { $nsislanguage = "Hungarian"; } elsif ( $language eq "he" ) { $nsislanguage = "Hebrew"; } + elsif ( $language eq "is" ) { $nsislanguage = "Icelandic"; } elsif ( $language eq "id" ) { $nsislanguage = "Indonesian"; } elsif ( $language eq "it" ) { $nsislanguage = "Italian"; } elsif ( $language eq "lv" ) { $nsislanguage = "Latvian"; } diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index 6c0280207173..2ee6fd41af47 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -76,6 +76,30 @@ sub create_pathvariables } ################################################## +# Replacing tilde in pathes, because of +# problem with deep recursion (task 104830) +################################################## + +sub check_tilde_in_directory +{ + if ( $ENV{'HOME'} ) + { + my $home = $ENV{'HOME'}; + $home =~ s/\Q$installer::globals::separator\E\s*$//; + $installer::globals::localinstalldir =~ s/~/$home/; + my $infoline = "Info: Changing LOCALINSTALLDIR to $installer::globals::localinstalldir\n"; + push(@installer::globals::logfileinfo, $infoline); + } + else + { + # exit, because "~" is not allowed, if HOME is not set + my $infoline = "ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!\n"; + push(@installer::globals::logfileinfo, $infoline); + installer::exiter::exit_program("ERROR: If \"~\" is used in \"LOCALINSTALLDIR\", environment variable \"HOME\" needs to be defined!", "check_tilde_in_directory"); + } +} + +################################################## # Setting some fundamental global variables. # All these variables can be overwritten # by parameters. @@ -107,6 +131,9 @@ sub set_global_environment_variables if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjavaset = 1; } if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; } if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; } + + # Special handling, if LOCALINSTALLDIR contains "~" in the path + if ( $installer::globals::localinstalldir =~ /^\s*\~/ ) { check_tilde_in_directory(); } } 1; diff --git a/solenv/bin/modules/installer/epmfile.pm b/solenv/bin/modules/installer/epmfile.pm index 95f661160a0e..ffe79136b57e 100644 --- a/solenv/bin/modules/installer/epmfile.pm +++ b/solenv/bin/modules/installer/epmfile.pm @@ -2544,6 +2544,7 @@ sub create_packages_without_epm my $dir = getcwd; my $buildroot = $dir . "/" . $epmdir . "buildroot/"; $buildrootstring = "--buildroot=$buildroot"; + mkdir($buildroot = $dir . "/" . $epmdir . "BUILD/"); } my $systemcall = "$rpmcommand -bb --define \"_unpackaged_files_terminate_build 0\" $specfilename --target $target $buildrootstring 2\>\&1 |"; @@ -2719,6 +2720,15 @@ sub remove_temporary_epm_files my $returnvalue = system($systemcall); + $removedir = $epmdir . "BUILD"; + + $systemcall = "rm -rf $removedir"; + + installer::logger::print_message( "... $systemcall ...\n" ); + + $returnvalue = system($systemcall); + + my $infoline = "Systemcall: $systemcall\n"; push( @installer::globals::logfileinfo, $infoline); diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 79cbd3a8cc80..72ab0215dbcf 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -136,7 +136,9 @@ BEGIN $issolarispkgbuild = 0; $issolarissparcbuild = 0; $issolarisx86build = 0; + $isfreebsdbuild = 0; $isfreebsdpkgbuild = 0; + $ismacbuild = 0; $ismacdmgbuild = 0; $unpackpath = ""; $idttemplatepath = ""; @@ -180,7 +182,7 @@ BEGIN $installertypedir = ""; $controlledmakecabversion = "5"; $saved_packages_path = ""; - $max_lang_length = 50; + $max_lang_length = 65; $globalblock = "Globals"; $rootmodulegid = ""; %alllangmodules = (); @@ -233,7 +235,7 @@ BEGIN $mergefiles_added_into_collector = 0; $creating_windows_installer_patch = 0; - $strip = 1; + $strip = $ENV{DISABLE_STRIP} eq ''; $solarjava = 0; $jdklib = ""; $jrepath = ""; @@ -268,7 +270,7 @@ BEGIN $isopensourceproduct = 1; $manufacturer = ""; $longmanufacturer = ""; - $sundirname = "Sun"; + $sundirname = "Oracle"; $codefilename = "codes.txt"; $componentfilename = "components.txt"; $productcode = ""; @@ -513,13 +515,12 @@ BEGIN if ( $plat =~ /darwin/i ) { $libextension = "\.dylib"; - $archiveformat = ".dmg"; } else { $libextension = "\.so"; - $archiveformat = ".tar.gz"; } + $archiveformat = ".tar.gz"; $quote = "\'"; $isunix = 1; $iswin = 0; diff --git a/solenv/bin/modules/installer/parameter.pm b/solenv/bin/modules/installer/parameter.pm index 8a54c27db3a9..0961b598902f 100644 --- a/solenv/bin/modules/installer/parameter.pm +++ b/solenv/bin/modules/installer/parameter.pm @@ -276,7 +276,6 @@ sub setglobalvariables if ( $installer::globals::compiler =~ /wnt(msc|gcc)i/ ) { $installer::globals::iswindowsbuild = 1; - if ( $installer::globals::installertypedir eq "" ) { $installer::globals::installertypedir = "msi"; } } if ( $installer::globals::compiler =~ /unxso[lg][siux]/ ) @@ -290,8 +289,10 @@ sub setglobalvariables } } - if ( $installer::globals::compiler =~ /unxmacxi/ ) + if (( $installer::globals::compiler =~ /unxmacxi/ ) || ( $installer::globals::compiler =~ /unxmacxp/ )) { + $installer::globals::ismacbuild = 1; + if ( $installer::globals::packageformat eq "dmg" ) { $installer::globals::ismacdmgbuild = 1; @@ -300,6 +301,8 @@ sub setglobalvariables if ( $installer::globals::compiler =~ /unxfbsd/ ) { + $installer::globals::isfreebsdbuild = 1; + if ( $installer::globals::packageformat eq "bsd" ) { $installer::globals::epmoutpath = "freebsd"; diff --git a/solenv/bin/modules/installer/servicesfile.pm b/solenv/bin/modules/installer/servicesfile.pm index 38c21a57593b..63e5f44125c8 100644 --- a/solenv/bin/modules/installer/servicesfile.pm +++ b/solenv/bin/modules/installer/servicesfile.pm @@ -133,12 +133,14 @@ sub register_unocomponents my $filestring = ""; for ( my $i = 0; $i <= $#{$unocomponents}; ++$i ) { + my $local_error1_occured = 0; + my $local_error2_occured = 0; + my $sourcepath = make_file_url(${$unocomponents}[$i]->{'sourcepath'}); my $urlprefix = ${$unocomponents}[$i]->{'NativeServicesURLPrefix'}; if (defined($urlprefix)) { - call_regcomp( - $regcompfileref, $servicesfile, $sourcepath, $urlprefix); + $local_error1_occured = call_regcomp($regcompfileref, $servicesfile, $sourcepath, $urlprefix); } else { @@ -148,11 +150,11 @@ sub register_unocomponents if (length($filestring) > $installer::globals::unomaxservices || ($i == $#{$unocomponents} && $filestring ne "")) { - call_regcomp( - $regcompfileref, $servicesfile, $filestring, - $nativeservicesurlprefix); + $local_error2_occured = call_regcomp($regcompfileref, $servicesfile, $filestring, $nativeservicesurlprefix); $filestring = ""; } + + if (( $local_error1_occured ) || ( $local_error2_occured )) { $error_occured = 1; } } return $error_occured; @@ -163,6 +165,8 @@ sub call_regcomp my ($regcompfileref, $servicesfile, $filestring, $urlprefix) = @_; my @regcompoutput = (); + my $error_occured = 0; + my $systemcall = "$installer::globals::wrapcmd $$regcompfileref -register -r ".fix_cygwin_path($servicesfile)." -c " . $installer::globals::quote . $filestring . $installer::globals::quote . " -wop=" . $installer::globals::quote . $urlprefix . $installer::globals::quote . " 2\>\&1 |"; open (REG, "$systemcall"); @@ -187,6 +191,8 @@ sub call_regcomp $infoline = "SUCCESS: $systemcall\n"; push( @installer::globals::logfileinfo, $infoline); } + + return $error_occured; } ################################################################ diff --git a/solenv/bin/modules/installer/setupscript.pm b/solenv/bin/modules/installer/setupscript.pm index e266832e6ba6..9da5340f915f 100644 --- a/solenv/bin/modules/installer/setupscript.pm +++ b/solenv/bin/modules/installer/setupscript.pm @@ -156,13 +156,28 @@ sub add_lowercase_productname_setupscriptvariable push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%UNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); + $newline = "\%SYSTEMINTUNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } + $newline = "\%UNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); $value = $original; $value =~ s/\s/\_/g; $value =~ s/\.//g; + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } $newline = "\%WITHOUTDOTUNIXPRODUCTNAME " . lc($value) . "\n"; push(@{$variablesref} ,$newline); + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $1 . $2 . $4; } + # if ( $value =~ /^\s*(.*?)\_(\w)(.*?)\_(\w)(.*)\s*$/ ) { $value = $2 . $4; } + $newline = "\%WITHOUTDOTUNIXPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); + $newline = "\%SOLARISBRANDPACKAGENAME " . lc($value) . "\n"; + push(@{$variablesref} ,$newline); + $value = $original; } elsif ( $key eq "PRODUCTEXTENSION" ) { @@ -482,4 +497,38 @@ sub add_forced_properties } } +##################################################################################### +# Some properties are created automatically. It should be possible to +# overwrite them, with PRESET properties. For example UNIXPRODUCTNAME +# with PRESETUNIXPRODUCTNAME, if this is defined and the automatic process +# does not deliver the desired results. +##################################################################################### + +sub replace_preset_properties +{ + my ($allvariables) = @_; + + # SOLARISBRANDPACKAGENAME + # needs to be replaced by + # PRESETSOLARISBRANDPACKAGENAME + + my @presetproperties = (); + push(@presetproperties, "SOLARISBRANDPACKAGENAME"); + push(@presetproperties, "SYSTEMINTUNIXPACKAGENAME"); + # push(@presetproperties, "UNIXPACKAGENAME"); + # push(@presetproperties, "WITHOUTDOTUNIXPACKAGENAME"); + # push(@presetproperties, "UNIXPRODUCTNAME"); + # push(@presetproperties, "WITHOUTDOTUNIXPRODUCTNAME"); + + + foreach $property ( @presetproperties ) + { + my $presetproperty = "PRESET" . $property; + if (( exists($allvariables->{$presetproperty}) ) && ( $allvariables->{$presetproperty} ne "" )) + { + $allvariables->{$property} = $allvariables->{$presetproperty}; + } + } +} + 1; diff --git a/solenv/bin/modules/installer/simplepackage.pm b/solenv/bin/modules/installer/simplepackage.pm index d18c4cb5745b..9666ef3e1af5 100644 --- a/solenv/bin/modules/installer/simplepackage.pm +++ b/solenv/bin/modules/installer/simplepackage.pm @@ -111,7 +111,7 @@ sub register_extensions { my $oneextension = $extensiondir . $installer::globals::separator . ${$allextensions}[$i]; - # my $systemcall = $unopkgfile . " add --shared " . "\"" . $oneextension . "\""; + # my $systemcall = $unopkgfile . " add --shared --suppress-license " . "\"" . $oneextension . "\""; if ( ! -f $unopkgfile ) { installer::exiter::exit_program("ERROR: $unopkgfile not found!", "register_extensions"); } if ( ! -f $oneextension ) { installer::exiter::exit_program("ERROR: $oneextension not found!", "register_extensions"); } @@ -131,7 +131,7 @@ sub register_extensions $localtemppath =~ s/\\/\//g; $localtemppath = "/".$localtemppath; } - my $systemcall = $unopkgfile . " add --shared --verbose " . $oneextension . " -env:UserInstallation=file://" . $localtemppath . " 2\>\&1 |"; + my $systemcall = $unopkgfile . " add --shared --suppress-license --verbose " . $oneextension . " -env:UserInstallation=file://" . $localtemppath . " 2\>\&1 |"; print "... $systemcall ...\n"; @@ -354,13 +354,16 @@ sub replace_variables_in_scriptfile ############################################# # Creating the "simple" package. # "zip" for Windows -# "dmg" on Mac OS X # "tar.gz" for all other platforms +# additionally "dmg" on Mac OS X ############################################# sub create_package { - my ( $installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref ) = @_; + my ( $installdir, $archivedir, $packagename, $allvariables, $includepatharrayref, $languagestringref, $format ) = @_; + + installer::logger::print_message( "... creating $installer::globals::packageformat file ...\n" ); + installer::logger::include_header_into_logfile("Creating $installer::globals::packageformat file:"); # moving dir into temporary directory my $pid = $$; # process id @@ -372,9 +375,9 @@ sub create_package installer::systemactions::rename_directory($installdir, $tempdir); # creating new directory with original name - installer::systemactions::create_directory($installdir); + installer::systemactions::create_directory($archivedir); - my $archive = $installdir . $installer::globals::separator . $packagename . $installer::globals::archiveformat; + my $archive = $archivedir . $installer::globals::separator . $packagename . $format; if ( $archive =~ /zip$/ ) { @@ -391,7 +394,6 @@ sub create_package } elsif ( $archive =~ /dmg$/ ) { - installer::worker::put_scpactions_into_installset("$tempdir/$packagename"); my $folder = (( -l "$tempdir/$packagename/Applications" ) or ( -l "$tempdir/$packagename/opt" )) ? $packagename : "\."; if ( $allvariables->{'PACK_INSTALLED'} ) { @@ -606,10 +608,22 @@ sub create_simple_package } } + # Work around Windows problems with long pathnames (see issue 50885) by + # putting the to-be-archived installation tree into the temp directory + # instead of the module output tree (unless LOCALINSTALLDIR dictates + # otherwise, anyway); can be removed once issue 50885 is fixed: + my $tempinstalldir = $installdir; + if ( $installer::globals::iswindowsbuild && + $installer::globals::packageformat eq "archive" && + !$installer::globals::localinstalldirset ) + { + $tempinstalldir = File::Temp::tempdir; + } + # Creating subfolder in installdir, which shall become the root of package or zip file my $subfolderdir = ""; - if ( $packagename ne "" ) { $subfolderdir = $installdir . $installer::globals::separator . $packagename; } - else { $subfolderdir = $installdir; } + if ( $packagename ne "" ) { $subfolderdir = $tempinstalldir . $installer::globals::separator . $packagename; } + else { $subfolderdir = $tempinstalldir; } if ( ! -d $subfolderdir ) { installer::systemactions::create_directory($subfolderdir); } @@ -756,23 +770,19 @@ sub create_simple_package installer::logger::include_header_into_logfile("Registering extensions:"); register_extensions($subfolderdir, $languagestringref); - # Adding scpactions for mac installations sets, that use not dmg format. Without scpactions the - # office does not start. - - if (( $installer::globals::packageformat eq "installed" ) && ( $installer::globals::compiler =~ /^unxmacx/ )) + if ( $installer::globals::compiler =~ /^unxmacx/ ) { installer::worker::put_scpactions_into_installset("$installdir/$packagename"); } # Creating archive file - if (( $installer::globals::packageformat eq "archive" ) || ( $installer::globals::packageformat eq "dmg" )) + if ( $installer::globals::packageformat eq "archive" ) + { + create_package($tempinstalldir, $installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref, $installer::globals::archiveformat); + } + elsif ( $installer::globals::packageformat eq "dmg" ) { - # creating a package - # -> zip for Windows - # -> tar.gz for all other platforms - installer::logger::print_message( "... creating $installer::globals::packageformat file ...\n" ); - installer::logger::include_header_into_logfile("Creating $installer::globals::packageformat file:"); - create_package($installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref); + create_package($installdir, $installdir, $packagename, $allvariables, $includepatharrayref, $languagestringref, ".dmg"); } # Analyzing the log file diff --git a/solenv/bin/modules/installer/systemactions.pm b/solenv/bin/modules/installer/systemactions.pm index d36e2133e825..bbc65d3c1f7a 100644 --- a/solenv/bin/modules/installer/systemactions.pm +++ b/solenv/bin/modules/installer/systemactions.pm @@ -55,7 +55,12 @@ sub create_directory $infoline = "\nCreated directory: $directory\n"; push(@installer::globals::logfileinfo, $infoline); - my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; + my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; + system($localcall); + + # chmod 0775 is not sufficient on mac to remove sticky tag + $localcall = "chmod a-s $directory \>\/dev\/null 2\>\&1"; + system($localcall); } else { @@ -1397,7 +1402,11 @@ sub try_to_create_directory $infoline = "\nCreated directory: $directory\n"; push(@installer::globals::logfileinfo, $infoline); - my $localcall = "chmod 775 $directory \>\/dev\/null 2\>\&1"; + my $localcall = "chmod 0775 $directory \>\/dev\/null 2\>\&1"; + system($localcall); + + # chmod 0775 is not sufficient on mac to remove sticky tag + $localcall = "chmod a-s $directory \>\/dev\/null 2\>\&1"; system($localcall); } else diff --git a/solenv/bin/modules/installer/windows/directory.pm b/solenv/bin/modules/installer/windows/directory.pm index 2ad207731b51..2a9463f508a1 100644 --- a/solenv/bin/modules/installer/windows/directory.pm +++ b/solenv/bin/modules/installer/windows/directory.pm @@ -320,6 +320,7 @@ sub add_root_directories if ( $allvariableshashref->{'SUNDIR'} ) { + if ( $allvariableshashref->{'SUNDIRNAME'} ) { $installer::globals::sundirname = $allvariableshashref->{'SUNDIRNAME'}; } $oneline = "sundirectory\t$installer::globals::programfilesfolder\t$installer::globals::sundirname$sourcediraddon\n"; push(@{$directorytableref}, $oneline); diff --git a/solenv/bin/modules/installer/windows/msiglobal.pm b/solenv/bin/modules/installer/windows/msiglobal.pm index 0d3abe886b03..9f2d21f8b7f8 100644 --- a/solenv/bin/modules/installer/windows/msiglobal.pm +++ b/solenv/bin/modules/installer/windows/msiglobal.pm @@ -58,7 +58,7 @@ sub write_ddf_file_header push(@{$ddffileref} ,$oneline); $oneline = ".Set ReservePerCabinetSize=128\n"; # This reserves space for a digital signature. push(@{$ddffileref} ,$oneline); - $oneline = ".Set MaxDiskSize=CDROM\n"; # This allows the .cab file to be as large as needed. + $oneline = ".Set MaxDiskSize=2147483648\n"; # This allows the .cab file to get a size of 2 GB. push(@{$ddffileref} ,$oneline); $oneline = ".Set CompressionType=LZX\n"; push(@{$ddffileref} ,$oneline); @@ -1877,15 +1877,22 @@ sub set_global_code_variables if ( $#{$languagesref} > 0 ) # more than one language { - if (( ${$languagesref}[1] =~ /jp/ ) || - ( ${$languagesref}[1] =~ /ko/ ) || - ( ${$languagesref}[1] =~ /zh/ )) + if (( $installer::globals::added_english ) && ( $#{$languagesref} == 1 )) # only multilingual because of added English { - $onelanguage = "multiasia"; + $onelanguage = ${$languagesref}[1]; # setting the first language, that is not english } else { - $onelanguage = "multiwestern"; + if (( ${$languagesref}[1] =~ /jp/ ) || + ( ${$languagesref}[1] =~ /ko/ ) || + ( ${$languagesref}[1] =~ /zh/ )) + { + $onelanguage = "multiasia"; + } + else + { + $onelanguage = "multiwestern"; + } } } else # only one language diff --git a/solenv/bin/modules/installer/windows/property.pm b/solenv/bin/modules/installer/windows/property.pm index 4679e0e19a1b..7b890d06d58f 100644 --- a/solenv/bin/modules/installer/windows/property.pm +++ b/solenv/bin/modules/installer/windows/property.pm @@ -540,7 +540,7 @@ sub set_languages_in_property_table if ($installer::globals::sofficeiconadded) # set in shortcut.pm { - $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.exe" . "\n"; + $onepropertyline = "ARPPRODUCTICON" . "\t" . "soffice.ico" . "\n"; push(@{$propertyfile}, $onepropertyline); } diff --git a/solenv/bin/modules/installer/windows/registry.pm b/solenv/bin/modules/installer/windows/registry.pm index 16174750d178..f2edd8d0e830 100644 --- a/solenv/bin/modules/installer/windows/registry.pm +++ b/solenv/bin/modules/installer/windows/registry.pm @@ -387,7 +387,7 @@ sub create_registry_table $registrytablename = $basedir . $installer::globals::separator . "Reg64.idt" . "." . $onelanguage; installer::files::save_file($registrytablename ,\@reg64table ); - my $infoline = "Created idt file: $registrytablename\n"; + $infoline = "Created idt file: $registrytablename\n"; push(@installer::globals::logfileinfo, $infoline); } } diff --git a/solenv/bin/modules/installer/windows/shortcut.pm b/solenv/bin/modules/installer/windows/shortcut.pm index dac740bcd9de..b15c7418352f 100644 --- a/solenv/bin/modules/installer/windows/shortcut.pm +++ b/solenv/bin/modules/installer/windows/shortcut.pm @@ -665,40 +665,25 @@ sub create_shortcut_table } } - # if it is part of the product, the soffice.exe has to be included into the icon table + # The soffice.ico has to be included into the icon table # as icon for the ARP applet - my $sofficefile = "soffice.exe"; - my $onefile = get_file_by_name($filesref, $sofficefile); + my $onefile = ""; + my $sofficefile = "soffice.ico"; - if ( $onefile ne "" ) - { - my $sourcepath = $onefile->{'sourcepath'}; - if (! installer::existence::exists_in_array($sourcepath, $iconfilecollector)) - { - unshift(@{$iconfilecollector}, $sourcepath); - $installer::globals::sofficeiconadded = 1; - } - } + my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath_classic(\$sofficefile, $includepatharrayref, 0); - # For language packs and patches the soffice.exe has to be included, even if it is not part of the product. - # Also as part of the ARP applet (no substitution needed for ProductName, because the file is not installed!) + if ($$sourcepathref eq "") { installer::exiter::exit_program("ERROR: Could not find $sofficefile as icon!", "create_shortcut_table"); } - if (( $onefile eq "" ) && (( $installer::globals::languagepack ) || ( $installer::globals::patch ))) + if (! installer::existence::exists_in_array($$sourcepathref, $iconfilecollector)) { - my $sourcepathref = installer::scriptitems::get_sourcepath_from_filename_and_includepath(\$sofficefile, $includepatharrayref, 1); - if ($$sourcepathref eq "") { installer::exiter::exit_program("ERROR: Could not find $sofficefile as icon in language pack!", "create_shortcut_table"); } - - if (! installer::existence::exists_in_array($$sourcepathref, $iconfilecollector)) - { - unshift(@{$iconfilecollector}, $$sourcepathref); - $installer::globals::sofficeiconadded = 1; - } - - my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; - push(@installer::globals::logfileinfo, $localinfoline); + unshift(@{$iconfilecollector}, $$sourcepathref); + $installer::globals::sofficeiconadded = 1; } + my $localinfoline = "Added icon file $$sourcepathref for language pack into icon file collector.\n"; + push(@installer::globals::logfileinfo, $localinfoline); + # Saving the file my $shortcuttablename = $basedir . $installer::globals::separator . "Shortcut.idt" . "." . $onelanguage; diff --git a/solenv/bin/modules/installer/windows/sign.pm b/solenv/bin/modules/installer/windows/sign.pm index 81ba78c8b218..70954bd9f5b1 100644 --- a/solenv/bin/modules/installer/windows/sign.pm +++ b/solenv/bin/modules/installer/windows/sign.pm @@ -929,7 +929,7 @@ sub get_ddf_file_header push(@{$ddffileref} ,$oneline); $oneline = ".Set ReservePerCabinetSize=128\n"; # This reserves space for a digital signature. push(@{$ddffileref} ,$oneline); - $oneline = ".Set MaxDiskSize=CDROM\n"; # This allows the .cab file to be as large as needed. + $oneline = ".Set MaxDiskSize=2147483648\n"; # This allows the .cab file to get a size of 2 GB. push(@{$ddffileref} ,$oneline); $oneline = ".Set CompressionType=LZX\n"; push(@{$ddffileref} ,$oneline); diff --git a/solenv/bin/modules/installer/windows/upgrade.pm b/solenv/bin/modules/installer/windows/upgrade.pm index d9d371fc1b56..49479b26bf49 100644 --- a/solenv/bin/modules/installer/windows/upgrade.pm +++ b/solenv/bin/modules/installer/windows/upgrade.pm @@ -47,7 +47,7 @@ sub create_upgrade_table # fix for problematic OOo 1.9 versions my $include_ooo_fix = 0; my $ooomaxnew = ""; - if (($installer::globals::product =~ /OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack )) + if (($installer::globals::product =~ /^\s*OpenOffice/i ) && ( ! ( $installer::globals::product =~ /SDK/i )) && ( ! $installer::globals::languagepack )) { $include_ooo_fix = 1; $ooomaxnew = "34.0.0"; diff --git a/solenv/bin/modules/installer/worker.pm b/solenv/bin/modules/installer/worker.pm index 94f5cc7461fd..ff1d172c9b8f 100644 --- a/solenv/bin/modules/installer/worker.pm +++ b/solenv/bin/modules/installer/worker.pm @@ -2652,15 +2652,13 @@ sub set_time_stamp } } -############################################## -# Include only files from install directory -# in pkgmap file. -############################################## -######################################## -# Generating pathes for cygwin. -######################################## +############################################################ +# Generating pathes for cygwin (first version) +# This function has problems with cygwin, if $tmpfilename +# contains many thousand files (OpenOffice SDK). +############################################################ -sub generate_cygwin_pathes +sub generate_cygwin_pathes_old { my ($filesref) = @_; @@ -2678,8 +2676,100 @@ sub generate_cygwin_pathes { ${$filesref}[$i]->{'cyg_sourcepath'} = $cyg_sourcepathlist[$i]; } + } +################################################# +# Generating pathes for cygwin (second version) +# This function generates smaller files for +################################################# + +sub generate_cygwin_pathes +{ + my ($filesref) = @_; + + installer::logger::include_timestamp_into_logfile("Starting generating cygwin pathes"); + + my $infoline = "Generating cygwin pathes (generate_cygwin_pathes)\n"; + push( @installer::globals::logfileinfo, $infoline); + + my $max = 5000; # number of pathes in one file + + my @pathcollector = (); + my $startnumber = 0; + my $counter = 0; + + for ( my $i = 0; $i <= $#{$filesref}; $i++ ) + { + my $line = ${$filesref}[$i]->{'sourcepath'} . "\n"; + push(@pathcollector, $line); + $counter++; + + if (( $i == $#{$filesref} ) || ((( $counter % $max ) == 0 ) && ( $i > 0 ))) + { + my $tmpfilename = "cygwinhelper_" . $i . ".txt"; + my $temppath = $installer::globals::temppath; + $temppath =~ s/\Q$installer::globals::separator\E\s*$//; + $tmpfilename = $temppath . $installer::globals::separator . $tmpfilename; + $infoline = "Creating temporary file for cygwin conversion: $tmpfilename (contains $counter pathes)\n"; + push( @installer::globals::logfileinfo, $infoline); + if ( -f $tmpfilename ) { unlink $tmpfilename; } + + installer::files::save_file($tmpfilename, \@pathcollector); + + my $success = 0; + my @cyg_sourcepathlist = qx{cygpath -w -f "$tmpfilename"}; + chomp @cyg_sourcepathlist; + + # Validating the array, it has to contain the correct number of values + my $new_pathes = $#cyg_sourcepathlist + 1; + if ( $new_pathes == $counter ) { $success = 1; } + + if ($success) + { + $infoline = "Success: Successfully converted to cygwin pathes!\n"; + push( @installer::globals::logfileinfo, $infoline); + } + else + { + $infoline = "ERROR: Failed to convert to cygwin pathes!\n"; + push( @installer::globals::logfileinfo, $infoline); + installer::exiter::exit_program("ERROR: Failed to convert to cygwin pathes!", "generate_cygwin_pathes"); + } + + for ( my $j = 0; $j <= $#cyg_sourcepathlist; $j++ ) + { + my $number = $startnumber + $j; + ${$filesref}[$number]->{'cyg_sourcepath'} = $cyg_sourcepathlist[$j]; + } + + if ( -f $tmpfilename ) { unlink $tmpfilename; } + + @pathcollector = (); + $startnumber = $startnumber + $max; + $counter = 0; + } + } + + # Checking existence fo cyg_sourcepath for every file + for ( my $i = 0; $i <= $#{$filesref}; $i++ ) + { + if (( ! exists(${$filesref}[$i]->{'cyg_sourcepath'}) ) || ( ${$filesref}[$i]->{'cyg_sourcepath'} eq "" )) + { + $infoline = "ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}\n"; + push( @installer::globals::logfileinfo, $infoline); + installer::exiter::exit_program("ERROR: No cygwin sourcepath defined for file ${$filesref}[$i]->{'sourcepath'}!", "generate_cygwin_pathes"); + } + } + + installer::logger::include_timestamp_into_logfile("Ending generating cygwin pathes"); +} + +############################################## +# Include only files from install directory +# in pkgmap file. +############################################## + sub filter_pkgmapfile { my ($pkgmapfile) = @_; @@ -2932,6 +3022,24 @@ sub key_in_a_is_also_key_in_b return $returnvalue; } +###################################################### +# Getting the first entry from a list of languages +###################################################### + +sub get_first_from_list +{ + my ( $list ) = @_; + + my $first = $list; + + if ( $list =~ /^\s*(.+?),(.+)\s*$/) # "?" for minimal matching + { + $first = $1; + } + + return $first; +} + ################################################ # Setting all spellchecker languages ################################################ @@ -2964,16 +3072,29 @@ sub set_spellcheckerlanguages { my $onelang = $1; my $languagelist = $2; - $spellcheckhash{$onelang} = $languagelist; - # Special handling for language packs. Do only include that one language of the language pack, no further language. - # And this only, if the language of the language pack is also already part of the language list + # Special handling for language packs. Only include the first language of the language list. + # If no spellchecker shall be included, the keyword "EMPTY" can be used. if ( $installer::globals::languagepack ) { - if ( $languagelist =~ /\b$onelang\b/ ) { $spellcheckhash{$onelang} = $onelang; } - else { $spellcheckhash{$onelang} = ""; } + my $first = get_first_from_list($languagelist); + + if ( $first eq "EMPTY" ) # no spellchecker into language pack + { + $languagelist = ""; + } + else + { + $languagelist = $first; + } } + else # no language pack, so EMPTY is not required + { + $languagelist =~ s/^\s*EMPTY\s*,//; # removing the entry EMPTY + } + + $spellcheckhash{$onelang} = $languagelist; } } diff --git a/solenv/bin/modules/installer/ziplist.pm b/solenv/bin/modules/installer/ziplist.pm index a434163b0dd9..00de1709473b 100644 --- a/solenv/bin/modules/installer/ziplist.pm +++ b/solenv/bin/modules/installer/ziplist.pm @@ -644,7 +644,8 @@ sub set_manufacturer my ($allvariables) = @_; my $openofficeproductname = "OpenOffice.org"; - my $sunname = "Sun Microsystems"; + my $sunname = ""; + if ( $allvariables->{'OPENSOURCE'} && $allvariables->{'OPENSOURCE'} == 1 ) { @@ -655,6 +656,8 @@ sub set_manufacturer else { $installer::globals::isopensourceproduct = 0; + if (( $allvariables->{'DEFINEDMANUFACTURER'} ) && ( $allvariables->{'DEFINEDMANUFACTURER'} ne "" )) { $sunname = $allvariables->{'DEFINEDMANUFACTURER'}; } + else { installer::exiter::exit_program("ERROR: Property DEFINEDMANUFACTURER has to be set for this product!", "set_manufacturer"); } $installer::globals::manufacturer = $sunname; $installer::globals::longmanufacturer = $sunname . ", Inc."; } diff --git a/solenv/bin/packregistry.xslt b/solenv/bin/packregistry.xslt new file mode 100644 index 000000000000..55558d55450c --- /dev/null +++ b/solenv/bin/packregistry.xslt @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!--********************************************************************** +* +* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +* +* Copyright 2000, 2010 Oracle and/or its affiliates. +* +* OpenOffice.org - a multi-platform office productivity suite +* +* This file is part of OpenOffice.org. +* +* OpenOffice.org is free software: you can redistribute it and/or modify +* it under the terms of the GNU Lesser General Public License version 3 +* only, as published by the Free Software Foundation. +* +* OpenOffice.org is distributed in the hope that it will be useful, +* but WITHOUT ANY WARRANTY; without even the implied warranty of +* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +* GNU Lesser General Public License version 3 for more details +* (a copy is included in the LICENSE file that accompanied this code). +* +* You should have received a copy of the GNU Lesser General Public License +* version 3 along with OpenOffice.org. If not, see +* <http://www.openoffice.org/license.html> +* for a copy of the LGPLv3 License. +* +**********************************************************************--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + xmlns:oor="http://openoffice.org/2001/registry"> + <xsl:strip-space elements="*"/> + <xsl:preserve-space elements="value"/> + <xsl:template match="/"> + <oor:data xmlns:xs="http://www.w3.org/2001/XMLSchema" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <xsl:copy-of select="list/dependency"/> +<!-- + <xsl:copy-of select="document(list/filename)/oor:component-schema"/> + <xsl:copy-of select="document(list/filename)/oor:component-data"/> + + instead of the below for-each would only issue warnings, not errors, for + non-existing or otherwise bad input files; it is important that the input + filename list is already sorted in an order suitable for the configmgr + (e.g., xcs files preceeding xcu files). +--> + <xsl:for-each select="list/filename"> + <xsl:choose> + <xsl:when test="count(document(.)/oor:component-schema) = 1"> + <xsl:apply-templates select="document(.)/oor:component-schema"/> + </xsl:when> + <xsl:when test="count(document(.)/oor:component-data) = 1"> + <xsl:apply-templates select="document(.)/oor:component-data"/> + </xsl:when> + <xsl:otherwise> + <xsl:message terminate="yes"> + <xsl:text>cannot process </xsl:text> + <xsl:value-of select="."/> + </xsl:message> + </xsl:otherwise> + </xsl:choose> + </xsl:for-each> + </oor:data> + </xsl:template> + <xsl:template + match="oor:component-schema|oor:component-data|templates|component|group| + set|node-ref|prop|item|value|node"> + <xsl:copy copy-namespaces="no"> + <!-- prune oor:component-data xmlns:install="..." namespaces (would only + work in XSLT 2.0, however) --> + <xsl:for-each select="@*"> + <xsl:attribute name="{name()}"> + <xsl:value-of select="."/> + </xsl:attribute> + </xsl:for-each> + <xsl:apply-templates/> + </xsl:copy> + </xsl:template> + <xsl:template match="info|import|uses|constraints"/> + <!-- TODO: no longer strip elements when they are eventually read by + configmgr implementation --> +</xsl:stylesheet> diff --git a/solenv/bin/receditor b/solenv/bin/receditor index 1011aeb5d826..1b4046010485 100755 --- a/solenv/bin/receditor +++ b/solenv/bin/receditor @@ -3,4 +3,4 @@ if [ x${SOLARENV}x = xx ]; then echo No environment found, please use 'configure' or 'setsolar' exit 1 fi -exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -DUSE_SHELL= -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/receditor.jar +exec java -DSOLARSRC=${SOLARSRC} -DWORK_STAMP=${WORK_STAMP} -jar ${SOLARVER}/${INPATH}/bin${UPDMINOREXT}/receditor.jar diff --git a/solenv/bin/reportErrorCheckAPI.btm b/solenv/bin/reportErrorCheckAPI.btm deleted file mode 100755 index 4340ad347259..000000000000 --- a/solenv/bin/reportErrorCheckAPI.btm +++ /dev/null @@ -1,17 +0,0 @@ -set ERRORCODE=%1% -iff exist %SOLARENV%/bin/cwstestresult.pl then - iff %ERRORCODE% EQ 0 then - set PT_STATUS=%2% - else - iff %ERRORCODE% EQ 1 then - set PT_STATUS=failed - else - set PT_STATUS=incomplete - endiff - endiff - - set CWSENV=Windows - call perl5 %SOLARENV%/bin/cwstestresult.pl -c %CWS_WORK_STAMP% -n CWSCheckAPI -p %CWSENV% %PT_STATUS% -else - echo "No cwstestresult.pl found." -endiff diff --git a/solenv/bin/subsequenttests b/solenv/bin/subsequenttests new file mode 100755 index 000000000000..f0d86db89101 --- /dev/null +++ b/solenv/bin/subsequenttests @@ -0,0 +1,131 @@ +eval 'exec "$PERL" -Sw "$0" "$@"' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2000, 2010 Oracle and/or its affiliates. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# <http://www.openoffice.org/license.html> +# for a copy of the LGPLv3 License. +# +#***********************************************************************/ + +use lib("$ENV{SOLARENV}/bin/modules"); +use SourceConfig; + +my $max_running = 1; +while (@ARGV) { + my $arg = shift(@ARGV); + if ($arg =~ /^-P([1-9]\d*)$/) { + $max_running = $1; + } elsif ($arg eq '--') { + last; + } else { + print STDERR "unknown argument \"$arg\"\n"; + print STDERR "usage: $0 [-P<n>] [-- <args>]\n"; + print STDERR " -P<n> number of parallel dmake invocations\n"; + print STDERR " <args> are passed to dmake invocations\n"; + exit(1); + } +} + +my @testpaths = (); +my $sc = SourceConfig->new(); +my $module; +foreach $module ($sc->get_active_modules()) { + my $buildlst = $sc->get_module_build_list($module); + next unless defined($buildlst); + my %deps = (); + open(BUILDLST, $buildlst) or die("cannot open $buildlst"); + while (<BUILDLST>) { + next unless + /^\s*\w+\s+(\S+)\s+nmake\s+-\s+all\s+(\S+)(\s+(:?\S+\s+)*)NULL\s*$/; + my ($dir, $id, $ids) = ($1, $2, $3); + $dir =~ s|\\|/|g; + $dir =~ s|^[^/]+||; + my $path = $sc->get_module_path($module) . $dir; + my $makefile = $path . '/makefile.mk'; + open(MAKEFILE, $makefile) or die("cannot open $makefile"); + while (<MAKEFILE>) { + if (/\bOOO_SUBSEQUENT_TESTS\b/) { + push(@testpaths, $path); + $deps{$id} = $ids; + last; + } + } + close(MAKEFILE); + } + close(BUILDLST); + my $id1; + foreach $id1 (keys(%deps)) { + my ($id2, $ids); + while (($id2, $ids) = each(%deps)) { + $ids !~ /\s\Q$id1\E\s/ or die("$module: $id2 depends on $id1"); + } + } +} + +my $cmd = 'dmake'; +foreach (@ARGV) { + s/'/'\''/g; + $cmd .= " '" . $_ . "'"; +} +$cmd .= ' 2>&1 |'; + +my %pids = (); +my @failedpaths = (); +my $running = 0; +my $counter = 0; +while (@testpaths || $running > 0) { + while (@testpaths && $running < $max_running) { + my $testpath = shift(@testpaths); + ++$counter; + print("$counter: make $testpath\n"); + my $pid = fork(); + defined($pid) or die("$counter: $!"); + if ($pid == 0) { + chdir($testpath) or die("$counter: $!"); + $ENV{'OOO_SUBSEQUENT_TESTS'} = 'x'; + open(OUTPUT, $cmd) or die("$counter: $!"); + while (<OUTPUT>) { + s/\r?\n$//; + print("$counter: $_\n"); + } + close(OUTPUT); + exit($? == 0 ? 0 : 1); + } + $pids{$pid} = $testpath; + ++$running; + } + my $pid = wait(); + $pid != -1 or die($!); + my $testpath = delete($pids{$pid}); + defined($testpath) or die("unmatched PID $pid"); + if ($? != 0) { + @testpaths = (); + push(@failedpaths, $testpath); + } + --$running; +} +my $failedpath; +foreach $failedpath (@failedpaths) { + print STDERR "failed in $failedpath\n"; +} +exit(scalar(@failedpaths) == 0 ? 0 : 1); |