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/06/04 18:18:47 UTC
svn commit: r1346024 - in /incubator/ooo/trunk/main: bootstrap.1
external_libs.lst solenv/bin/download_external_libraries.pl
solenv/bin/modules/ExtensionsLst.pm
Author: af
Date: Mon Jun 4 16:18:46 2012
New Revision: 1346024
URL: http://svn.apache.org/viewvc?rev=1346024&view=rev
Log:
#i119732# Added alternative to fetch_tarballs.sh.
Added:
incubator/ooo/trunk/main/external_libs.lst
incubator/ooo/trunk/main/solenv/bin/download_external_libraries.pl
Modified:
incubator/ooo/trunk/main/bootstrap.1
incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm
Modified: incubator/ooo/trunk/main/bootstrap.1
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/bootstrap.1?rev=1346024&r1=1346023&r2=1346024&view=diff
==============================================================================
--- incubator/ooo/trunk/main/bootstrap.1 (original)
+++ incubator/ooo/trunk/main/bootstrap.1 Mon Jun 4 16:18:46 2012
@@ -39,7 +39,11 @@ chmod +x "$SRC_ROOT/solenv/bin/gccinstli
# fetch or update external tarballs
if [ "$DO_FETCH_TARBALLS" = "yes" ]; then
- $SRC_ROOT/fetch_tarballs.sh $SRC_ROOT/ooo.lst
+ if [ "X$USE_NEW_EXTLIB_DOWNLOAD" != "X" ]; then
+ download_external_libraries.pl $SRC_ROOT/external_libs.lst
+ else
+ $SRC_ROOT/fetch_tarballs.sh $SRC_ROOT/ooo.lst
+ fi
fi
# ------------------------------------------------------------------------------
Added: incubator/ooo/trunk/main/external_libs.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/external_libs.lst?rev=1346024&view=auto
==============================================================================
--- incubator/ooo/trunk/main/external_libs.lst (added)
+++ incubator/ooo/trunk/main/external_libs.lst Mon Jun 4 16:18:46 2012
@@ -0,0 +1,352 @@
+# Format of this file:
+#
+# Comments start with '#' and are ignored. Empty lines (only whitespace) are ignored.
+#
+# All other lines have one of two different formats:
+#
+# if (<logical-expression>)
+# starts a block that specifies the download site(s) of an external library.
+#
+# <name>=<value>
+# defines a variable. A definition after an "if" statement is only valid up to the next
+# "if" statement. Previous definitions are replaced.
+# <value> can contain references to other variables in the form $(<other-variable>)
+#
+# Some variables have special names:
+# MD5 defines the MD5 check-sum of a library
+# URL1 to URL9 define alternative download sites. The first one that provides the library
+# with matching MD5 wins.
+# name is the name under which the library tar-ball is stored. It overrides the name of the
+# downloaded file.
+
+# The fallback site for category-A libraries.
+SVN_TRUNK=http://svn.apache.org/repos/asf/!svn/bc/1336449/incubator/ooo/trunk/ext_sources/
+
+# The fallback site for category-B libraries.
+OOO_EXTRAS=http://ooo-extras.apache-extras.org.codespot.com/files/
+
+###############################################################################
+# Libraries with category A license
+#
+
+if ( true )
+ MD5 = 0168229624cfac409e766913506961a8
+ name = ucpp-1.3.2.tar.gz
+ URL1 = http://ucpp.googlecode.com/files/ucpp-1.3.2.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 067201ea8b126597670b5eff72e1f66c
+ name = mythes-1.2.0.tar.gz
+ URL1 = http://sourceforge.net/projects/hunspell/files/MyThes/1.2.0/mythes-1.2.0.tar.gz/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 128cfc86ed5953e57fe0f5ae98b62c2e
+ name = libtextcat-2.2.tar.gz
+ URL1 = http://software.wise-guys.nl/download/libtextcat-2.2.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 17410483b5b5f267aa18b7e00b65e6e0
+ name = hsqldb_1_8_0.zip
+ URL1 = http://sourceforge.net/projects/hsqldb/files/hsqldb/hsqldb_1_8_0/hsqldb_1_8_0_10.zip/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 1756c4fa6c616ae15973c104cd8cb256
+ name = Adobe-Core35_AFMs-314.tar.gz
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (SOLAR_JAVA=TRUE)
+ MD5 = 17960f35b2239654ba608cf1f3e256b3
+ name = lucene-2.9.4-src.tar.gz
+ URL1 = http://www.us.apache.org/dist/lucene/java/2.9.4/lucene-2.9.4-src.tar.gz
+ # Fall back to a version in SVN from a previous revsion.
+ URL2 = http://svn.apache.org/repos/asf/!svn/bc/1337615/incubator/ooo/trunk/ext_sources/$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 1f24ab1d39f4a51faf22244c94a6203f
+ name = xmlsec1-1.2.14.tar.gz
+ URL1 = ftp://ftp.aleksey.com/pub/xmlsec/releases/xmlsec1-1.2.14.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 284e768eeda0e2898b0d5bf7e26a016e
+ name = raptor-1.4.18.tar.gz
+ URL1 = http://download.librdf.org/source/raptor-1.4.18.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = ca66e26082cab8bb817185a116db809b
+ name = redland-1.0.8.tar.gz
+ URL1 = http://download.librdf.org/source/redland-1.0.8.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = fca8706f2c4619e2fa3f8f42f8fc1e9d
+ name = rasqal-0.9.16.tar.gz
+ URL1 = http://download.librdf.org/source/rasqal-0.9.16.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 2c9b0f83ed5890af02c0df1c1776f39b
+ name = commons-httpclient-3.1-src.tar.gz
+ URL1 = http://archive.apache.org/dist/httpcomponents/commons-httpclient/source/commons-httpclient-3.1-src.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 2e482c7567908d334785ce7d69ddfff7
+ name = commons-codec-1.6-src.tar.gz
+ URL1 = http://apache.spinellicreations.com//commons/codec/source/commons-codec-1.6-src.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 2f6ecca935948f7db92d925d88d0d078
+ name = icu4c-4_0_1-src.tgz
+ URL1 = http://download.icu-project.org/files/icu4c/4.0.1/icu4c-4_0_1-src.tgz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 3b179ed18f65c43141528aa6d2440db4
+ name = serf-1.0.0.tar.bz2
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 3c219630e4302863a9a83d0efde889db
+ name = commons-logging-1.1.1-src.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://www.alliedquotes.com/mirrors/apache//commons/logging/source/commons-logging-1.1.1-src.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 625ff5f2f968dd908bca43c9469d6e6b
+ name = commons-lang-2.4-src.tar.gz
+ URL1 = http://archive.apache.org/dist/commons/lang/source/commons-lang-2.4-src.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 63ddc5116488985e820075e65fbe6aa4
+ name = openssl-0.9.8o.tar.gz
+ URL1 = http://www.openssl.org/source/openssl-0.9.8o.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 666a5d56098a9debf998510e304c8095
+ name = apr-util-1.4.1.tar.gz
+ # Can not yet detect automatically the right mirror to use.
+ # URL1 = http://<some-apache-mirror>/apr/apr-util-1.4.1.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = c441926f3a552ed3e5b274b62e86af16
+ name = STLport-4.0.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://sourceforge.net/projects/stlport/files/STLport%20archive/STLport%204/STLport-4.0.tar.gz/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 18f577b374d60b3c760a3a3350407632
+ name = STLport-4.5.tar.gz
+ URL1 = http://sourceforge.net/projects/stlport/files/STLport%20archive/STLport%204/STLport-4.5.tar.gz/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 7376930b0d3f3d77a685d94c4a3acda8
+ name = STLport-4.5-0119.tar.gz
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 7740a8ec23878a2f50120e1faa2730f2
+ name = libxml2-2.7.6.tar.gz
+ URL1 = ftp://xmlsoft.org/libxml2/libxml2-2.7.6.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = e61d0364a30146aaa3001296f853b2b9
+ name = libxslt-1.1.26.tar.gz
+ URL1 = ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 7e4e73c21f031d5a4c93c128baf7fd75
+ name = apache-tomcat-5.5.35-src.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://apache.ziply.com/tomcat/tomcat-5/v5.5.35/bin/apache-tomcat-5.5.35.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 97262fe54dddaf583eaaee3497a426e1
+ name = apr-1.4.5.tar.gz
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = 980143f96b3f6ce45d2e4947da21a5e9
+ name = stax-src-1.2.0.zip
+ URL1 = http://dist.codehaus.org/stax/distributions/stax-src-1.2.0.zip
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = a2c10c04f396a9ce72894beb18b4e1f9
+ name = jpeg-8c.tar.gz
+ URL1 = http://www.ijg.org/files/jpegsrc.v8c.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = a7983f859eafb2677d7ff386a023bc40
+ name = xsltml_2.1.2.zip
+ URL1 = http://sourceforge.net/projects/xsltml/files/xsltml/v.2.1.2/xsltml_2.1.2.zip/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = bc702168a2af16869201dbe91e46ae48
+ name = LICENSE_Python-2.6.1
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = e81c2f0953aa60f8062c05a4673f2be0
+ name = Python-2.6.1.tar.bz2
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = c735eab2d659a96e5a594c9e8541ad63
+ name = zlib-1.2.5.tar.gz
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = cf8a6967f7de535ae257fa411c98eb88
+ name = mdds_0.3.0.tar.bz2
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = ea91f2fb4212a21d708aced277e6e85a
+ name = vigra1.4.0.tar.gz
+ URL1 = http://hci.iwr.uni-heidelberg.de/vigra/vigra1.4.0.tar.gz
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = ecb2e37e45c9933e2a963cabe03670ab
+ name = curl-7.19.7.tar.gz
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = ee8b492592568805593f81f8cdf2a04c
+ name = expat-2.0.1.tar.gz
+ URL1 = http://sourceforge.net/projects/expat/files/expat/2.0.1/expat-2.0.1.tar.gz/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (WITH_CATA_FONTS=YES)
+ MD5 = f872f4ac066433d8ff92f5e316b36ff9
+ name = dejavu-fonts-ttf-2.33.zip
+ URL1 = http://sourceforge.net/projects/dejavu/files/dejavu/2.33/dejavu-fonts-ttf-2.33.zip/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = fcc6df1160753d0b8c835d17fdeeb0a7
+ name = boost_1_39_0.tar.gz
+ URL1 = http://sourceforge.net/projects/boost/files/boost/1.39.0/boost_1_39_0.tar.gz/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if ( true )
+ MD5 = fdb27bfe2dbe2e7b57ae194d9bf36bab
+ name = SampleICC-1.3.2.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://sourceforge.net/projects/sampleicc/files/sampleicc/SampleICC%201.3.2/SampleICC-1.3.2.zip/download
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+
+###############################################################################
+# Libraries with category B license
+#
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 24be19595acad0a2cae931af77a0148a
+ name = LICENSE_source-9.0.0.7-bj.html
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 2b5f1ca58d6ef30f18f1415b65bed81c
+ name = CoinMP-1.6.0.tgz
+ URL1 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 377a60170e5185eb63d3ed2fae98e621
+ name = README_silgraphite-2.3.1.txt
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 35efabc239af896dfb79be7ebdd6e6b9
+ name = gentiumbasic-fonts-1.10.zip
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://scripts.sil.org/cms/scripts/render_download.php?format=file&media_id=GentiumBasic_110&filename=GentiumBasic_110.zip
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 48470d662650c3c074e1c3fabbc67bbd
+ name = README_source-9.0.0.7-bj.txt
+ URL1 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 48a9f787f43a09c0a9b7b00cd1fddbbf
+ name = hyphen-2.7.1.tar.gz
+ URL1 = http://sourceforge.net/projects/hunspell/files/Hyphen/2.7/hyphen-2.7.1.tar.gz/download
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES && WITH_CATB_FONTS=YES)
+ MD5 = 61f59e4110781cbe66b46449eadac231
+ name = croscorefonts-1.21.0.tar.gz
+ URL1 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ name = hunspell-1.2.9.tar.gz
+ MD5 = 68dd2e8253d9a7930e9fd50e2d7220d0
+ URL1 = http://sourceforge.net/projects/hunspell/files/Hunspell/1.2.9/hunspell-1.2.9.tar.gz/download
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = 99d94103662a8d0b571e247a77432ac5
+ name = rhino1_7R3.zip
+ URL1 = ftp://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES && WITH_MOZILLA!=NO && BUILD_MOZAB=TRUE)
+ MD5 = a169ab152209200a7bad29a275cb0333
+ name = seamonkey-1.1.14.source.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = ftp://ftp.mozilla.org/pub/mozilla.org/seamonkey/releases/1.1.4/seamonkey-1.1.4.source.tar.gz
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = b92261a5679276c400555004937af965
+ name = nss-3.12.6-with-nspr-4.8.4.tar.gz
+ URL1 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = ada24d37d8d638b3d8a9985e80bc2978
+ name = source-9.0.0.7-bj.zip
+ URL1 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL2 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = d35724900f6a4105550293686688bbb3
+ name = silgraphite-2.3.1.tar.gz
+ URL1 = http://sourceforge.net/projects/silgraphite/files/silgraphite/2.3.1/silgraphite-2.3.1.tar.gz/download
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
+
+if (ENABLE_CATEGORY_B=YES)
+ MD5 = ea570af93c284aa9e5621cd563f54f4d
+ name = bsh-2.0b1-src.tar.gz
+ # This seems to be the original host, but the MD5 sum does not match.
+ # URL1 = http://www.beanshell.org/bsh-2.0b1.jar
+ URL2 = $(OOO_EXTRAS)$(MD5)-$(name)
+ URL3 = $(SVN_TRUNK)$(MD5)-$(name)
Added: incubator/ooo/trunk/main/solenv/bin/download_external_libraries.pl
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/solenv/bin/download_external_libraries.pl?rev=1346024&view=auto
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/download_external_libraries.pl (added)
+++ incubator/ooo/trunk/main/solenv/bin/download_external_libraries.pl Mon Jun 4 16:18:46 2012
@@ -0,0 +1,581 @@
+#!/usr/bin/perl
+
+=head1 NAME
+
+ download_external_libraries.pl - Load missing tarballs specified in main/external_libs.lst.
+
+=head1 SYNOPSIS
+
+ For downloading external libraries (typically from the main/bootstrap script):
+
+ download_external_libraries(<data-file-name>);
+
+=head1 DESCRIPTION
+
+ The contents of the main/external_libs.lst file are used to determine the
+ external library tarballs that are missing from ext_sources/.
+
+ Individual libraries can be ignored depending on the values of environment variables.
+
+ Format of the main/external_libs.lst file:
+
+ The file is line based.
+ Comments start with a # and go to the end of the line and are ignored.
+ Lines that are empty or contain only spaces and/or comments are ignored.
+
+ All other lines can have one of two forms:
+ - A variable definition of the form <name>=<value>.
+ - A conditional block start in the form "if (<expression>)"
+
+ Variables defined in a conditional block are only visible in this block and
+ replace the definition of global variables and variables earlier in the same
+ block.
+ Some variables have special names:
+ - MD5 is the expected MD5 sum of the library tarball.
+ - URL1 to URL9 specify from where to download the tarball. The urls are tried in order.
+ The first successful download (download completed and MD5 sum match) stops the iteration.
+
+ Expressions are explained below in the comment of EvaluateExpression().
+
+ A library is only regarded if its conditional expression evaluates to 1.
+
+ Example:
+
+ DefaultSite=http://some-internet-site.org
+ if ( true )
+ MD5 = 0123456789abcdef0123456789abcdef
+ name = library-1.0.tar.gz
+ URL1 = http://some-other-internet-site.org/another-name.tgz
+ URL2 = $(DefaultSite)$(MD5)-$(name)
+
+ This tries to load a library first from some-other-internet-site.org and if
+ that fails from some-internet-site.org. The library is stored as $(MD5)-$(name)
+ even when it is loaded as another-name.tgz.
+
+=cut
+
+
+use strict;
+
+use File::Spec;
+use File::Path;
+use File::Basename;
+use LWP::UserAgent;
+use Digest::MD5;
+use URI;
+
+my $Debug = 1;
+
+my $LocalEnvironment = undef;
+my $GlobalEnvironment = {};
+my @Missing = ();
+
+
+
+
+=head3 ProcessDataFile
+
+ Read the data file, typically named main/external_libs.lst, find the external
+ library tarballs that are not yet present in ext_sources/ and download them.
+
+=cut
+sub ProcessDataFile ($)
+{
+ my $filename = shift;
+
+ my $destination = $ENV{'TARFILE_LOCATION'};
+
+ die "can not open data file $filename" if ! -e $filename;
+
+ my $current_selector_value = 1;
+ my @URLHeads = ();
+ my @download_requests = ();
+
+ open my $in, $filename;
+ while (my $line = <$in>)
+ {
+ # Remove leading and trailing space and comments
+ $line =~ s/^\s+//;
+ $line =~ s/\s+$//;
+ $line =~ s/\s*#.*$//;
+
+ # Ignore empty lines.
+ next if $line eq "";
+
+ # An "if" statement starts a new block.
+ if ($line =~ /^\s*if\s*\(\s*(.*?)\s*\)\s*$/)
+ {
+ ProcessLastBlock();
+
+ $LocalEnvironment = { 'selector' => $1 };
+ }
+
+ # Lines of the form name = value define a local variable.
+ elsif ($line =~ /^\s*(\S+)\s*=\s*(.*?)\s*$/)
+ {
+ if (defined $LocalEnvironment)
+ {
+ $LocalEnvironment->{$1} = $2;
+ }
+ else
+ {
+ $GlobalEnvironment->{$1} = $2;
+ }
+ }
+ else
+ {
+ die "can not parse line $line\n";
+ }
+ }
+
+ ProcessLastBlock();
+
+ Download(\@download_requests, \@URLHeads);
+}
+
+
+
+
+=head3 ProcessLastBlock
+
+ Process the last definition of an external library.
+ If there is not last block, true for the first "if" statement, then the call is ignored.
+
+=cut
+sub ProcessLastBlock ()
+{
+ # Return if no block is defined.
+ return if ! defined $LocalEnvironment;
+
+ # Ignore the block if the selector does not match.
+ if ( ! EvaluateExpression(SubstituteVariables($LocalEnvironment->{'selector'})))
+ {
+ printf("ignoring %s because its prerequisites are not fullfilled\n", GetValue('name'));
+ }
+ else
+ {
+ my $name = GetValue('name');
+
+ if ( ! IsPresent($name, GetValue('MD5')))
+ {
+ AddDownloadRequest($name);
+ }
+ }
+}
+
+
+
+
+=head3 AddDownloadRequest($name)
+
+ Add a request for downloading the library $name to @Missing.
+ Collect all available URL[1-9] variables as source URLs.
+
+=cut
+sub AddDownloadRequest ($)
+{
+ my $name = shift;
+
+ print "adding download request for $name\n";
+
+ my $urls = [];
+ my $url = GetValue('URL');
+ push @$urls, SubstituteVariables($url) if (defined $url);
+ for (my $i=1; $i<10; ++$i)
+ {
+ $url = GetValue('URL'.$i);
+ next if ! defined $url;
+ push @$urls, SubstituteVariables($url);
+ }
+
+ push @Missing, [$name, GetValue('MD5'), $urls];
+}
+
+
+
+
+=head3 GetValue($variable_name)
+
+ Return the value of the variable with name $variable_name from the local
+ environment or, if not defined there, the global environment.
+
+=cut
+sub GetValue ($)
+{
+ my $variable_name = shift;
+
+ my $candidate = $LocalEnvironment->{$variable_name};
+ return $candidate if defined $candidate;
+
+ return $GlobalEnvironment->{$variable_name};
+}
+
+
+
+=head3 SubstituteVariables($text)
+
+ Replace all references to variables in $text with the respective variable values.
+ This is done repeatedly until no variable reference remains.
+
+=cut
+sub SubstituteVariables ($)
+{
+ my $text = shift;
+
+ my $infinite_recursion_guard = 100;
+ while ($text =~ /^(.*?)\$\(([^)]+)\)(.*)$/)
+ {
+ my ($head,$name,$tail) = ($1,$2,$3);
+ my $value = GetValue($name);
+ die "can evaluate variable $name" if ! defined $value;
+ $text = $head.$value.$tail;
+
+ die "(probably) detected an infinite recursion in variable definitions" if --$infinite_recursion_guard<=0;
+ }
+
+ return $text;
+}
+
+
+
+
+=head3 EvaluateExpression($expression)
+
+ Evaluate the $expression of an "if" statement to either 0 or 1. It can
+ be a single term (see EvaluateTerm for a description), or several terms
+ separated by either all ||s or &&s. Mixing || and && is not supported
+ and will result in an error.
+
+=cut
+sub EvaluateExpression ($)
+{
+ my $expression = shift;
+
+ if ($expression =~ /&&/ && $expression =~ /\|\|/)
+ {
+ die "selctor can contain either && or || but not both at the same time";
+ }
+ elsif ($expression =~ /&&/)
+ {
+ foreach my $term (split (/\s*&&\s*/,$expression))
+ {
+ return 0 if ! EvaluateTerm($term);
+ }
+ return 1;
+ }
+ elsif ($expression =~ /\|\|/)
+ {
+ foreach my $term (split (/\s*\|\|\s*/,$expression))
+ {
+ return 1 if EvaluateTerm($term);
+ }
+ return 0;
+ }
+ else
+ {
+ return EvaluateTerm($expression);
+ }
+ print $expression."\n";
+ return 1;
+}
+
+
+
+
+=head3 EvaluateTerm($term)
+
+ Evaluate the $term to either 0 or 1.
+ A term is either the literal "true", which evaluates to 1, or an expression
+ of the form NAME=VALUE or NAME!=VALUE. NAME is the name of an environment
+ variable and VALUE any string. VALUE may be empty.
+
+=cut
+sub EvaluateTerm ($)
+{
+ my $term = shift;
+
+ if ($term =~ /^\s*([a-zA-Z_0-9]+)\s*(=|!=)\s*(.*)\s*$/)
+ {
+ my ($variable_name, $operator, $given_value) = ($1,$2,$3);
+ my $variable_value = $ENV{$variable_name};
+
+ if ($operator eq "=")
+ {
+ return $variable_value eq $given_value;
+ }
+ elsif ($operator eq "!=")
+ {
+ return $variable_value ne $given_value;
+ }
+ else
+ {
+ die "unknown operator in term $term";
+ }
+ }
+ elsif ($term =~ /^\s*true\s*$/i)
+ {
+ return 1;
+ }
+ else
+ {
+ die "term $term is not of the form <environment-variable> (=|==) <value>";
+ }
+}
+
+
+
+
+=head IsPresent($name,$given_md5)
+
+ Check if an external library tar ball with the basename $name already
+ exists in the target directory TARFILE_LOCATION. The basename is
+ prefixed with the given MD5 sum.
+ If the file exists then its MD5 sum is compare with the given MD5 sum.
+
+=cut
+sub IsPresent ($$)
+{
+ my $name = shift;
+ my $given_md5 = shift;
+
+ my $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $given_md5."-".$name);
+
+ return 0 if ! -f $filename;
+
+ # File exists. Check if its md5 sum is correct.
+ my $md5 = Digest::MD5->new();
+ open my $in, $filename;
+ $md5->addfile($in);
+
+ if ($given_md5 ne $md5->hexdigest())
+ {
+ # MD5 check sum does not match. Delete the file.
+ print "$name exists, but md5 does not match => deleting\n";
+ #unlink($filename);
+ return 0;
+ }
+ else
+ {
+ print "$name exists, md5 is OK\n";
+ return 1;
+ }
+}
+
+
+
+
+=head3 Download
+
+ Download a set of files specified by @Missing.
+
+ 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 $download_path = $ENV{'TARFILE_LOCATION'};
+
+ if (scalar @Missing > 0)
+ {
+ printf("downloading %d missing tar ball%s to %s\n",
+ scalar @Missing, scalar @Missing>0 ? "s" : "",
+ $download_path);
+ }
+ else
+ {
+ print "all external libraries present\n";
+ return;
+ }
+
+ # Download the missing files.
+ for my $item (@Missing)
+ {
+ my ($name, $given_md5, $urls) = @$item;
+
+ foreach my $url (@$urls)
+ {
+ last if DownloadFile($given_md5."-".$name, $url, $given_md5);
+ }
+ }
+}
+
+
+
+
+=head3 DownloadFile($name,$URL,$md5sum)
+
+ Download a single external library tarball. It origin is given by $URL.
+ Its destination is $(TARFILE_LOCATION)/$md5sum-$name.
+
+=cut
+sub DownloadFile ($$$)
+{
+ my $name = shift;
+ my $URL = shift;
+ my $md5sum = shift;
+
+ my $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $name);
+
+ my $temporary_filename = $filename . ".part";
+
+ print "downloading to $temporary_filename\n";
+ open my $out, ">$temporary_filename";
+ binmode($out);
+
+ # Prepare md5
+ my $md5 = Digest::MD5->new();
+
+ # Download the extension.
+ my $agent = LWP::UserAgent->new();
+ $agent->timeout(120);
+ $agent->show_progress(1);
+ my $last_was_redirect = 0;
+ $agent->add_handler('response_redirect'
+ => sub{
+ $last_was_redirect = 1;
+ return;
+ });
+ $agent->add_handler('response_data'
+ => sub{
+ if ($last_was_redirect)
+ {
+ $last_was_redirect = 0;
+ # Throw away the data we got so far.
+ $md5->reset();
+ close $out;
+ open $out, ">$temporary_filename";
+ binmode($out);
+ }
+ 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())
+ {
+ my $file_md5 = $md5->hexdigest();
+ if (defined $md5sum && length($md5sum)==32)
+ {
+ if ($md5sum eq $file_md5)
+ {
+ print "md5 is OK\n";
+ }
+ else
+ {
+ unlink($temporary_filename);
+ print " md5 does not match ($file_md5 instead of $md5sum)\n";
+ return 0;
+ }
+ }
+ else
+ {
+ printf("md5 not given, md5 of file is %s\n", $file_md5);
+ $filename = File::Spec->catfile($ENV{'TARFILE_LOCATION'}, $file_md5 . "-" . $name);
+ }
+
+ rename($temporary_filename, $filename) || die "can not rename $temporary_filename to $filename";
+ return 1;
+ }
+ else
+ {
+ unlink($temporary_filename);
+ print " download failed\n";
+ return 0;
+ }
+}
+
+
+
+
+=head3 CheckDownloadDestination ()
+
+ Make sure that the download destination $TARFILE_LOCATION does exist. If
+ not, then the directory is created.
+
+=cut
+sub CheckDownloadDestination ()
+{
+ my $destination = $ENV{'TARFILE_LOCATION'};
+ die "ERROR: no destination defined! please set TARFILE_LOCATION!" if ($destination eq "");
+
+ if ( ! -d $destination)
+ {
+ File::Path::make_path($destination);
+ die "ERROR: can't create \$TARFILE_LOCATION" if ! -d $destination;
+ }
+}
+
+
+
+
+=head3 ProvideSpecialTarball ($url,$name,$name_converter)
+
+ A few tarballs need special handling. That is done here.
+
+=cut
+sub ProvideSpecialTarball ($$$)
+{
+ my $url = shift;
+ my $name = shift;
+ my $name_converter = shift;
+
+ return unless defined $url && $url ne "";
+
+ # See if we can find the executable.
+ my ($SOLARENV,$OUTPATH,$EXEEXT) = ($ENV{'SOLARENV'},$ENV{'OUTPATH'},$ENV{'EXEEXT'});
+ $SOLARENV = "" unless defined $SOLARENV;
+ $OUTPATH = "" unless defined $OUTPATH;
+ $EXEEXT = "" unless defined $EXEEXT;
+ if (-x File::Spec->catfile($SOLARENV, $OUTPATH, "bin", $name.$EXEEXT))
+ {
+ print "found $name executable\n";
+ return;
+ }
+
+ # Download the source from the URL.
+ my $basename = basename(URI->new($url)->path());
+ die unless defined $basename;
+
+ if (defined $name_converter)
+ {
+ $basename = &{$name_converter}($basename);
+ }
+
+ # Has the source tar ball already been downloaded?
+ my @candidates = glob(File::Spec->catfile($ENV{'TARFILE_LOCATION'}, "*-" . $basename));
+ if (scalar @candidates > 0)
+ {
+ # Yes.
+ print "$basename exists\n";
+ return;
+ }
+ else
+ {
+ # No, download it.
+ print "downloading $basename\n";
+ DownloadFile($basename, $url, undef);
+ }
+}
+
+
+
+
+
+# The main() functionality.
+
+die "usage: $0 <data-file-name>" if scalar @ARGV != 1;
+my $data_file = $ARGV[0];
+CheckDownloadDestination();
+ProcessDataFile($data_file);
+ProvideSpecialTarball($ENV{'DMAKE_URL'}, "dmake", undef);
+ProvideSpecialTarball(
+ $ENV{'EPM_URL'},
+ "epm",
+ sub{$_[0]=~s/-source//; return $_[0]});
Modified: 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=1346024&r1=1346023&r2=1346024&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm Mon Jun 4 16:18:46 2012
@@ -268,7 +268,7 @@ sub EvaluateSelector($$)
return $left_result || $right_result;
}
}
- elsif ($expression =~ /^\s*(.+?)\s$/)
+ elsif ($expression =~ /^\s*(.+?)\s*$/)
{
return EvaluateTerm($1, $languages);
}