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/15 13:52:03 UTC
svn commit: r1350587 -
/incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm
Author: af
Date: Fri Jun 15 11:52:03 2012
New Revision: 1350587
URL: http://svn.apache.org/viewvc?rev=1350587&view=rev
Log:
#i119229# When MD5 does not match, download extension again.
Path by: Ariel Constenla-Haile
Additional changes by: Andre Fischer
Modified:
incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm
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=1350587&r1=1350586&r2=1350587&view=diff
==============================================================================
--- incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm (original)
+++ incubator/ooo/trunk/main/solenv/bin/modules/ExtensionsLst.pm Fri Jun 15 11:52:03 2012
@@ -424,10 +424,33 @@ sub Download (@)
{
push @missing, $entry;
}
+ elsif (defined $md5sum)
+ {
+ # Check that the MD5 sum is still correct.
+ # The datafile may have been updated with a new version of the extension that
+ # still has the same name but a different MD5 sum.
+ my $cur_oxt;
+ if ( ! open($cur_oxt, $candidate))
+ {
+ # Can not read the extension. Download extension again.
+ push @missing, $entry;
+ unlink($candidate);
+ }
+ binmode($cur_oxt);
+ my $file_md5 = Digest::MD5->new->addfile(*$cur_oxt)->hexdigest;
+ close($cur_oxt);
+ if ($md5sum ne $file_md5)
+ {
+ # MD5 does not match. Download extension again.
+ print "extension $name has wrong MD5 and will be updated\n";
+ push @missing, $entry;
+ unlink($candidate);
+ }
+ }
}
if ($#missing >= 0)
{
- printf "downloading %d missing extension%s\n", $#missing+1, $#missing>0 ? "s" : "";
+ printf "downloading/updating %d extension%s\n", $#missing+1, $#missing>0 ? "s" : "";
if ( ! -d $download_path)
{
mkdir File::Spec->catpath($download_path, "tmp")