incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1303475 - in /incubator/ooo/trunk/main: extensions.lst solenv/bin/modules/ExtensionsLst.pm
Date Wed, 21 Mar 2012 17:36:37 GMT
Author: af
Date: Wed Mar 21 17:36:37 2012
New Revision: 1303475

URL: http://svn.apache.org/viewvc?rev=1303475&view=rev
Log:
Fixed extension loading.  Can now handle indirect URLs.

Modified:
    incubator/ooo/trunk/main/extensions.lst
    incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm

Modified: incubator/ooo/trunk/main/extensions.lst
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/extensions.lst?rev=1303475&r1=1303474&r2=1303475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/extensions.lst (original)
+++ incubator/ooo/trunk/main/extensions.lst Wed Mar 21 17:36:37 2012
@@ -46,21 +46,21 @@
     b7ce02d25eb302e5b23572cdccaea461 http://numbertext.org/tmp/dict-en.oxt
     
     # Canada (en_CA)
-    e545415a4c813075c67ea58ea99802e5 http://sourceforge.net/projects/aoo-extensions/files/1263/1/en_CA_2_0_0.oxt/download
+    e545415a4c813075c67ea58ea99802e5 http://sourceforge.net/projects/aoo-extensions/files/1263/1/en_CA_2_0_0.oxt/download
"en_CA_2_0_0.oxt"
 
     # USA (en_US)
-    e2eab80772ab1aa09716954219351a80 http://sourceforge.net/projects/aoo-extensions/files/1470/1/en_US.oxt/download
+    e2eab80772ab1aa09716954219351a80 http://sourceforge.net/projects/aoo-extensions/files/1470/1/en_US.oxt/download
"en_US.oxt"
 
     # Australia (en_AU)
-    68bfee769199749288c5e1aaf200a1ca http://sourceforge.net/projects/aoo-extensions/files/1232/7/dict-en-au-2008-12-15.oxt/download
+    68bfee769199749288c5e1aaf200a1ca http://sourceforge.net/projects/aoo-extensions/files/1232/7/dict-en-au-2008-12-15.oxt/download
"dict-en-au-2008-12-15.oxt"
 
     # South Africa (en_ZA)
-    c0c052e01b124a9ca5739facdb3ddbd5 http://sourceforge.net/projects/aoo-extensions/files/3089/0/dict-en_ZA-2009.10.22.oxt/download
+    c0c052e01b124a9ca5739facdb3ddbd5 http://sourceforge.net/projects/aoo-extensions/files/3089/0/dict-en_ZA-2009.10.22.oxt/download
"dict-en_ZA-2009.10.22.oxt"
 
     # New Zealand (en_NZ)
-    87123666ecce441b075c0170fa58690c http://sourceforge.net/projects/aoo-extensions/files/1665/1/dict-en-nz-2008-12-03.oxt/download
+    87123666ecce441b075c0170fa58690c http://sourceforge.net/projects/aoo-extensions/files/1665/1/dict-en-nz-2008-12-03.oxt/download
"dict-en-nz-2008-12-03.oxt"
 
 
 # Extensions for german (Germany).
 [ language=de || language=de-DE ]
-    eb3d3397b8034c7fce6e0d78daf914ca http://sourceforge.net/projects/aoo-extensions/files/1075/10/dict-de_DE-frami_2011-06-03.oxt/download
+    eb3d3397b8034c7fce6e0d78daf914ca http://sourceforge.net/projects/aoo-extensions/files/1075/10/dict-de_DE-frami_2011-06-03.oxt/download
"dict-de_DE-frami_2011-06-03.oxt"

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=1303475&r1=1303474&r2=1303475&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm Wed Mar 21 17:36:37 2012
@@ -280,7 +280,8 @@ sub EvaluateSelector($$)
 
 =head3 ProcessURL
     Check that the given line contains an optional MD5 sum followed by
-    a URL for one of the protocols file, http, https
+    a URL for one of the protocols file, http, https,
+    followed by an optional file name (which is necessary when it is not the last part of
the URL.)
     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:
@@ -292,19 +293,33 @@ 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*$/)
+    if ($line =~ /^\s*((\w{32})\s+)?([a-zA-Z]+)(:\/\/.*?\/)([^\/ \t]+)(\s+\"[^\"]+\")?\s*$/)
     {
-        my ($md5, $protocol, $name) = ($1,$2,$4);
-        my $URL = $2.$3.$4;
+        my ($md5, $protocol, $url_name, $optional_name) = ($2,$3,$5,$6);
+        my $URL = $3.$4.$5;
 
         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")
+        # Determine the name.  If an optional name is given then use that.
+        if (defined $optional_name)
         {
-            $URL =~ /:\/\/(.*)$/;
+            die if $optional_name !~ /^\s+\"([^\"]+)\"$/;
             $name = $1;
         }
+        else
+        {
+            if ($protocol eq "file")
+            {
+                # For file URLs we use everything after :// as name, or the .
+                $URL =~ /:\/\/(.*)$/;
+                $name = $1;
+            }
+            else
+            {
+                # For http and https use the last part of the URL.
+                $name = $url_name;
+            }
+        }
         
         return [$protocol, $name, $URL, $md5];
     }
@@ -430,6 +445,7 @@ sub Download (@)
         # Open a .part file for writing.
         my $filename = File::Spec->catfile($download_path, $name);
         my $temporary_filename = $filename . ".part";
+        print "downloading to $temporary_filename\n";
         open my $out, ">$temporary_filename";
         binmode($out);
 
@@ -440,8 +456,23 @@ sub Download (@)
         my $agent = LWP::UserAgent->new();
         $agent->timeout(10);
         $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);
@@ -455,16 +486,22 @@ sub Download (@)
         {
             if (defined $md5sum && length($md5sum)==32)
             {
-                if ($md5sum eq $md5->digest())
+                my $file_md5 = $md5->hexdigest();
+                if ($md5sum eq $file_md5)
                 {
                     print "md5 is OK\n";
                 }
                 else
                 {
                     unlink($temporary_filename);
-                    die "downloaded file has the wrong md5 checksum";
+                    die "downloaded file has the wrong md5 checksum: $file_md5 instead of
$md5sum";
                 }
             }
+            else
+            {
+                print "md5 is not present\n";
+                printf "   is %s, length is %d\n", $md5sum, length(md5sum);
+            }
             
             rename($temporary_filename, $filename) || die "can not rename $temporary_filename
to $filename";
         }



Mime
View raw message