You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2012/03/16 13:58:50 UTC
svn commit: r1301475 - in /incubator/ooo/trunk/main: ./
desktop/source/deployment/manager/ scp2/source/ooo/ solenv/bin/
solenv/bin/modules/ solenv/bin/modules/installer/
Author: af
Date: Fri Mar 16 12:58:50 2012
New Revision: 1301475
URL: http://svn.apache.org/viewvc?rev=1301475&view=rev
Log:
119050: Added main/extensions.lst for automatic inclusion of extensions.
Added:
incubator/ooo/trunk/main/extensions.lst
incubator/ooo/trunk/main/solenv/bin/download_missing_extensions.pl
incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm
Modified:
incubator/ooo/trunk/main/bootstrap.1
incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_extensionmanager.cxx
incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_informationprovider.cxx
incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_manager.cxx
incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
incubator/ooo/trunk/main/solenv/bin/make_installer.pl
incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm
Modified: incubator/ooo/trunk/main/bootstrap.1
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bootstrap.1?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bootstrap.1 (original)
+++ incubator/ooo/trunk/main/bootstrap.1 Fri Mar 16 12:58:50 2012
@@ -130,3 +130,6 @@ else
fi
fi
+
+# Download missing extensions.
+download_missing_extensions.pl
Modified: incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_extensionmanager.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_extensionmanager.cxx?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_extensionmanager.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_extensionmanager.cxx Fri Mar 16 12:58:50 2012
@@ -239,10 +239,12 @@ ExtensionManager::getPackageManager(::rt
xPackageManager = getTmpRepository();
else if (repository.equals(OUSTR("bak")))
xPackageManager = getBakRepository();
+ else if (repository.equals(OUSTR("bundled_prereg")))
+ xPackageManager = m_xPackageManagerFactory->getPackageManager(repository);
else
throw lang::IllegalArgumentException(
OUSTR("No valid repository name provided."),
- static_cast<cppu::OWeakObject*>(this), 0);
+ static_cast<cppu::OWeakObject*>(this), 0);
return xPackageManager;
}
@@ -1179,6 +1181,7 @@ uno::Sequence< uno::Sequence<Reference<d
uno::Sequence<Reference<deploy::XPackage> > bundledExt =
getBundledRepository()->getDeployedPackages(xAbort, xCmdEnv);
addExtensionsToMap(mapExt, bundledExt, OUSTR("bundled"));
+ addExtensionsToMap(mapExt, bundledExt, OUSTR("bundled_prereg"));
//copy the values of the map to a vector for sorting
::std::vector< ::std::vector<Reference<deploy::XPackage> > >
Modified: incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_informationprovider.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_informationprovider.cxx?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_informationprovider.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_informationprovider.cxx Fri Mar 16 12:58:50 2012
@@ -162,6 +162,10 @@ PackageInformationProvider::getPackageLo
{
aLocationURL = getPackageLocation( UNISTRING("bundled"), _sExtensionId );
}
+ if ( aLocationURL.getLength() == 0 )
+ {
+ aLocationURL = getPackageLocation( UNISTRING("bundled_prereg"), _sExtensionId );
+ }
if ( aLocationURL.getLength() )
{
::ucbhelper::Content aContent( aLocationURL, NULL );
Modified: incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_manager.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_manager.cxx?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_manager.cxx (original)
+++ incubator/ooo/trunk/main/desktop/source/deployment/manager/dp_manager.cxx Fri Mar 16 12:58:50 2012
@@ -377,7 +377,7 @@ Reference<deployment::XPackageManager> P
//configmgr.ini also used $BUNDLED_EXTENSIONS_PREREG to refer to the xcu file
//which contain the replacement for %origin%.
that->m_activePackages = OUSTR(
- "vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
+ "vnd.sun.star.expand:$BUNDLED_EXTENSIONS_PREREG");
that->m_registrationData = OUSTR(
"vnd.sun.star.expand:$BUNDLED_EXTENSIONS_PREREG");
that->m_registryCache = OUSTR(
@@ -1362,7 +1362,7 @@ bool PackageManagerImpl::synchronizeRemo
bool PackageManagerImpl::synchronizeAddedExtensions(
Reference<task::XAbortChannel> const & xAbortChannel,
Reference<css::ucb::XCommandEnvironment> const & xCmdEnv)
-{
+{
bool bModified = false;
OSL_ASSERT(!m_context.equals(OUSTR("user")));
@@ -1481,7 +1481,9 @@ bool PackageManagerImpl::synchronizeAdde
}
catch (uno::Exception &)
{
- OSL_ASSERT(0);
+ // Looks like exceptions being caught here is not an
+ // uncommon case.
+ OSL_TRACE("caught exception in PackageManagerImpl::synchronizeAddedExtensions");
}
}
return bModified;
Added: incubator/ooo/trunk/main/extensions.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/extensions.lst?rev=1301475&view=auto
==============================================================================
--- incubator/ooo/trunk/main/extensions.lst (added)
+++ incubator/ooo/trunk/main/extensions.lst Fri Mar 16 12:58:50 2012
@@ -0,0 +1,66 @@
+#**************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+# This file defines the list of extensions that are preregistered or bundled with the pack sets.
+# At first office start the installation of extensions is completed.
+
+# file:// URLs are interpreted relative to the solver/340/<platform>/bin/ directory to which
+# built extensions are delivered by default.
+
+# http:// URLs can be prefixed by an MD5 checksum. If that is present then it is an error if
+# the file pointed to by the URL has a different MD5 checksum.
+
+
+# Some extensions that are (or are not) installed indepently of the language.
+
+[ language=all && ENABLE_PRESENTER_SCREEN=YES ]
+ file://presenter/presenter-screen.oxt
+
+[ language=all && ENABLE_MINIMIZER=YES ]
+ file://minimizer/presentation-minimizer.oxt
+
+
+
+# Extensions for english.
+[ language=en.* ]
+
+ # Generic
+ b7ce02d25eb302e5b23572cdccaea461 http://numbertext.org/tmp/dict-en.oxt
+
+ # Canada (en_CA)
+ e545415a4c813075c67ea58ea99802e5 http://extensions.services.openoffice.org/e-files/1263/1/en_CA_2_0_0.oxt
+
+ # USA (en_US)
+ e2eab80772ab1aa09716954219351a80 http://extensions.services.openoffice.org/e-files/1470/1/en_US.oxt
+
+ # Australia (en_AU)
+ 68bfee769199749288c5e1aaf200a1ca http://extensions.services.openoffice.org/e-files/1232/7/dict-en-au-2008-12-15.oxt
+
+ # South Africa (en_ZA)
+ c0c052e01b124a9ca5739facdb3ddbd5 http://extensions.services.openoffice.org/e-files/3089/0/dict-en_ZA-2009.10.22.oxt
+
+ # New Zealand (en_NZ)
+ 87123666ecce441b075c0170fa58690c http://extensions.services.openoffice.org/e-files/1665/1/dict-en-nz-2008-12-03.oxt
+
+
+# Extensions for german (Germany).
+[ language=de || language=de-DE ]
+ eb3d3397b8034c7fce6e0d78daf914ca http://extensions.services.openoffice.org/e-files/1075/10/dict-de_DE-frami_2011-06-03.oxt
Modified: incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp (original)
+++ incubator/ooo/trunk/main/scp2/source/ooo/common_brand.scp Fri Mar 16 12:58:50 2012
@@ -227,6 +227,12 @@ Directory gid_Brand_Dir_Share_Prereg
Styles = (CREATE);
End
+Directory gid_Brand_Dir_Share_Prereg_Bundled
+ ParentID = gid_Brand_Dir_Share_Prereg;
+ DosName = "bundled";
+ Styles = (CREATE);
+End
+
Directory gid_Brand_Dir_Share_Extensions_Install
ParentID = gid_Brand_Dir_Share_Extensions;
DosName = "install";
Added: incubator/ooo/trunk/main/solenv/bin/download_missing_extensions.pl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/download_missing_extensions.pl?rev=1301475&view=auto
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/download_missing_extensions.pl (added)
+++ incubator/ooo/trunk/main/solenv/bin/download_missing_extensions.pl Fri Mar 16 12:58:50 2012
@@ -0,0 +1,27 @@
+#! /usr/bin/perl -w
+
+#**************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+use lib ("$ENV{SOLARENV}/bin/modules");
+use ExtensionsLst;
+
+ExtensionsLst::DownloadExtensions();
Modified: incubator/ooo/trunk/main/solenv/bin/make_installer.pl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/make_installer.pl?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/make_installer.pl (original)
+++ incubator/ooo/trunk/main/solenv/bin/make_installer.pl Fri Mar 16 12:58:50 2012
@@ -801,7 +801,8 @@ for ( my $n = 0; $n <= $#installer::glob
$filesinproductlanguageresolvedarrayref = installer::scriptitems::add_bundled_extension_blobs( $filesinproductlanguageresolvedarrayref);
if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles8b.log", $filesinproductlanguageresolvedarrayref); }
- $filesinproductlanguageresolvedarrayref = installer::scriptitems::add_bundled_prereg_extensions( $filesinproductlanguageresolvedarrayref);
+ ($filesinproductlanguageresolvedarrayref,$dirsinproductarrayref) = installer::scriptitems::add_bundled_prereg_extensions(
+ $filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
if ( $installer::globals::globallogging ) { installer::files::save_array_of_hashes($loggingdir . "productfiles8c.log", $filesinproductlanguageresolvedarrayref); }
installer::scriptitems::get_Destination_Directory_For_Item_From_Directorylist($filesinproductlanguageresolvedarrayref, $dirsinproductarrayref);
Added: incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm?rev=1301475&view=auto
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm (added)
+++ incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm Fri Mar 16 12:58:50 2012
@@ -0,0 +1,531 @@
+#**************************************************************
+#
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+#**************************************************************
+
+package ExtensionsLst;
+
+use File::Spec;
+use LWP::UserAgent;
+use Digest::MD5;
+
+use base 'Exporter';
+our @EXPORT = qw(DownloadExtensions GetExtensionList);
+
+
+=head1 NAME
+
+ ExtensionLst.pm - Functionality for the interpretation of the main/extensions.lst file.
+
+=head1 SYNOPSIS
+
+ For downloading extensions during build setup:
+
+ use ExtensionsLst;
+ ExtensionsLst::DownloadExtensions();
+
+ For including extensions into the pack set:
+
+ use ExtensionsLst;
+ ExtensionsLst::GetExtensionList(@language_list);
+
+=head1 DESCRIPTION
+
+ The contents of the extensions.lst file are used at two times in
+ the process of building pack sets.
+
+ Once at the beginning right after configure is run the
+ DownloadExtensions() function determines the list of extensions
+ that are not present locally and downloads them.
+
+ The second time is after all modules are built (and the locally
+ built extensions are present) and the pack sets are created. For
+ every language (or sets of lanugages) a set of extensions is
+ collected and included into the pack set.
+
+ The content of the extensions.lst file is ignored when the --with-extensions option is given to configure.
+
+=cut
+
+
+# Number of the line in extensions.lst that is currently being processed.
+my $LineNo = 0;
+
+
+=head3 Prepare
+ Check that some environment variables are properly set and then return the file name
+ of the 'extensions.lst' file, typically located in main/ beside 'ooo.lst'.
+=cut
+sub Prepare ()
+{
+ die "can not access environment varianle SRC_ROOT" if ! defined $ENV{'SRC_ROOT'};
+ die "can not determine the platform: INPATH is not set" if ! defined $ENV{'INPATH'};
+ die "can not determine solver directory: OUTDIR is not set" if ! defined $ENV{'OUTDIR'};
+ die "can not determine download directory: TARFILE_LOCATION is not set" if ! defined $ENV{'TARFILE_LOCATION'};
+
+ my $candidate = File::Spec->catfile($ENV{SRC_ROOT}, "extensions.lst");
+ die "can not read file $candidate" if ! -r $candidate;
+ return $candidate;
+}
+
+
+
+=head 3 EvaluateOperator
+ Evaluate a single test statement like 'language = en.*'.
+ Special handling for operators '=', '==', and 'eq' which are all mapped to '=~'.
+ Therefore the right hand side may be a perl regexp. It is prefixed with '^'.
+
+ Other operators are at the moment only supported in the way that they are evaluated via eval().
+=cut
+sub EvaluateOperator ($$$)
+{
+ my ($left,$operator,$right) = @_;
+
+ my $result;
+
+ if ($operator =~ /^(=|==|eq)$/)
+ {
+ if ($left =~ /^$right$/)
+ {
+ $result = 1;
+ }
+ else
+ {
+ $result = 0;
+ }
+ }
+ elsif (eval($left.$operator.$right))
+ {
+ $result = 1;
+ }
+ else
+ {
+ $result = 0;
+ }
+
+ return $result;
+}
+
+
+
+
+=head EvaluateTerm
+ Evaluate a string that contains a simple test term of the form
+ left operator right
+ with arbitrary spacing allowed around and between the three parts.
+
+ The left hand side is specially handled:
+
+ - When the left hand side is 'language' then it is replaced by
+ any of the given languages in turn. When the term evaluates to true for any of the languages then
+ true is returned. False is returned only when none of the given languages matches.
+
+ - When the left hand side consists only of upper case letters, digits, and '_' then it is
+ interpreted as the name of a environment variable. It is replaced by its value before the term
+ is evaluated.
+
+ - Any other left hand side is an error (at the moment.)
+=cut
+sub EvaluateTerm ($$)
+{
+ my $term = shift;
+ my $languages = shift;
+
+ my $result;
+
+ if ($term =~ /^\s*(\w+)\s*(\W+)\s*(.*?)\s*$/)
+ {
+ my ($left,$operator,$right) = ($1,$2,$3);
+
+ if ($operator !~ /^=|==|eq$/)
+ {
+ die "unsupported operator $operator on line $LineNo";
+ }
+
+ die "no right side in condition on line $LineNo ($term)" if ! defined $right;
+
+ if ($left =~ /^[A-Z_0-9]+$/)
+ {
+ # Uppercase words are interpreted as environment variables.
+ my $left_value = $ENV{$left};
+ $left_value = "" if ! defined $left_value;
+
+ # We can check whether the condition is fullfilled right now.
+ $result = EvaluateOperator($left_value, $operator, $right);
+ }
+ elsif ($left eq "language")
+ {
+ if ($right eq "all")
+ {
+ $result = 1;
+ }
+ elsif ($#$languages>=0)
+ {
+ $result = 0;
+ for my $language (@$languages)
+ {
+ # Unify naming schemes.
+ $language =~ s/_/-/g;
+ $right =~ s/_/-/g;
+
+ # Evaluate language regexp.
+ $result = EvaluateOperator($language, $operator, $right) ? 1 : 0;
+ last if $result;
+ }
+ }
+ else
+ {
+ # The set of languages is not yet known. Return true
+ # to include the following entries.
+ $result = 1;
+ }
+ }
+ elsif ($left eq "platform")
+ {
+ if ($right eq "all")
+ {
+ $result = 1;
+ }
+ else
+ {
+ # Evaluate platform regexp.
+ $result = EvaluateOperator($ENV{'INPATH'}, $operator, $right) ? 1 : 0;
+ }
+ }
+ else
+ {
+ die "can not handle left hand side $left on line $LineNo";
+ }
+ }
+ else
+ {
+ die "syntax error in expression on line $LineNo";
+ }
+
+ return $result;
+}
+
+
+
+
+=head3 EvaluateSelector
+ Evaluate the given expression that is expected to be list of terms of the form
+ left-hand-side operator right-hand-side
+ that are separated by logical operators
+ && ||
+ The expression is lazy evaluated left to right.
+=cut
+sub EvaluateSelector($$);
+sub EvaluateSelector($$)
+{
+ my $expression = shift;
+ my $languages = shift;
+
+ my $result = "";
+
+ if ($expression =~ /^\s*$/)
+ {
+ # Empty selector is always true.
+ return 1;
+ }
+ elsif ($expression =~ /^\s*(.*?)(&&|\|\|)\s*(.*)$/)
+ {
+ my ($term, $operator) = ($1,$2);
+ $expression = $3;
+
+ my $left_result = EvaluateTerm($term, $languages);
+ # Lazy evaluation of &&
+ return 0 if ($operator eq "&&" && !$left_result);
+ # Lazy evaluation of ||
+ return 1 if ($operator eq "||" && $left_result);
+ my $right_result = EvaluateSelector($expression, $languages);
+
+ if ($operator eq "&&")
+ {
+ return $left_result && $right_result;
+ }
+ else
+ {
+ return $left_result || $right_result;
+ }
+ }
+ elsif ($expression =~ /^\s*(.+?)\s$/)
+ {
+ return EvaluateTerm($1, $languages);
+ }
+ else
+ {
+ die "invalid expression syntax on line $LineNo ($expression)";
+ }
+}
+
+
+
+
+=head3 ProcessURL
+ Check that the given line contains an optional MD5 sum followed by
+ a URL for one of the protocols file, http, https
+ Return an array that contains the protocol, the name, the original
+ URL, and the MD5 sum from the beginning of the line.
+ The name of the URL depends on its protocol:
+ - for http(s) the part of the URL after the last '/'.
+ - for file URLS it is everything after the protocol://
+=cut
+sub ProcessURL ($)
+{
+ my $line = shift;
+
+ # Check that we are looking at a valid URL.
+ if ($line =~ /^\s*(\w{32}\s+)?([a-zA-Z]+)(:\/\/.*?\/)([^\/ \t]+)\s*$/)
+ {
+ my ($md5, $protocol, $name) = ($1,$2,$4);
+ my $URL = $2.$3.$4;
+
+ die "invalid URL protocol on line $LineNo:\n$line\n" if $protocol !~ /(file|http|https)/;
+
+ # For file URLs we use everything after :// as name.
+ if ($protocol eq "file")
+ {
+ $URL =~ /:\/\/(.*)$/;
+ $name = $1;
+ }
+
+ return [$protocol, $name, $URL, $md5];
+ }
+ else
+ {
+ die "invalid URL at line $LineNo:\n$line\n";
+ }
+}
+
+
+
+
+=head3 ParseExtensionsLst
+ Parse the extensions.lst file.
+
+ Lines that contain only spaces or comments or are empty are
+ ignored.
+
+ Lines that contain a selector, ie a test enclosed in brackets, are
+ evaluated. The following lines, until the next selector, are
+ ignored when the selector evaluates to false. When an empty list
+ of languages is given then any 'language=...' test is evaluated as
+ true.
+
+ All other lines are expected to contain a URL optionally preceded
+ by an MD5 sum.
+=cut
+sub ParseExtensionsLst ($$)
+{
+ my $file_name = shift;
+ my $languages = shift;
+
+ open my $in, "$file_name";
+
+ my $current_selector_value = 1;
+ my @URLs = ();
+
+ while (<$in>)
+ {
+ my $line = $_;
+ $line =~ s/[\r\n]+//g;
+ ++$LineNo;
+
+ # Strip away comments.
+ next if $line =~ /^\s*#/;
+
+ # Ignore empty lines.
+ next if $line =~ /^\s*$/;
+
+ # Process selectors
+ if ($line =~ /^\s*\[\s*(.*)\s*\]\s*$/)
+ {
+ $current_selector_value = EvaluateSelector($1, $languages);
+ }
+ else
+ {
+ if ($current_selector_value)
+ {
+ push @URLs, ProcessURL($line);
+ }
+ }
+ }
+
+ close $in;
+
+ return @URLs;
+}
+
+
+
+
+=head3 Download
+ Download a set of files that are specified via URLs.
+
+ File URLs are ignored here because they point to extensions that have not yet been built.
+
+ For http URLs there may be an optional MD5 checksum. If it is present then downloaded
+ files that do not match that checksum are an error and lead to abortion of the current process.
+ Files that have already been downloaded are not downloaded again.
+=cut
+sub Download (@)
+{
+ my @urls = @_;
+
+ my @missing = ();
+ my $download_path = $ENV{'TARFILE_LOCATION'};
+
+ # First check which (if any) extensions have already been downloaded.
+ for my $entry (@urls)
+ {
+ my ($protocol, $name, $URL, $md5sum) = @{$entry};
+
+ # We can not check the existence of file URLs because they point to extensions that
+ # have yet to be built.
+
+ next if $protocol ne "http";
+ my $candidate = File::Spec->catfile($download_path, $name);
+ if ( ! -f $candidate)
+ {
+ push @missing, $entry;
+ }
+ }
+ if ($#missing >= 0)
+ {
+ printf "downloading %d missing extension%s\n", $#missing+1, $#missing>0 ? "s" : "";
+ if ( ! -d $download_path)
+ {
+ mkdir File::Spec->catpath($download_path, "tmp")
+ || die "can not create tmp subdirectory of $download_path";
+ }
+ }
+ else
+ {
+ print "all downloadable extensions present\n";
+ return;
+ }
+
+ # Download the missing files.
+ for my $entry (@missing)
+ {
+ my ($protocol, $name, $URL, $md5sum) = @{$entry};
+
+ # Open a .part file for writing.
+ my $filename = File::Spec->catfile($download_path, $name);
+ my $temporary_filename = $filename . ".part";
+ open my $out, ">$temporary_filename";
+ binmode($out);
+
+ # Prepare md5
+ my $md5 = Digest::MD5->new();
+
+ # Download the extension.
+ my $agent = LWP::UserAgent->new();
+ $agent->timeout(10);
+ $agent->show_progress(1);
+ $agent->add_handler('response_data'
+ => sub{
+ my($response,$agent,$h,$data)=@_;
+ print $out $data;
+ $md5->add($data);
+ });
+ my $response = $agent->get($URL);
+ close $out;
+
+ # When download was successfull then check the md5 checksum and rename the .part file
+ # into the actual extension name.
+ if ($response->is_success())
+ {
+ if (defined $md5sum && length($md5sum)==32)
+ {
+ if ($md5sum eq $md5->digest())
+ {
+ print "md5 is OK\n";
+ }
+ else
+ {
+ unlink($temporary_filename);
+ die "downloaded file has the wrong md5 checksum";
+ }
+ }
+
+ rename($temporary_filename, $filename) || die "can not rename $temporary_filename to $filename";
+ }
+ else
+ {
+ die "failed to download $URL";
+ }
+ }
+}
+
+
+
+
+=head3 DownloadExtensions
+ This function is intended to be called during bootstrapping. It extracts the set of extensions
+ that will be used later, when the installation sets are built.
+=cut
+sub DownloadExtensions ()
+{
+ my $full_file_name = Prepare();
+ my @urls = ParseExtensionsLst($full_file_name, []);
+ Download(@urls);
+}
+
+
+
+
+=head3 GetExtensionList
+ This function is intended to be called when installation sets are built.
+ It expects two arguments:
+ - A protocol selector. Http URLs reference remotely located
+ extensions that will be bundled as-is into the installation
+ sets due to legal reasons. They are installed on first start
+ of the office.
+ File URLs reference extensions whose source code is part of
+ the repository. They are pre-registered when installation
+ sets are created. Their installation is finished when the
+ office is first started.
+ - A set of languages. This set determines which extensions
+ are returned and then included in an installation set.
+=cut
+sub GetExtensionList ($@)
+{
+ my $protocol_selector = shift;
+ my @language_list = @_;
+
+ my $full_file_name = Prepare();
+ my @urls = ParseExtensionsLst($full_file_name, \@language_list);
+
+ my @result = ();
+ for my $entry (@urls)
+ {
+ my ($protocol, $name, $URL, $md5sum) = @{$entry};
+ if ($protocol =~ /^$protocol_selector$/)
+ {
+ push @result, $name;
+ }
+ }
+
+ return @result;
+}
+
+
+1;
Modified: incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm?rev=1301475&r1=1301474&r2=1301475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/installer/scriptitems.pm Fri Mar 16 12:58:50 2012
@@ -35,6 +35,7 @@ use installer::systemactions;
use File::Spec;
use SvnRevision;
+use ExtensionsLst;
################################################################
# Resolving the GID for the directories defined in setup script
@@ -490,50 +491,157 @@ sub remove_not_required_spellcheckerlang
return \@filesarray;
}
+=head3 add_bundled_extension_blobs
+ Add entries for extension blobs to the global file list.
+ Extension blobs, unlike preregistered extensions, are not
+ extracted before included into a pack set.
+
+ The set of extensions to include is taken from the BUNDLED_EXTENSION_BLOBS
+ environment variable (typically set in configure.)
+
+ If that variable is not defined then the content of main/extensions.lst defines
+ the default set.
+
+ Extension blobs are placed in gid_Brand_Dir_Share_Extensions_Install.
+=cut
sub add_bundled_extension_blobs
{
my @filelist = @{$_[0]};
- my $bundleenv = $ENV{'BUNDLED_EXTENSION_BLOBS'};
- my $bundlesrc = $ENV{'TARFILE_LOCATION'};
- my @bundle_files = split(/\s+/, $bundleenv, -1);
- foreach my $filename ( @bundle_files) {
- my $basename = File::Basename::basename( $filename);
- my $onefile = {
- 'Dir' => 'gid_Brand_Dir_Share_Extensions_Install',
- 'Name' => $basename,
- 'Styles' => '(PACKED)',
- 'UnixRights' => '444',
- 'sourcepath' => $bundlesrc . $installer::globals::separator . $filename
- };
- push( @filelist, $onefile);
- push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n");
- }
-
+ my @bundle_files = ();
+ my $bundleenv = $ENV{'BUNDLED_EXTENSION_BLOBS'};
+ my $bundlesrc = $ENV{'TARFILE_LOCATION'};
+
+ if ($installer::globals::product =~ /(SDK|URE)/i )
+ {
+ # No extensions for the SDK.
+ }
+ elsif (defined $bundleenv)
+ {
+ # Use the list of extensions that was explicitly given to configure.
+ @bundle_files = split(/\s+/, $bundleenv, -1);
+ }
+ else
+ {
+ # Add the default rextensions for the current language set.
+ @bundle_files = ExtensionsLst::GetExtensionList("http|https", @installer::globals::languageproducts);
+ }
+
+ installer::logger::print_message(
+ sprintf("preparing %d extension blob%s for language%s %s:\n %s\n",
+ $#bundle_files + 1,
+ $#bundle_files!=0 ? "s" : "",
+ $#installer::globals::languageproducts!=0 ? "s" : "",
+ join(" ", @installer::globals::languageproducts),
+ join("\n ", @bundle_files)));
+
+ foreach my $filename ( @bundle_files)
+ {
+ my $basename = File::Basename::basename( $filename);
+ my $onefile = {
+ 'Dir' => 'gid_Brand_Dir_Share_Extensions_Install',
+ 'Name' => $basename,
+ 'Styles' => '(PACKED)',
+ 'UnixRights' => '444',
+ 'sourcepath' => $bundlesrc . $installer::globals::separator . $filename,
+ 'modules' => "gid_Module_Dictionaries",
+ 'gid' => "gid_File_Extension_".$basename
+ };
+ push( @filelist, $onefile);
+ push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n");
+ }
+
return \@filelist;
}
+=head3 add_bundled_prereg_extensions
+ Add entries for preregistered extensions to the global file list.
+
+ The set of extensions to include is taken from the BUNDLED_PREREG_EXTENSIONS
+ environment variable (typically set in configure.)
+
+ If that variable is not defined then the content of main/extensions.lst defines
+ the default set.
+
+ Preregistered extensions are placed in subdirectories of gid_Brand_Dir_Share_Prereg_Bundled.
+=cut
sub add_bundled_prereg_extensions
{
my @filelist = @{$_[0]};
+ my $dirsref = $_[1];
- my $bundleenv = $ENV{'BUNDLED_PREREG_EXTENSIONS'};
- my $bundlesrc = $ENV{'TARFILE_LOCATION'};
- my @bundle_files = split(/\s+/, $bundleenv, -1);
- foreach my $filename ( @bundle_files) {
- my $basename = File::Basename::basename( $filename);
- my $onefile = {
- 'Dir' => 'gid_Profileitem_Uno_Uno_Bundled_Extensions_Prereg',
- 'Name' => $basename,
- 'Styles' => '(PACKED,ARCHIVE)',
- 'UnixRights' => '444',
- 'sourcepath' => $bundlesrc . $installer::globals::separator . $filename
- };
- push( @filelist, $onefile);
- push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n");
- }
+ my @bundle_files = ();
+ my $bundleenv = $ENV{'BUNDLED_PREREG_EXTENSIONS'};
+
+ if ($installer::globals::product =~ /(SDK|URE)/i )
+ {
+ # No extensions for the SDK.
+ }
+ elsif (defined $bundleenv)
+ {
+ # Use the list of extensions that was explicitly given to configure.
+ @bundle_files = split(/\s+/, $bundleenv, -1);
+ }
+ else
+ {
+ # Add the default rextensions for the current language set.
+ @bundle_files = ExtensionsLst::GetExtensionList("file", @installer::globals::languageproducts);
+ }
+
+ installer::logger::print_message(
+ sprintf("preparing %d bundled extension%s for language%s %s:\n %s\n",
+ $#bundle_files + 1,
+ $#bundle_files!=0 ? "s" : "",
+ $#installer::globals::languageproducts!=0 ? "s" : "",
+ join(" ", @installer::globals::languageproducts),
+ join("\n ", @bundle_files)));
+
+ # Find the prereg directory entry so that we can create a new sub-directory.
+ my $parentdir_gid = "gid_Brand_Dir_Share_Prereg_Bundled";
+ my $parentdir = undef;
+ foreach my $dir (@{$dirsref})
+ {
+ if ($dir->{'gid'} eq $parentdir_gid)
+ {
+ $parentdir = $dir;
+ last;
+ }
+ }
+
+ foreach my $filename ( @bundle_files)
+ {
+ my $basename = File::Basename::basename( $filename);
+
+ # Create a new directory into which the extension will be installed.
+ my $dirgid = $parentdir_gid . "_" . $basename;
+ my $onedir = {
+ 'modules' => 'gid_Module_Root_Brand',
+ 'ismultilingual' => 0,
+ 'Styles' => '(CREATE)',
+ 'ParentID' => $parentdir_gid,
+ 'specificlanguage' => "",
+ 'haslanguagemodule' => 0,
+ 'gid' => $dirgid,
+ 'HostName' => $parentdir->{'HostName'} . $installer::globals::separator . $basename
+ };
+ push (@{$dirsref}, $onedir);
+
+ # Create a new file entry for the extension.
+ my $onefile = {
+ 'Dir' => $dirgid,
+ 'Name' => $basename,
+ 'Styles' => '(PACKED,ARCHIVE)',
+ 'UnixRights' => '444',
+ 'sourcepath' => File::Spec->catfile($ENV{'OUTDIR'}, "bin", $filename),
+ 'specificlanguage' => "",
+ 'modules' => "gid_Module_Dictionaries",
+ 'gid' => "gid_File_Extension_".$basename
+ };
+ push( @filelist, $onefile);
+ push( @installer::globals::logfileinfo, "\tbundling \"$filename\" extension\n");
+ }
- return \@filelist;
+ return (\@filelist, $dirsref);
}
################################################################################
@@ -2179,7 +2287,7 @@ sub collect_directories_from_filesarray
}
else
{
- # Adding the modules to the module list!
+ # Adding the modules to the module list!
$alldirectoryhash{$destinationpath}->{'modules'} = $alldirectoryhash{$destinationpath}->{'modules'} . "," . $onefile->{'modules'};
}
}