office-gobmx/solenv/bin/update_module_ignore_lists.pl

256 lines
7.2 KiB
Perl
Raw Normal View History

:
eval 'exec perl -S $0 ${1+"$@"}'
if 0;
#*************************************************************************
#
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# Copyright 2000, 2010 Oracle and/or its affiliates.
#
# OpenOffice.org - a multi-platform office productivity suite
#
# This file is part of OpenOffice.org.
#
# OpenOffice.org is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 3
# only, as published by the Free Software Foundation.
#
# OpenOffice.org is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License version 3 for more details
# (a copy is included in the LICENSE file that accompanied this code).
#
# You should have received a copy of the GNU Lesser General Public License
# version 3 along with OpenOffice.org. If not, see
# <http://www.openoffice.org/license.html>
# for a copy of the LGPLv3 License.
#
#*************************************************************************
use Cwd;
use File::Temp qw/ tempfile tempdir /;
my $verbosity = 1; # will be adjusted to the value of $Env{VERBOSE} below
# platforms which are not supported anymore, and thus can be filtered from the svn:ignore list
my %obsolete_platforms = (
);
# (none so far)
# platforms whose output trees should appear in all modules' svn:ignore list
my @platforms = (
"common",
"unxlngi6",
"unxlngx6",
CWS-TOOLING: integrate CWS dba31g 2009-02-06 09:31:37 +0100 fs r267443 : line ends 2009-02-06 09:31:16 +0100 fs r267442 : line ends 2009-01-26 09:21:13 +0100 msc r266904 : #i10000# reactive tests 2009-01-21 12:38:53 +0100 msc r266657 : #i98316# add bugid 2009-01-20 14:49:04 +0100 msc r266584 : i97307 2009-01-20 13:43:22 +0100 oj r266572 : #i978i97860# merge changes from dba31h 2009-01-19 12:12:27 +0100 oj r266487 : #i97307# wrong shortcuts 2009-01-12 11:45:03 +0100 fs r266139 : #i97867# ImplPaint: don't paint if there are not items (yet) 2009-01-08 20:34:46 +0100 fs r266039 : ignore output paths 2009-01-08 20:25:45 +0100 fs r266038 : spelling: unxols4 -> unxsols4 2009-01-08 20:16:10 +0100 fs r266037 : BUILD_QADEVOOO 2009-01-08 20:15:35 +0100 fs r266036 : ignore output paths 2009-01-07 22:47:01 +0100 fs r265978 : close the document after the test 2009-01-07 22:40:22 +0100 fs r265977 : tweak the test, some behavior worked in a timing-dependent fashion only 2009-01-07 13:21:48 +0100 lla r265961 : #i96526# need FileAccess instead of File due to URL incompatibity 2009-01-07 12:27:19 +0100 lla r265959 : #i96526# need FileAccess instead of File due to URL incompatibity 2009-01-06 13:30:04 +0100 fs r265917 : #158964# GetFormControl: don't accept requests for model which do not belong to the page displayed in the given view 2009-01-06 13:30:04 +0100 fs r265916 : #158964# GetUnoControl: don't accept requests for a view where a foreign page is displayed 2009-01-06 13:26:37 +0100 fs r265915 : #158964# FmXPageViewWinRec::dispose: catch exceptions (fixes the symptom, the root cause is fixed elsewhere) 2009-01-06 09:52:38 +0100 oj r265897 : #i97307# shortcuts 2009-01-06 09:41:26 +0100 fs r265896 : #i10000# 2009-01-05 13:40:38 +0100 fs r265866 : CWS-TOOLING: rebase CWS dba31g to trunk@265758 (milestone: DEV300:m38) 2008-12-18 11:35:43 +0100 fs r265678 : document the new InputRequired property 2008-12-17 07:25:18 +0100 oj r265578 : #i97307# insert new Accelerators handling in configuration 2008-12-16 09:52:27 +0100 lla r265526 : #i96526# error message is a problem with no existance default.otr occur 2008-12-16 09:33:14 +0100 oj r265525 : #i96948# remove merge conflict with StreamName 2008-12-16 09:22:12 +0100 oj r265524 : #i96935# set reportcomponent for custom shape 2008-12-15 10:32:38 +0100 oj r265463 : #i96965# do not add connection for selfreferencing table 2008-12-12 14:00:56 +0100 fs r265416 : #i97044# EnableFocusSelectionHide=FALSE => don't hide selection when not focused (this is more of a side effect), and preserve the selection when gaining the focus (this is the desired effect) 2008-12-11 15:32:32 +0100 fs r265319 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 15:31:25 +0100 fs r265317 : prevent a deadlock during complex.dbaccess.DatabaseDocument test 2008-12-11 13:45:06 +0100 fs r265296 : #i97137# 2008-12-11 12:43:00 +0100 fs r265285 : #i97134# 2008-12-10 13:20:28 +0100 lla r265175 : #94067# add (APP|SYS)FONT to XUnitConversion interface implementation 2008-12-10 13:08:22 +0100 lla r265173 : #i94067# add (APP|SYS)FONT 2008-12-10 09:21:39 +0100 fs r265151 : #i95010# implement a non-hacky solution for #i94033#, by making Begin/Do/EndCompleteRedraw virtual 2008-12-09 17:29:32 +0100 fs r265120 : #i96636#
2009-02-13 01:10:18 -06:00
"unxsols4",
"unxsolu4",
"unxsoli4",
"wntmsci12",
"unxmacxi",
"unxubit8",
"unxaixp",
"unxbsda",
"unxbsdi2",
"unxbsdi",
"unxbsds",
"unxfbsdi",
"unxfbsd",
"unxfbsdx",
"unxhpgr",
"unxhpxr",
"unxirgm",
"unxirxm3",
"unxirxm",
"unxlnga",
"unxlngm68k",
"unxlngmips",
"unxlngp",
"unxlngppc4",
"unxlngppc64",
"unxlngppc",
"unxlngr",
"unxlngs3904",
"unxlngs390x",
"unxlngs",
"unxlnxi",
"unxmacxp",
"unxsogi",
"unxsogs"
);
# .........................................................................
# retrieves the repository URL of the SVN working copy in the current directory
sub retrieve_repo_url
{
open( SVN, "svn info 2>&1 |" );
my @result = <SVN>;
close( SVN );
foreach (@result)
{
chomp;
next if ( ! /^URL: / );
s/^URL: //;
return $_;
}
return undef;
}
# .........................................................................
# gets the "modules" below the given SVN repository URL, by calling "svn list"
sub get_modules
{
my @modules = ();
open( SVN, "svn list $_ 2>&1 |" );
my @result = <SVN>;
close( SVN );
foreach (@result)
{
chomp;
s/\/$//;
push @modules, $_;
}
return @modules;
}
# .........................................................................
sub set_ignore_property
{
my ($repo_url, @modules) = @_;
# max length of a module name
my $max_len = 0;
foreach ( @modules ) { $max_len = length( $_ ) if ( length( $_ ) > $max_len ); }
my $updated = 0;
my $current = 0;
my $count = $#modules + 1;
foreach $module ( @modules )
{
++$current;
# print progress
if ( $verbosity > 1 )
{
my $progress = "$module ";
$progress .= "(" . $current . "/" . $count . ")";
my $dots = 3 + ( $max_len - length($module) );
$dots += int( digits( $count ) ) - int( digits( $current ) );
$progress .= ( "." x $dots );
$progress .= " ";
print STDOUT $progress;
}
elsif ( $verbosity > 0 )
{
print STDOUT ".";
}
# retrieve the current ignore list
open( SVN, "svn propget svn:ignore $module 2>&1 |" );
my @ignore_list = <SVN>;
close( SVN );
# the last item in the list is an empty string, usually. Don't let it confuse the below
# code
my $supposed_empty = pop @ignore_list;
chomp( $supposed_empty );
push( @ignore_list, $supposed_empty ) if ( !( $supposed_empty =~ /^$/ ) );
# filter out obsolte entries
my @stripped_ignore_list = ();
foreach $ignore_entry (@ignore_list)
{
chomp( $ignore_entry );
next if ( $ignore_entry =~ /^$/ );
if ( ( exists $obsolete_platforms{$ignore_entry} )
|| ( exists $obsolete_platforms{"$ignore_entry.pro"} )
)
{
next;
}
push @stripped_ignore_list, $ignore_entry;
}
my $removed = $#ignore_list - $#stripped_ignore_list;
@ignore_list = @stripped_ignore_list;
# append the platforms which should appear in the ignore list
my %ignore_list = ();
foreach (@ignore_list) { $ignore_list{$_} = 1; }
foreach $platform_entry ( @platforms )
{
$ignore_list{$platform_entry} = 1;
$ignore_list{"$platform_entry.pro"} = 1;
}
my @extended_ignore_list = keys %ignore_list;
my $added = $#extended_ignore_list - $#ignore_list;
@ignore_list = @extended_ignore_list;
if ( $removed || $added )
{
# create a temporary file taking the new content of the svn_ignore property
my $temp_dir = tempdir( CLEANUP => 1 );
my ($fh, $filename) = tempfile( DIR => $dir );
open( IGNORE, ">$filename" );
print IGNORE join "\n", @ignore_list;
close( IGNORE );
# actually set the property
open( SVN, "svn propset -F $filename svn:ignore $module 2>&1 |" );
++$updated;
}
# statistics
print STDOUT "done (removed/added: $removed/$added)\n" if $verbosity > 1;
}
print STDOUT "\n" if $verbosity eq 1;
print STDOUT "$updated module(s) updated\n" if $verbosity > 0;
}
# .........................................................................
sub digits
{
my ($number, $base) = @_;
$base = 10 if !defined $base;
return log($number)/log($base);
}
# .........................................................................
# 'main'
# initialize verbosity
my $verbose = $ENV{VERBOSE};
if ( defined $verbose )
{
$verbose = uc( $verbose );
$verbosity = 2 if ( $verbose eq "TRUE" );
$verbosity = 0 if ( $verbose eq "FALSE" );
}
# work on the current directory
my $working_copy_root = cwd();
die "current directory does not contain an SVN working copy" if !-d $working_copy_root . "/\.svn";
# retrieve repository URL
my $repo_url = retrieve_repo_url();
die "unable to retrieve repository URL" if !defined $repo_url;
print STDOUT "repository URL: $repo_url\n" if $verbosity > 1;
# list modules
my @modules = get_modules( $repo_url );
print STDOUT "processing " . ( $#modules + 1 ) . " modules\n" if $verbosity > 0;
# process modules, by setting the svn:ignore property
set_ignore_property( $repo_url, @modules );