This is an automated email from the ASF dual-hosted git repository.

mseidel pushed a commit to branch AOO42X
in repository https://gitbox.apache.org/repos/asf/openoffice.git

commit 5e58fb3c7bae1727005e9b274ee588f47110422d
Author: John Bampton <[email protected]>
AuthorDate: Mon Mar 3 06:14:28 2025 +1000

    pre-commit(mixed-line-ending): autofix more files; ini, pl, pm (#324)
    
    (cherry picked from commit a9dacd0244e22e58099a70c93e0422639168e570)
---
 .../bin/modules/installer/patch/FileOperations.pm  | 666 ++++++++++-----------
 main/solenv/bin/patch_make_releases_xml.pl         | 394 ++++++------
 test/testuno/data/limit_cfg.ini                    |  44 +-
 3 files changed, 552 insertions(+), 552 deletions(-)

diff --git a/main/solenv/bin/modules/installer/patch/FileOperations.pm 
b/main/solenv/bin/modules/installer/patch/FileOperations.pm
index cb2cd54cab..25281fec4f 100644
--- a/main/solenv/bin/modules/installer/patch/FileOperations.pm
+++ b/main/solenv/bin/modules/installer/patch/FileOperations.pm
@@ -1,333 +1,333 @@
-#**************************************************************
-#  
-#  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 installer::patch::FileOperations;
-
-use File::Basename;
-use File::Copy;
-use IO::Compress::Bzip2;
-use IO::Uncompress::Bunzip2;
-
-my $CompressionMethod = "bzip2";
-
-
-=head1 NAME
-
-    package installer::patch::FileOperations - Class for collecting, checking 
and executing file operations.
-
-=cut
-
-
-sub new ($)
-{
-    my ($class) = (@_);
-
-    my $self = {
-        'operations' => []
-    };
-    bless($self, $class);
-
-    return $self;
-}
-
-
-
-
-sub AddCopyOperation ($$$)
-{
-    my ($self, $source_name, $target_name) = @_;
-    
-    push
-        @{$self->{'operations'}},
-        [
-            'copy',
-            $source_name,
-            $target_name
-        ];
-}
-
-
-
-
-sub AddMakeDirectoryOperation ($$)
-{
-    my ($self, $path) = @_;
-
-    push
-        @{$self->{'operations'}},
-        [
-            'mkdir',
-            $path
-        ];
-}
-
-
-
-
-sub AddCompressOperation ($$)
-{
-    my ($self, $filename) = @_;
-
-    push
-        @{$self->{'operations'}},
-        [
-            'compress',
-            $filename
-        ];
-}
-
-
-
-
-sub AddUncompressOperation ($$$)
-{
-    my ($self, $source_name, $target_name) = @_;
-
-    push
-        @{$self->{'operations'}},
-        [
-            'uncompress',
-            $source_name,
-            $target_name
-        ];
-}
-
-
-
-
-sub Check ($)
-{
-    my ($self) = @_;
-
-    # Keep track of which directories or files would be created to check if
-    # operations that depend on these files will succeed.
-    my %files = ();
-    my %directories = ();
-    
-    my @error_messages = ();
-    foreach my $operation (@{$self->{'operations'}})
-    {
-        my $command = $operation->[0];
-        
-        if ($command eq "copy")
-        {
-            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
-            if ( ! -f $source_name)
-            {
-                push @error_messages, sprintf("%s is not a regular file and 
can not be copied", $source_name);
-            }
-            my $destination_path = dirname($destination_name);
-            if ( ! -d $destination_path && ! defined 
$directories{$destination_path})
-            {
-                push @error_messages, sprintf("destination path %s does not 
exist", $destination_path);
-            }
-            if ( -f $destination_name)
-            {
-                # The destination file already exists. We have to overwrite it.
-                if ( ! -w $destination_name)
-                {
-                    push @error_messges, sprintf("destination file %s exists 
but can not be overwritten", $destination_name);
-                }
-            }
-            $files{$destination_name} = 1;
-        }
-        elsif ($command eq "mkdir")
-        {
-            my $path = $operation->[1];
-            if ( -d $path)
-            {
-                # Directory already exists.  That is OK, the mkdir command 
will be silently ignored.
-            }
-            else
-            {
-                $directories{$path} = 1;
-            }
-        }
-        elsif ($command eq "compress")
-        {
-            my $filename = $operation->[1];
-            if ( ! -f $filename && ! defined $files{$filename})
-            {
-                # File does not exist and will not be created by an earlier 
operation.
-                push @error_messages, sprintf("file %s does not exist and can 
not be compressed", $filename);
-            }
-        }
-        elsif ($command eq "uncompress")
-        {
-            my ($source_filename, $destination_filename) = ($operation->[1], 
$operation->[2]);
-            if ($CompressionMethod eq "bzip2")
-            {
-                $source_filename .= ".bz2";
-            }
-            if ( ! -f $source_filename && ! defined $files{$source_filename})
-            {
-                # File does not exist and will not be created by an earlier 
operation.
-                push @error_messages, sprintf("file %s does not exist and can 
not be decompressed", $source_filename);
-            }
-            if ( -f $destination_filename && ! -w $destination_filename)
-            {
-                # Destination file already exists but can not be replaced.
-                push @error_messages, sprintf("compress destination file %s 
exists but can not be replaced", $destination_filename);
-            }
-        }
-        else
-        {
-            push @error_messages, sprintf("unknown operation %s", $command);
-        }
-    }
-
-    return @error_messages;
-}
-
-
-
-
-sub CheckAndExecute ($)
-{
-    my ($self) = @_;
-
-    my @error_messages = $self->Check();
-    if (scalar @error_messages > 0)
-    {
-        $installer::logger::Lang->printf("can not execute all operations:\n");
-        for my $message (@error_messages)
-        {
-            $installer::logger::Lang->printf("ERROR: %s\n", $message);
-        }
-        return 0;
-    }
-    else
-    {
-        return $self->Execute();
-    }
-}
-
-
-
-
-sub Execute ($)
-{
-    my ($self) = @_;
-
-    foreach my $operation (@{$self->{'operations'}})
-    {
-        my $command = $operation->[0];
-
-        if ($command eq "copy")
-        {
-            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
-            $installer::logger::Lang->printf("copy from %s\n    to %s\n", 
$source_name, $destination_name);
-            if ( ! $DryRun)
-            {
-                my $result = copy($source_name, $destination_name);
-                if ( ! $result)
-                {
-                    $installer::logger::Lang->printf("ERROR: copying from %s 
to %s failed",
-                        $source_name, $destination_name);
-                }
-            }
-        }
-        elsif ($command eq "mkdir")
-        {
-            my $path = $operation->[1];
-            if ( -d $path)
-            {
-                # Path exists already. Do nothing.
-            }
-            else
-            {
-                $installer::logger::Lang->printf("creating directory %s\n", 
$path);
-                if ( ! $DryRun)
-                {
-                    if (File::Path::make_path($path, {'mode' => 0775}) == 0)
-                    {
-                        $installer::logger::Lang->printf("could not create 
directory %s\n", $path);
-                    }
-                }
-            }
-        }
-        elsif ($command eq "compress")
-        {
-            my $filename = $operation->[1];
-            $installer::logger::Lang->printf("compressing %s\n", $filename);
-            if ( ! $DryRun)
-            {
-                my $result = 0;
-                if ($CompressionMethod eq "bzip2")
-                {
-                    $result = IO::Compress::Bzip2::bzip2($filename => 
$filename.".bz2");
-                }
-                if ($result == 0)
-                {
-                    $installer::logger::Lang->printf("ERROR: could not 
compress %s\n", $filename);
-                }
-                else
-                {
-                    unlink($filename);
-                }
-            }
-        }
-        elsif ($command eq "uncompress")
-        {
-            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
-            if ($CompressionMethod eq "bzip2")
-            {
-                $source_name .= ".bz2";
-            }
-            $installer::logger::Lang->printf("uncompressing %s to %s\n", 
$source_name, $destination_name);
-
-            my $destination_base_name = basename($destination_name);
-
-            if ( ! $DryRun)
-            {
-                my $result = 0;
-                if ($CompressionMethod eq "bzip2")
-                {
-                    $result = IO::Uncompress::Bunzip2::bunzip2($source_name => 
$destination_name);
-                }
-                if ($result == 0)
-                {
-                    $installer::logger::Lang->printf("ERROR: failed to extract 
content of '%s' from '%s'\n",
-                        $destination_name, $source_name);
-                    return 0;
-                }
-            }
-        }
-
-        else
-        {
-            die "unknown operation $command\n";
-        }
-    }
-
-    return 1;
-}
-
-
-
-sub GetOperationCount ($)
-{
-    my ($self) = @_;
-    return scalar @{$self->{'operations'}};
-}
-
-
-1;
+#**************************************************************
+#  
+#  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 installer::patch::FileOperations;
+
+use File::Basename;
+use File::Copy;
+use IO::Compress::Bzip2;
+use IO::Uncompress::Bunzip2;
+
+my $CompressionMethod = "bzip2";
+
+
+=head1 NAME
+
+    package installer::patch::FileOperations - Class for collecting, checking 
and executing file operations.
+
+=cut
+
+
+sub new ($)
+{
+    my ($class) = (@_);
+
+    my $self = {
+        'operations' => []
+    };
+    bless($self, $class);
+
+    return $self;
+}
+
+
+
+
+sub AddCopyOperation ($$$)
+{
+    my ($self, $source_name, $target_name) = @_;
+    
+    push
+        @{$self->{'operations'}},
+        [
+            'copy',
+            $source_name,
+            $target_name
+        ];
+}
+
+
+
+
+sub AddMakeDirectoryOperation ($$)
+{
+    my ($self, $path) = @_;
+
+    push
+        @{$self->{'operations'}},
+        [
+            'mkdir',
+            $path
+        ];
+}
+
+
+
+
+sub AddCompressOperation ($$)
+{
+    my ($self, $filename) = @_;
+
+    push
+        @{$self->{'operations'}},
+        [
+            'compress',
+            $filename
+        ];
+}
+
+
+
+
+sub AddUncompressOperation ($$$)
+{
+    my ($self, $source_name, $target_name) = @_;
+
+    push
+        @{$self->{'operations'}},
+        [
+            'uncompress',
+            $source_name,
+            $target_name
+        ];
+}
+
+
+
+
+sub Check ($)
+{
+    my ($self) = @_;
+
+    # Keep track of which directories or files would be created to check if
+    # operations that depend on these files will succeed.
+    my %files = ();
+    my %directories = ();
+    
+    my @error_messages = ();
+    foreach my $operation (@{$self->{'operations'}})
+    {
+        my $command = $operation->[0];
+        
+        if ($command eq "copy")
+        {
+            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
+            if ( ! -f $source_name)
+            {
+                push @error_messages, sprintf("%s is not a regular file and 
can not be copied", $source_name);
+            }
+            my $destination_path = dirname($destination_name);
+            if ( ! -d $destination_path && ! defined 
$directories{$destination_path})
+            {
+                push @error_messages, sprintf("destination path %s does not 
exist", $destination_path);
+            }
+            if ( -f $destination_name)
+            {
+                # The destination file already exists. We have to overwrite it.
+                if ( ! -w $destination_name)
+                {
+                    push @error_messges, sprintf("destination file %s exists 
but can not be overwritten", $destination_name);
+                }
+            }
+            $files{$destination_name} = 1;
+        }
+        elsif ($command eq "mkdir")
+        {
+            my $path = $operation->[1];
+            if ( -d $path)
+            {
+                # Directory already exists.  That is OK, the mkdir command 
will be silently ignored.
+            }
+            else
+            {
+                $directories{$path} = 1;
+            }
+        }
+        elsif ($command eq "compress")
+        {
+            my $filename = $operation->[1];
+            if ( ! -f $filename && ! defined $files{$filename})
+            {
+                # File does not exist and will not be created by an earlier 
operation.
+                push @error_messages, sprintf("file %s does not exist and can 
not be compressed", $filename);
+            }
+        }
+        elsif ($command eq "uncompress")
+        {
+            my ($source_filename, $destination_filename) = ($operation->[1], 
$operation->[2]);
+            if ($CompressionMethod eq "bzip2")
+            {
+                $source_filename .= ".bz2";
+            }
+            if ( ! -f $source_filename && ! defined $files{$source_filename})
+            {
+                # File does not exist and will not be created by an earlier 
operation.
+                push @error_messages, sprintf("file %s does not exist and can 
not be decompressed", $source_filename);
+            }
+            if ( -f $destination_filename && ! -w $destination_filename)
+            {
+                # Destination file already exists but can not be replaced.
+                push @error_messages, sprintf("compress destination file %s 
exists but can not be replaced", $destination_filename);
+            }
+        }
+        else
+        {
+            push @error_messages, sprintf("unknown operation %s", $command);
+        }
+    }
+
+    return @error_messages;
+}
+
+
+
+
+sub CheckAndExecute ($)
+{
+    my ($self) = @_;
+
+    my @error_messages = $self->Check();
+    if (scalar @error_messages > 0)
+    {
+        $installer::logger::Lang->printf("can not execute all operations:\n");
+        for my $message (@error_messages)
+        {
+            $installer::logger::Lang->printf("ERROR: %s\n", $message);
+        }
+        return 0;
+    }
+    else
+    {
+        return $self->Execute();
+    }
+}
+
+
+
+
+sub Execute ($)
+{
+    my ($self) = @_;
+
+    foreach my $operation (@{$self->{'operations'}})
+    {
+        my $command = $operation->[0];
+
+        if ($command eq "copy")
+        {
+            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
+            $installer::logger::Lang->printf("copy from %s\n    to %s\n", 
$source_name, $destination_name);
+            if ( ! $DryRun)
+            {
+                my $result = copy($source_name, $destination_name);
+                if ( ! $result)
+                {
+                    $installer::logger::Lang->printf("ERROR: copying from %s 
to %s failed",
+                        $source_name, $destination_name);
+                }
+            }
+        }
+        elsif ($command eq "mkdir")
+        {
+            my $path = $operation->[1];
+            if ( -d $path)
+            {
+                # Path exists already. Do nothing.
+            }
+            else
+            {
+                $installer::logger::Lang->printf("creating directory %s\n", 
$path);
+                if ( ! $DryRun)
+                {
+                    if (File::Path::make_path($path, {'mode' => 0775}) == 0)
+                    {
+                        $installer::logger::Lang->printf("could not create 
directory %s\n", $path);
+                    }
+                }
+            }
+        }
+        elsif ($command eq "compress")
+        {
+            my $filename = $operation->[1];
+            $installer::logger::Lang->printf("compressing %s\n", $filename);
+            if ( ! $DryRun)
+            {
+                my $result = 0;
+                if ($CompressionMethod eq "bzip2")
+                {
+                    $result = IO::Compress::Bzip2::bzip2($filename => 
$filename.".bz2");
+                }
+                if ($result == 0)
+                {
+                    $installer::logger::Lang->printf("ERROR: could not 
compress %s\n", $filename);
+                }
+                else
+                {
+                    unlink($filename);
+                }
+            }
+        }
+        elsif ($command eq "uncompress")
+        {
+            my ($source_name, $destination_name) = ($operation->[1], 
$operation->[2]);
+            if ($CompressionMethod eq "bzip2")
+            {
+                $source_name .= ".bz2";
+            }
+            $installer::logger::Lang->printf("uncompressing %s to %s\n", 
$source_name, $destination_name);
+
+            my $destination_base_name = basename($destination_name);
+
+            if ( ! $DryRun)
+            {
+                my $result = 0;
+                if ($CompressionMethod eq "bzip2")
+                {
+                    $result = IO::Uncompress::Bunzip2::bunzip2($source_name => 
$destination_name);
+                }
+                if ($result == 0)
+                {
+                    $installer::logger::Lang->printf("ERROR: failed to extract 
content of '%s' from '%s'\n",
+                        $destination_name, $source_name);
+                    return 0;
+                }
+            }
+        }
+
+        else
+        {
+            die "unknown operation $command\n";
+        }
+    }
+
+    return 1;
+}
+
+
+
+sub GetOperationCount ($)
+{
+    my ($self) = @_;
+    return scalar @{$self->{'operations'}};
+}
+
+
+1;
diff --git a/main/solenv/bin/patch_make_releases_xml.pl 
b/main/solenv/bin/patch_make_releases_xml.pl
index 292e0c0749..ea7178922a 100644
--- a/main/solenv/bin/patch_make_releases_xml.pl
+++ b/main/solenv/bin/patch_make_releases_xml.pl
@@ -1,197 +1,197 @@
-#!/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 LWP::UserAgent;
-
-use strict;
-
-=head1 NAME
-
-    patch_make_releases_xml.pl - Create a section for the 
instsetoo_native/data/releases.xml file.
-
-=head1 SYNOPSIS
-
-    patch_make_releases_xml.pl <version-number>
-
-        version-number is the version number (eg 4.0.1) for which to create 
the releases.xml file.
-
-=head1 DESCRIPTION
-
-    Will contact 
http://archive.apache.org/dist/openoffice/<version-number>/binaries/ and
-    a) determine the set of languages
-    b) collect sizes and sha256 check sums for all Windows installation sets.
-
-    The result is printed to the console.  It has to be added manually to 
releases.xml.
-
-=cut
-
-
-if (scalar @ARGV != 1)
-{
-    print STDERR "usage: $0 <version-number>\n";
-    die;
-}
-
-my $version = $ARGV[0];
-
-print <<EOT;
-<?xml version='1.0' encoding='UTF-8'?>
-<!--***********************************************************
- *
- * 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.
- *
- ***********************************************************-->
-EOT
-
-sub DownloadFile ($)
-{
-    my $url = shift;
-
-    my $agent = LWP::UserAgent->new();
-    $agent->timeout(120);
-    $agent->show_progress(0);
-
-    my $file_content = "";
-    my $last_was_redirect = 0;
-    my $bytes_read = 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.
-               $file_content = "";
-            }
-            my($response,$agent,$h,$data)=@_;
-           $file_content .= $data;
-        });
-    $agent->get($url);
-
-    return $file_content;
-}
-
-
-
-
-sub GetResponse ($)
-{
-    my $url = shift;
-
-    my $agent = LWP::UserAgent->new();
-    $agent->timeout(120);
-    $agent->show_progress(0);
-
-    my $file_content = "";
-    my $last_was_redirect = 0;
-    my $bytes_read = 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.
-               $file_content = "";
-            }
-            my($response,$agent,$h,$data)=@_;
-           $file_content .= $data;
-        });
-    return $agent->get($url, 'Range' => "bytes=0-0");
-}
-
-my @languages = ();
-my @lines = split(/\n/, 
DownloadFile("http://archive.apache.org/dist/openoffice/".$version."/binaries/";));
-foreach my $line (@lines)
-{
-    next unless $line =~ /folder.gif/;
-    if ($line =~ /a href=\"([^\"\/]+)\/\"/)
-    {
-       my $language = $1;
-       next if $language eq "SDK";
-       next if $language =~ /^[A-Z]/;
-       push @languages, $language;
-    }
-}
-
-print "<releases>\n";
-print "  <release>\n";
-printf "    <version>%s</version>\n", $version;
-print "    <download>\n";
-print "      <package-format>msi</package-format>\n";
-print "      <url-template>\n";
-printf "        
http://archive.apache.org/dist/openoffice/%s/binaries/%%L/Apache_OpenOffice_%s_Win_x86_install_%%L.exe\n",$version,
 $version;
-print "      </url-template>\n";
-foreach my $language (sort @languages)
-{
-    print "      <item>\n";
-    printf "        <language>%s</language>\n", $language;
-    my $name = sprintf(
-       "Apache_OpenOffice_%s_Win_x86_install_%s.exe",
-       $version,
-       $language,
-       $version,
-       $language);
-
-    my $content = DownloadFile(
-       
sprintf("http://archive.apache.org/dist/openoffice/%s/binaries/%s/%s.sha256";, 
$version, $language, $name));
-    if ($content =~ /^([a-f0-9]+)/)
-    {
-       printf("        <checksum type=\"sha256\">%s</checksum>\n", $1);
-    }
-    my $response = GetResponse(
-       sprintf("http://archive.apache.org/dist/openoffice/%s/binaries/%s/%s";, 
$version, $language, $name));
-    my $content_range = $response->{'_headers'}->{'content-range'};
-    if ($content_range =~ /bytes 0-0\/(\d+)/)
-    {
-       printf("        <size>%s</size>\n", $1);
-    }
-    print "      </item>\n";
-}
-
-print "    </download>\n";
-print "  </release>\n";
-print "</releases>\n";
+#!/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 LWP::UserAgent;
+
+use strict;
+
+=head1 NAME
+
+    patch_make_releases_xml.pl - Create a section for the 
instsetoo_native/data/releases.xml file.
+
+=head1 SYNOPSIS
+
+    patch_make_releases_xml.pl <version-number>
+
+        version-number is the version number (eg 4.0.1) for which to create 
the releases.xml file.
+
+=head1 DESCRIPTION
+
+    Will contact 
http://archive.apache.org/dist/openoffice/<version-number>/binaries/ and
+    a) determine the set of languages
+    b) collect sizes and sha256 check sums for all Windows installation sets.
+
+    The result is printed to the console.  It has to be added manually to 
releases.xml.
+
+=cut
+
+
+if (scalar @ARGV != 1)
+{
+    print STDERR "usage: $0 <version-number>\n";
+    die;
+}
+
+my $version = $ARGV[0];
+
+print <<EOT;
+<?xml version='1.0' encoding='UTF-8'?>
+<!--***********************************************************
+ *
+ * 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.
+ *
+ ***********************************************************-->
+EOT
+
+sub DownloadFile ($)
+{
+    my $url = shift;
+
+    my $agent = LWP::UserAgent->new();
+    $agent->timeout(120);
+    $agent->show_progress(0);
+
+    my $file_content = "";
+    my $last_was_redirect = 0;
+    my $bytes_read = 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.
+               $file_content = "";
+            }
+            my($response,$agent,$h,$data)=@_;
+           $file_content .= $data;
+        });
+    $agent->get($url);
+
+    return $file_content;
+}
+
+
+
+
+sub GetResponse ($)
+{
+    my $url = shift;
+
+    my $agent = LWP::UserAgent->new();
+    $agent->timeout(120);
+    $agent->show_progress(0);
+
+    my $file_content = "";
+    my $last_was_redirect = 0;
+    my $bytes_read = 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.
+               $file_content = "";
+            }
+            my($response,$agent,$h,$data)=@_;
+           $file_content .= $data;
+        });
+    return $agent->get($url, 'Range' => "bytes=0-0");
+}
+
+my @languages = ();
+my @lines = split(/\n/, 
DownloadFile("http://archive.apache.org/dist/openoffice/".$version."/binaries/";));
+foreach my $line (@lines)
+{
+    next unless $line =~ /folder.gif/;
+    if ($line =~ /a href=\"([^\"\/]+)\/\"/)
+    {
+       my $language = $1;
+       next if $language eq "SDK";
+       next if $language =~ /^[A-Z]/;
+       push @languages, $language;
+    }
+}
+
+print "<releases>\n";
+print "  <release>\n";
+printf "    <version>%s</version>\n", $version;
+print "    <download>\n";
+print "      <package-format>msi</package-format>\n";
+print "      <url-template>\n";
+printf "        
http://archive.apache.org/dist/openoffice/%s/binaries/%%L/Apache_OpenOffice_%s_Win_x86_install_%%L.exe\n",$version,
 $version;
+print "      </url-template>\n";
+foreach my $language (sort @languages)
+{
+    print "      <item>\n";
+    printf "        <language>%s</language>\n", $language;
+    my $name = sprintf(
+       "Apache_OpenOffice_%s_Win_x86_install_%s.exe",
+       $version,
+       $language,
+       $version,
+       $language);
+
+    my $content = DownloadFile(
+       
sprintf("http://archive.apache.org/dist/openoffice/%s/binaries/%s/%s.sha256";, 
$version, $language, $name));
+    if ($content =~ /^([a-f0-9]+)/)
+    {
+       printf("        <checksum type=\"sha256\">%s</checksum>\n", $1);
+    }
+    my $response = GetResponse(
+       sprintf("http://archive.apache.org/dist/openoffice/%s/binaries/%s/%s";, 
$version, $language, $name));
+    my $content_range = $response->{'_headers'}->{'content-range'};
+    if ($content_range =~ /bytes 0-0\/(\d+)/)
+    {
+       printf("        <size>%s</size>\n", $1);
+    }
+    print "      </item>\n";
+}
+
+print "    </download>\n";
+print "  </release>\n";
+print "</releases>\n";
diff --git a/test/testuno/data/limit_cfg.ini b/test/testuno/data/limit_cfg.ini
index c7af215f8b..a01b9b5d64 100644
--- a/test/testuno/data/limit_cfg.ini
+++ b/test/testuno/data/limit_cfg.ini
@@ -1,23 +1,23 @@
-/*the record rule: <level info>.<SettingsName>=<SettingsValue>*/
-/*Level info: starts from 1, 0 means no need for limitation check*/
-/*SettingsName: should not contain "."*/
-/*SettingsValue: the type should be int*/
-/*All the notes or comments in this configure file should be in /**/ in each 
line*/
-
-[TEXT]
-/*Max pages in the file*/
-1.MAXPAGE=100
-2.MAXPAGE=500
-
-[PRES]
-/*Max pages in the file, including master/layout/normal/notes*/
-1.MAXPAGE=75
-2.MAXPAGE=1500
-/*Max objects in the file, including all editable object on 
master/layout/normal/notes*/
-1.MAXOBJECT=500
-2.MAXOBJECT=500
-
-[SHEET]
-/*Max row in worksheet*/
-1.MAXROW=5000
+/*the record rule: <level info>.<SettingsName>=<SettingsValue>*/
+/*Level info: starts from 1, 0 means no need for limitation check*/
+/*SettingsName: should not contain "."*/
+/*SettingsValue: the type should be int*/
+/*All the notes or comments in this configure file should be in /**/ in each 
line*/
+
+[TEXT]
+/*Max pages in the file*/
+1.MAXPAGE=100
+2.MAXPAGE=500
+
+[PRES]
+/*Max pages in the file, including master/layout/normal/notes*/
+1.MAXPAGE=75
+2.MAXPAGE=1500
+/*Max objects in the file, including all editable object on 
master/layout/normal/notes*/
+1.MAXOBJECT=500
+2.MAXOBJECT=500
+
+[SHEET]
+/*Max row in worksheet*/
+1.MAXROW=5000
 2.MAXROW=5000

Reply via email to