diff options
Diffstat (limited to 'postprocess')
-rw-r--r-- | postprocess/checkdeliver/checkdeliver.pl | 297 | ||||
-rw-r--r-- | postprocess/checkdeliver/makefile.mk | 46 | ||||
-rw-r--r-- | postprocess/checkxml/checkxml.pl | 144 | ||||
-rw-r--r-- | postprocess/checkxml/makefile.mk | 46 | ||||
-rw-r--r-- | postprocess/packconfig/macosx/macosx_menubar_modification.xsl | 26 | ||||
-rw-r--r-- | postprocess/packconfig/makefile.mk | 46 | ||||
-rwxr-xr-x | postprocess/packconfig/packconfig.pl | 295 | ||||
-rw-r--r-- | postprocess/prj/build.lst | 7 | ||||
-rw-r--r-- | postprocess/prj/d.lst | 2 | ||||
-rwxr-xr-x | postprocess/rebase/coffbase.txt | 350 | ||||
-rwxr-xr-x | postprocess/rebase/makefile.mk | 63 | ||||
-rw-r--r-- | postprocess/rebase/no_rebase.txt | 33 | ||||
-rwxr-xr-x | postprocess/rebase/rebase.pl | 310 | ||||
-rw-r--r-- | postprocess/signing/makefile.mk | 64 | ||||
-rw-r--r-- | postprocess/signing/no_signing.txt | 13 | ||||
-rw-r--r-- | postprocess/signing/signing.pl | 277 |
16 files changed, 2019 insertions, 0 deletions
diff --git a/postprocess/checkdeliver/checkdeliver.pl b/postprocess/checkdeliver/checkdeliver.pl new file mode 100644 index 000000000000..2baec9d0ef36 --- /dev/null +++ b/postprocess/checkdeliver/checkdeliver.pl @@ -0,0 +1,297 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: checkdeliver.pl,v $ +# +# $Revision: 1.14 $ +# +# 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. +# +#************************************************************************* +# +# +# checkdeliver.pl - compare delivered files on solver with those on SRC_ROOT +# + +use strict; +use Getopt::Long; +use File::stat; +use IO::Handle; + +use lib ("$ENV{SOLARENV}/bin/modules"); +use SourceConfig; + +#### globals ##### + +my $err = 0; +my $srcrootdir = ''; +my $solverdir = ''; +my $platform = ''; +my $milestoneext = ''; +my $local_env = 0; +my $source_config = SourceConfig -> new(); +my @exceptionmodlist = ( + "postprocess", + "instset.*native", + "smoketest.*native" + ); # modules not yet delivered + +#### main ##### + +print "checkdeliver.pl - checking delivered binaries\n"; + +get_globals(); # get global variables +my $deliverlists_ref = get_deliver_lists(); # get deliver log files +foreach my $listfile ( @$deliverlists_ref ) { + $err += check( $listfile ); # check delivered files +} +print "OK\n" if ( ! $err ); +exit $err; + +#### subroutines #### + +sub get_globals +# set global variables using environment variables and command line options +{ + my $help; + + # set global variables according to environnment + $platform = $ENV{INPATH}; + $srcrootdir = $ENV{SOURCE_ROOT_DIR}; + $solverdir = $ENV{SOLARVERSION}; + $milestoneext = $ENV{UPDMINOREXT}; + + # override environment with command line options + GetOptions('help' => \$help, + 'p=s' => \$platform + ) or usage (1); + + if ( $help ) { + usage(0); + } + + #do some sanity checks + if ( ! ( $platform && $srcrootdir && $solverdir ) ) { + die "Error: please set environment\n"; + } + if ( ! -d $srcrootdir ) { + die "Error: cannot find source directory '$srcrootdir'\n"; + } + if ( ! -d $solverdir ) { + die "Error: cannot find solver directory '$solverdir'\n"; + } + + # Check for local env., taken from solenv/bin/modules/installer/control.pm + # In this case the content of SOLARENV starts with the content of SOL_TMP + my $solarenv = ""; + my $sol_tmp; + if ( $ENV{'SOLARENV'} ) { + $solarenv = $ENV{'SOLARENV'}; + } + if ( $ENV{'SOL_TMP'} ) { + $sol_tmp = $ENV{'SOL_TMP'}; + } + if ( defined $sol_tmp && ( $solarenv =~ /^\s*\Q$sol_tmp\E/ )) { + # Content of SOLARENV starts with the content of SOL_TMP: Local environment + $local_env = 1; + } +} + +sub get_deliver_lists +# find deliver log files on solver +{ + my @files; + my $pattern = "$solverdir/$platform/inc"; + $pattern .= "$milestoneext" if ( $milestoneext ); + $pattern .= "/*/deliver.log"; + + if ( $^O =~ /cygwin/i && $ENV{'USE_SHELL'} eq "4nt" ) + { # glob from cygwin's perl needs $pattern to use only slashes. + # (DOS style path are OK as long as slashes are used.) + $pattern =~ s/\\/\//g; + } + + @files = glob( $pattern ); + # do not check modules not yet built + foreach my $exceptionpattern ( @exceptionmodlist ) { + @files = grep ! /\/$exceptionpattern\//, @files; + } + if ( ! @files ) { + die "Error: cannot find deliver log files"; + } + return \@files; +} + +sub check +# reads deliver log file given as parameter and compares pairs of files listed there. +{ + my $listname = shift; + my $error = 0; + my %delivered; + my $module; + STDOUT->autoflush(1); + # which module are we checking? + if ( $listname =~ /\/([\w-]+?)\/deliver\.log$/o) { + $module = $1; + } else { + print "Error: cannot determine module name from \'$listname\'\n"; + return 1; + } + # where do we have to look for modules? + my $repository = $source_config->get_module_repository($module); + my $path = $source_config->get_module_path($module); + # is module physically accessible? + # there are valid use cases where we build against a prebuild solver whithout having + # all modules at disk + my $canread = is_moduledirectory( $path ); + if ( ! $canread ) { + # do not bother about non existing modules in local environment + # or on childworkspaces + if (( $local_env ) || ( $ENV{CWS_WORK_STAMP} )) { + # print STDERR "Warning: module '$module' not found. Skipping.\n"; + return $error; + } + # in a master build it is considered an error to have deliver leftovers + # from non exising (removed) modules + print "Error: module '$module' not found.\n"; + $error++; + return $error; + } + if ( $canread == 2 ) { + # module is linked and not built, no need for checking + # should not happen any more nowadays ... + return $error; + } + + # read deliver log file + open( DELIVERLOG, "< $listname" ) or die( "Error: cannot open file \'$listname\'\n$!"); + foreach ( <DELIVERLOG> ) { + next if ( /^LINK / ); + # For now we concentrate on binaries, located in 'bin' or 'lib' and 'misc/build/<...>/[bin|lib]'. + next if ( (! / $module\/$platform\/[bl]i[nb]\//) && (! / $module\/$platform\/misc\/build\//)); + next if (! /[bl]i[nb]/); + next if ( /\.html$/ ); + chomp; + if ( /^\w+? (\S+) (\S+)\s*$/o ) { + $delivered{$1} = $2; + } else { + print "Warning: cannot parse \'$listname\' line\n\'$_\'\n"; + } + } + close( DELIVERLOG ); + + # compare all delivered files with their origin + # no strict 'diff' allowed here, as deliver may alter files (hedabu, strip, ...) + foreach my $file ( sort keys %delivered ) { + my $ofile = "$srcrootdir/$repository/$file"; + my $sfile = "$solverdir/$delivered{$file}"; + if ( $milestoneext ) { + # deliver log files do not contain milestone extension on solver + $sfile =~ s/\/$platform\/(...)\//\/$platform\/$1$milestoneext\//; + } + my $orgfile_stats = stat($ofile); + next if ( -d _ ); # compare files, not directories + my $delivered_stats = lstat($sfile); + next if ( -d _ ); # compare files, not directories + if ( $^O !~ /^MSWin/ ) { + # windows does not know about links. + # Therefore lstat() is not a lstat, and the following check would break + next if ( -l _ ); # compare files, not links + } + + if ( $orgfile_stats && $delivered_stats ) { + # Stripping (on unix like platforms) and signing (for windows) + # changes file size. Therefore we have to compare for file dates. + # File modification time also can change after deliver, f.e. by + # rebasing, but only increase. It must not happen that a file on + # solver is older than it's source. + if ( ( $orgfile_stats->mtime - $delivered_stats->mtime ) gt 1 ) { + print "Error: "; + print "delivered file is older than it's source '$ofile' '$sfile'\n"; + $error ++; + } + } elsif ( !$orgfile_stats && $delivered_stats ) { + # This is not an error if we have a solver and did not build the + # module! + } elsif ( !$orgfile_stats && !$delivered_stats ) { + # This is not an error if we have a solver and did not build the + # module! + # Instead, this seems to be an error of the deliver.log file, where + # even in the master build an allegedly delivered directory is not + # present in the solver. Places where this occurred: + # + # moz_prebuilt/deliver.log: + # COPY macromigration/unxlngi6/bin/samples unxlngi6/bin/samples + # COPY macromigration/unxlngi6/bin/lib unxlngi6/bin/lib + # + # macromigration/deliver.log: + # COPY moz_prebuilt/unxlngi6/lib/defaults unxlngi6/lib/defaults + # COPY moz_prebuilt/unxlngi6/lib/greprefs unxlngi6/lib/greprefs + # COPY moz_prebuilt/unxlngi6/lib/components unxlngi6/lib/components + # + # However release engineers got around that.. + } else { + print "Error: no such file '$ofile'\n" if ( ! $orgfile_stats ); + print "Error: no such file '$sfile'\n" if ( ! $delivered_stats ); + $error ++; + } + } + if ( $error ) { + print "$error errors found: Module '$module' not delivered correctly?\n\n"; + } + STDOUT->autoflush(0); + return $error; +} + +sub is_moduledirectory +# Test whether we find a module having a d.lst file at a given path. +# Return value: 1: path is valid directory +# 2: path.link is a valid link +# 0: module not found +{ + my $dirname = shift; + if ( -e "$dirname/prj/d.lst" ) { + return 1; + } elsif ( -e "$dirname.link/prj/d.lst" ) { + return 2 + } else { + return 0; + } +} + +sub usage +# print usage message and exit +{ + my $retval = shift; + print STDERR "Usage: checkdeliver.pl [-h] [-p <platform>]\n"; + print STDERR "Compares delivered files on solver with original ones in build tree\n"; + print STDERR "Options:\n"; + print STDERR " -h print this usage message\n"; + print STDERR " -p platform specify platform\n"; + + exit $retval; +} + diff --git a/postprocess/checkdeliver/makefile.mk b/postprocess/checkdeliver/makefile.mk new file mode 100644 index 000000000000..3a515a6449d7 --- /dev/null +++ b/postprocess/checkdeliver/makefile.mk @@ -0,0 +1,46 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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. +# +#************************************************************************* +PRJ=.. + + + +PRJNAME=postprocess +TARGET=checkdeliver + +.INCLUDE : settings.mk + +.INCLUDE : target.mk + +ALLTAR : $(MISC)$/checkdeliver.done + +$(MISC)$/checkdeliver.done .PHONY: + $(PERL) checkdeliver.pl > $@ || cat $@ + diff --git a/postprocess/checkxml/checkxml.pl b/postprocess/checkxml/checkxml.pl new file mode 100644 index 000000000000..348076782fcf --- /dev/null +++ b/postprocess/checkxml/checkxml.pl @@ -0,0 +1,144 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: checkxml.pl,v $ +# +# $Revision: 1.8 $ +# +# 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. +# +#************************************************************************* +# +# +# check_xml.pl - check xml,xcs,xcu files size, NULL character +# + +my +$is_debug=0; +my $err = 0; +my $path = $ENV{'SOLARVERSION'} . '/' . $ENV{'INPATH'} . '/xml' . "$ENV{'UPDMINOREXT'}/"; +my $pck_path = $ENV{'SOLARVERSION'} . '/' . $ENV{'INPATH'} . '/pck' . "$ENV{'UPDMINOREXT'}/"; +my $unzipexe="unzip"; + +#Path of the directory from which the recursion starts (must have ending '/'). +print "Checking:$path\n"; +# Initiate the recursion +&RecurseDirs($path); +$err += &check_registry_zips($pck_path); +if ($err > 0) +{ + print "Error: $err damaged files encountered\n"; + exit(1); # stop dmake +} else +{ + print "ok.\n"; +} +exit; + +#### SUBROUTINES SECTION #### + +# Function that recurses through the directory tree calling FileFunction on all files +sub RecurseDirs { + my ($path) = @_; + my $file; #Variable for a file + + opendir (DIRECTORY, $path) or + die "Can't read $path\n"; + my @all_files = grep (!/^\.\.?$/, readdir (DIRECTORY)); #Read all the files except for '.' and '..' + closedir (DIRECTORY); + + foreach $file (@all_files) { + if (-d "$path$file/") { + &RecurseDirs("$path$file/"); + } else { + &check($path, $file); + } + } +} + +############################################################################ +sub check #04.02.2005 13:40 +############################################################################ + { + my $path = shift; + my $file = shift; + print "$path$file\n" if ((-e "$path$file") && $is_debug); + return if ( $file !~ /.+\.(xcu|xml|xcs)/ ); #check xml and xcu files only + if ( -z "$path$file" ) { + print "Error: $path$file 0 Bytes!\n"; + $err++; + } else + { + open( FH, "<$path$file" ); + while ( $line = <FH> ) { + #print $line; + if ( $line =~ /\000+/ ) { + print "Error: NULL characters detected in $path$file\n"; + $err++; + } + } + close(FH); + } + } + + ############################################################################ + sub check_registry_zips #20.04.2005 18:47 + ############################################################################ + { + my $path = shift; + my $error = 0; + my $commandargs; + opendir (DIRECTORY, $path) or + die "Can't read $path\n"; + my @all_files = grep (!/^\.\.?$/, readdir (DIRECTORY)); #Read all the files except for '.' and '..' + closedir (DIRECTORY); + foreach $file (@all_files) { + if ( $file =~ /registry_.+\.zip$/ ) { + $commandargs="$path$file"; + # Cygwin's perl needs escaped \ in system() and open( COMMAND ... ) + if ( "$^O" eq "cygwin" ) { $commandargs =~ s/\\/\\\\/g; } + print "file=$commandargs\n" if ($is_debug); + open(UNZIP,"$unzipexe -l $commandargs |"); + my $ferror = 0; + while ( $line = <UNZIP> ) { + #print $line; + my @param = split(" ",$line); + if ( $param[0] =~ /\d+/ ) { + if ( $param[0] == 0 && $param[3] =~ /.+\.xcu$/) + { + $error++; $ferror=1; + } + } + } + if ( $ferror ) { + print "Error: $commandargs contains files with 0 byte size\n"; + } + close(UNZIP); + } + } + + ($error); + } ##check_registry_zips diff --git a/postprocess/checkxml/makefile.mk b/postprocess/checkxml/makefile.mk new file mode 100644 index 000000000000..fec44d6ada3e --- /dev/null +++ b/postprocess/checkxml/makefile.mk @@ -0,0 +1,46 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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. +# +#************************************************************************* +PRJ=.. + + + +PRJNAME=postprocess +TARGET=checkxml + +.INCLUDE : settings.mk + +.INCLUDE : target.mk + +ALLTAR : $(MISC)$/checkxml.done + +$(MISC)$/checkxml.done .PHONY: + $(PERL) checkxml.pl + diff --git a/postprocess/packconfig/macosx/macosx_menubar_modification.xsl b/postprocess/packconfig/macosx/macosx_menubar_modification.xsl new file mode 100644 index 000000000000..91c1d6fc2522 --- /dev/null +++ b/postprocess/packconfig/macosx/macosx_menubar_modification.xsl @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<xsl:stylesheet version='1.0' + xmlns:menu="http://openoffice.org/2001/menu" + xmlns:xsl='http://www.w3.org/1999/XSL/Transform' > + + <!-- identity template, does reproduce every IN node on the output --> + <xsl:template match="node()|@*"> + <xsl:copy> + <xsl:apply-templates select="node()|@*"/> + </xsl:copy> + </xsl:template> + + <!-- filtering template : removes the concerned nodes --> + <!-- removes the separator just before the expected item --> + <xsl:template match="menu:menuseparator[following-sibling::menu:menuitem[1]/@menu:id='.uno:Quit']"/> + <!-- suppression of the Quit item --> + <xsl:template match="menu:menuitem[@menu:id='.uno:Quit']"/> + + <xsl:template match="menu:menuseparator[following-sibling::menu:menuitem[1]/@menu:id='.uno:About']"/> + <!-- suppression of the About item --> + <xsl:template match="menu:menuitem[@menu:id='.uno:About']"/> + + <!-- suppression of the OptionsTreeDialog item --> + <xsl:template match="menu:menuitem[@menu:id='.uno:OptionsTreeDialog']"/> + +</xsl:stylesheet> diff --git a/postprocess/packconfig/makefile.mk b/postprocess/packconfig/makefile.mk new file mode 100644 index 000000000000..89da45a83126 --- /dev/null +++ b/postprocess/packconfig/makefile.mk @@ -0,0 +1,46 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.4 $ +# +# 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. +# +#************************************************************************* +PRJ=.. + + + +PRJNAME=postprocess +TARGET=uiconfig + +.INCLUDE : settings.mk + +.INCLUDE : target.mk + +ALLTAR : $(BIN)$/uiconfig.zip + +$(BIN)$/uiconfig.zip .PHONY: + $(PERL) packconfig.pl -i $(SOLARXMLDIR)$/uiconfig -o $@ + diff --git a/postprocess/packconfig/packconfig.pl b/postprocess/packconfig/packconfig.pl new file mode 100755 index 000000000000..d34b8fd5449c --- /dev/null +++ b/postprocess/packconfig/packconfig.pl @@ -0,0 +1,295 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: packconfig.pl,v $ +# +# $Revision: 1.3.24.2 $ +# +# 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. +# +#************************************************************************* + +# +# packconfig.pl - pack xml configuration into archives +# + +use strict; +use Getopt::Long; +use File::Find; +use File::Basename; +use Archive::Zip qw(:ERROR_CODES :CONSTANTS); + +#### globals #### + +my $out_file; # path to output archive +my $tmp_out_file; # path to temporary output file +my $files_path; # path to look for desired files +my $verbose; # be verbose +my $extra_verbose; # be extra verbose +my $do_rebuild = 0; # is rebuilding zipfile required? + +#### script id ##### + +( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; + +my $script_rev; +my $id_str = ' $Revision: 1.3.24.2 $ '; +$id_str =~ /Revision:\s+(\S+)\s+\$/ + ? ($script_rev = $1) : ($script_rev = "-"); + +#print "$script_name -- version: $script_rev\n"; + +#### main ##### + +parse_options(); +my %files_hash; +my $file_ref = get_files(); + +$do_rebuild = is_file_newer(\%files_hash) if $do_rebuild == 0; + +if ( $do_rebuild == 1 ) { + create_zip_archive(\%files_hash); + replace_file($tmp_out_file, $out_file); + print_message("packing $out_file finished."); +} else { + print_message("$out_file up to date. nothing to do."); +} + +exit(0); + +#### subroutines #### + +sub parse_options +{ + my $opt_help; + my $p = Getopt::Long::Parser->new(); + my $success =$p->getoptions( + '-h' => \$opt_help, + '-o=s' => \$out_file, + '-i=s' => \$files_path, + '-v' => \$verbose, + '-vv' => \$extra_verbose + ); + + if ( $opt_help || !$success || !$out_file || !$files_path ) + { + usage(); + exit(1); + } + + #define intermediate output file + $tmp_out_file="$out_file"."$$".$ENV{INPATH}; + # Sanity checks. + + # Check if out_file can be written. + my $out_dir = dirname($out_file); + print_error("no such directory: '$out_dir'", 2) if ! -d $out_dir; + print_error("can't search directory: '$out_dir'", 2) if ! -x $out_dir; + print_error("directory is not writable: '$out_dir'", 2) if ! -w $out_dir; + + # Check paths. + foreach ($files_path) { + print_error("no such directory: '$_'", 2) if ! -d $_; + print_error("can't search directory: '$_'", 2) if ! -x $_; + } +} + +sub get_files +{ + local @main::file_list; + + find_files(\%files_hash); + + if ( !keys %files_hash ) { + print_error("can't find any image lists in '$files_path'", 3); + } + + return wantarray ? @main::file_list : \@main::file_list; +} + +sub find_files +{ + my $files_hash_ref = shift; + find({ wanted => \&wanted, no_chdir => 0 }, "$files_path"); + foreach ( @main::file_list ) { + /^\Q$files_path\E\/(.*)$/o; + $files_hash_ref->{$1}++; + } +} + +sub wanted +{ + my $file = $_; + + if ( $file =~ /.*\.xml$/ && -f $file ) { + push @main::file_list, $File::Find::name; + } +} + +sub is_file_newer +{ + my $test_hash_ref = shift; + my $reference_stamp = 0; + + print_message("checking timestamps ...") if $verbose; + if ( -e $out_file ) { + $reference_stamp = (stat($out_file))[9]; + print_message("found $out_file with $reference_stamp ...") if $verbose; + } + return 1 if $reference_stamp == 0; + + foreach ( sort keys %{$test_hash_ref} ) { + my $path = $files_path; + $path .= "/" if "$path" ne ""; + $path .= "$_"; + print_message("checking '$path' ...") if $extra_verbose; + my $mtime = (stat($path))[9]; + return 1 if $reference_stamp < $mtime; + } + return 0; +} + +sub create_zip_archive +{ + my $zip_hash_ref = shift; + print_message("creating config archive ...") if $verbose; + my $zip = Archive::Zip->new(); + + # on Mac OS X Intel we have unxmacxi.pro, on Mac OS X PowerPC unxmacxp.pro .. and so on + my $platform = $ENV{INPATH}; + + foreach ( sort keys %{$zip_hash_ref} ) { + my $path = "$files_path/$_"; + # only Mac OS X Aqua is concerned here + # but changes for other platforms can easely be added following the same principle + if ( ( $platform =~ /^.*macx*/) && ($path =~ /^.*menubar.xml/ ) ) { + $path = modify_mac_menus($path); + } + print_message("zipping '$path' ...") if $extra_verbose; + if ( !$zip->addFile($path, $_) ) { + print_error("can't add file '$path' to config zip archive: $!", 5); + } + } + my $status = $zip->writeToFileNamed($tmp_out_file); + if ( $status != AZ_OK ) { + print_error("write image zip archive '$tmp_out_file' failed. Reason: $status", 6); + } + return; +} + +sub modify_mac_menus +{ + my $path_base = "$ENV{'SOLARENV'}"; + $path_base =~ s/solenv//; + + my $new_file_name = "$path_base"."postprocess"."\/"."$ENV{INPATH}"."\/"."misc"."\/"."$_"; + + my $new_directory = $new_file_name; + $new_directory =~ s/\/menubar.xml//; + if ( ! -e $new_directory) { + `mkdir -p "$new_directory"`; + } + + my $old_file_name = "$files_path/$_"; + + `cp $old_file_name $new_file_name`; + + my $temp_file_name = "$new_file_name"."_tmp"; + my $xsl_file = "macosx/macosx_menubar_modification.xsl"; + + my $result = `xsltproc $xsl_file $new_file_name > $temp_file_name`; + + if ( $result != 0) { + print_error("xsltproc '$xsl_file' '$new_file_name'> '$temp_file_name' failed",1) + } + + replace_file( $temp_file_name, $new_file_name ); + return $new_file_name; +} + +sub replace_file +{ + my $source_file = shift; + my $dest_file = shift; + my $result = 0; + + $result = unlink($dest_file) if -f $dest_file; + if ( $result != 1 && -f $dest_file ) { + unlink $source_file; + print_error("couldn't remove '$dest_file'",1); + } else { + if ( !rename($source_file, $dest_file)) { + unlink $source_file; + print_error("couldn't rename '$source_file'",1); + } + } + return; +} + +sub usage +{ + print STDERR "Usage: packimages.pl [-h] -o out_file -i file_path\n"; + print STDERR "Creates archive of images\n"; + print STDERR "Options:\n"; + print STDERR " -h print this help\n"; + print STDERR " -o out_file path to output archive\n"; + print STDERR " -i file_path path to directory containing the config files\n"; + print STDERR " -v verbose\n"; + print STDERR " -vv very verbose\n"; +} + +sub print_message +{ + my $message = shift; + + print "$script_name: "; + print "$message\n"; + return; +} + +sub print_warning +{ + my $message = shift; + + print STDERR "$script_name: "; + print STDERR "WARNING $message\n"; + return; +} + +sub print_error +{ + my $message = shift; + my $error_code = shift; + + print STDERR "$script_name: "; + print STDERR "ERROR: $message\n"; + + if ( $error_code ) { + print STDERR "\nFAILURE: $script_name aborted.\n"; + exit($error_code); + } + return; +} diff --git a/postprocess/prj/build.lst b/postprocess/prj/build.lst new file mode 100644 index 000000000000..8fd2fe49ba6e --- /dev/null +++ b/postprocess/prj/build.lst @@ -0,0 +1,7 @@ +po postprocess :: accessibility automation basctl bean fondu BINFILTER:binfilter chart2 configmgr CRASHREP:crashrep cui dbaccess desktop dtrans embeddedobj embedserv EPM:epm eventattacher extensions extras fileaccess filter forms fpicker helpcontent2 hwpfilter io JAVAINSTALLER2:javainstaller2 lingucomponent MATHMLDTD:MathMLDTD ODK:odk officecfg package padmin psprint_config remotebridges sc scaddins sccomp scp2 scripting sd setup_native slideshow starmath sw sysui testshl2 testtools ucb UnoControls unoxml ure wizards xmerge xmlsecurity BITSTREAM_VERA_FONTS:bitstream_vera_fonts DICTIONARIES:dictionaries OOo:pyuno OOo:readlicense_oo SO:top unodevtools JFREEREPORT:jfreereport REPORTBUILDER:reportbuilder reportdesign SDEXT:sdext SWEXT:swext uui writerfilter oox NULL +po postprocess usr1 - all po_mkout NULL +po postprocess\checkxml nmake - all po_checkxml NULL +po postprocess\checkdeliver nmake - all po_checkdlv NULL +po postprocess\packconfig nmake - all po_packconfig po_checkxml NULL +po postprocess\rebase nmake - w po_rebase NULL +po postprocess\signing nmake - w,sign po_signing po_rebase.w NULL diff --git a/postprocess/prj/d.lst b/postprocess/prj/d.lst new file mode 100644 index 000000000000..afd5d3b86b1c --- /dev/null +++ b/postprocess/prj/d.lst @@ -0,0 +1,2 @@ +..\%__SRC%\bin\uiconfig.zip %_DEST%\bin%_EXT%\uiconfig.zip + diff --git a/postprocess/rebase/coffbase.txt b/postprocess/rebase/coffbase.txt new file mode 100755 index 000000000000..8ffbabcbbfaf --- /dev/null +++ b/postprocess/rebase/coffbase.txt @@ -0,0 +1,350 @@ +abpmi.dll 0x0000000067fd0000 0x00020000
+acceptor.uno.dll 0x0000000067fb0000 0x00010000
+accmi.dll 0x0000000067f00000 0x000a0000
+adabasmi.dll 0x0000000067e90000 0x00060000
+adabasuimi.dll 0x0000000067e60000 0x00020000
+ado2.dll 0x0000000067dd0000 0x00080000
+affine_uno_uno.dll 0x0000000067db0000 0x00010000
+aggmi.dll 0x0000000067d70000 0x00030000
+analysismi.dll 0x0000000067d20000 0x00040000
+animcore.dll 0x0000000067cf0000 0x00020000
+avmediami.dll 0x0000000067ca0000 0x00040000
+avmediawin.dll 0x0000000067c70000 0x00020000
+basctlmi.dll 0x0000000067ba0000 0x000c0000
+basebmpmi.dll 0x00000000678a0000 0x002f0000
+basegfxmi.dll 0x0000000067820000 0x00070000
+basprovmi.uno.dll 0x00000000677f0000 0x00020000
+behelper.uno.dll 0x00000000677a0000 0x00010000
+bf_frmmi.dll 0x00000000676b0000 0x000e0000
+bf_gomi.dll 0x0000000067680000 0x00020000
+bf_migratefiltermi.dll 0x0000000067660000 0x00010000
+bf_ofami.dll 0x0000000067640000 0x00010000
+bf_sbmi.dll 0x00000000675b0000 0x00080000
+bf_schmi.dll 0x0000000067500000 0x000a0000
+bf_scmi.dll 0x00000000672a0000 0x00250000
+bf_sdmi.dll 0x00000000671f0000 0x000a0000
+bf_smmi.dll 0x0000000067190000 0x00050000
+bf_somi.dll 0x00000000670f0000 0x00090000
+bf_svtmi.dll 0x0000000066f30000 0x001b0000
+bf_svxmi.dll 0x0000000066b50000 0x003d0000
+bf_swmi.dll 0x00000000668b0000 0x00290000
+bf_wrappermi.dll 0x0000000066880000 0x00020000
+bf_xomi.dll 0x0000000066480000 0x003f0000
+bibmi.dll 0x0000000066430000 0x00040000
+bindetmi.dll 0x0000000066410000 0x00010000
+bootstrap.uno.dll 0x0000000066380000 0x00080000
+bootstrpdtmi.dll 0x0000000066350000 0x00020000
+bridgefac.uno.dll 0x0000000066330000 0x00010000
+cached1.dll 0x00000000662b0000 0x00030000
+calcmi.dll 0x0000000066260000 0x00040000
+canvasfactory.uno.dll 0x0000000066240000 0x00010000
+canvastoolsmi.dll 0x00000000661b0000 0x00080000
+chartcontrollermi.dll 0x0000000066030000 0x00170000
+chartmodelmi.dll 0x0000000065f70000 0x000b0000
+charttoolsmi.dll 0x0000000065dd0000 0x00190000
+chartviewmi.dll 0x0000000065c60000 0x00160000
+cli_uno.dll 0x0000000065c20000 0x00030000
+collator_data.dll 0x0000000065aa0000 0x00170000
+communimi.dll 0x0000000065a80000 0x00010000
+comphelp4msc.dll 0x0000000065980000 0x000f0000
+configmgr2.uno.dll 0x0000000065800000 0x00170000
+connector.uno.dll 0x00000000657e0000 0x00010000
+cppcanvasmi.dll 0x0000000065780000 0x00050000
+cppu3.dll 0x0000000065740000 0x00030000
+cppuhelper3msc.dll 0x00000000656c0000 0x00070000
+ctlmi.dll 0x0000000065680000 0x00030000
+cuimi.dll 0x00000000654a0000 0x001d0000
+datemi.dll 0x0000000065470000 0x00020000
+dbacfgmi.dll 0x0000000065440000 0x00020000
+dbami.dll 0x00000000652e0000 0x00150000
+dbasemi.dll 0x0000000065280000 0x00050000
+dbaxmlmi.dll 0x0000000065230000 0x00040000
+dbmmmi.dll 0x0000000065200000 0x00020000
+dbpmi.dll 0x00000000651c0000 0x00030000
+dbpool2.dll 0x0000000065190000 0x00020000
+dbtoolsmi.dll 0x0000000064f60000 0x00220000
+dbumi.dll 0x0000000064ce0000 0x00270000
+deploymentguimi.uno.dll 0x0000000064c60000 0x00070000
+deploymentmi.uno.dll 0x0000000064be0000 0x00070000
+deploymentmiscmi.dll 0x0000000064bb0000 0x00020000
+dfami.dll 0x0000000064b40000 0x00010000
+dict_ja.dll 0x0000000064a20000 0x00110000
+dict_zh.dll 0x00000000647e0000 0x00230000
+directx5canvas.uno.dll 0x0000000064760000 0x00070000
+directx9canvas.uno.dll 0x00000000646e0000 0x00070000
+dlgprovmi.uno.dll 0x00000000646b0000 0x00020000
+dnd.dll 0x0000000064680000 0x00020000
+doctok.dll 0x00000000645c0000 0x000b0000
+dtrans.dll 0x00000000645a0000 0x00010000
+dynamicloader.uno.dll 0x0000000064570000 0x00020000
+egimi.dll 0x0000000064550000 0x00010000
+embobj.dll 0x00000000644d0000 0x00070000
+emboleobj.dll 0x0000000064480000 0x00040000
+ememi.dll 0x0000000064460000 0x00010000
+empmi.dll 0x0000000064410000 0x00040000
+emsermi.dll 0x00000000643d0000 0x00030000
+epbmi.dll 0x00000000643b0000 0x00010000
+epgmi.dll 0x0000000064390000 0x00010000
+eppmi.dll 0x0000000064370000 0x00010000
+epsmi.dll 0x0000000064340000 0x00020000
+eptmi.dll 0x0000000064320000 0x00010000
+erami.dll 0x0000000064300000 0x00010000
+etimi.dll 0x00000000642e0000 0x00010000
+evtatt.dll 0x00000000642c0000 0x00010000
+expmi.dll 0x0000000064280000 0x00010000
+fastsax.uno.dll 0x0000000064240000 0x00030000
+fileacc.dll 0x0000000064220000 0x00010000
+filemi.dll 0x0000000064140000 0x000d0000
+filterconfig1.dll 0x00000000640f0000 0x00040000
+filtertracermi.dll 0x00000000640d0000 0x00010000
+flashmi.dll 0x0000000064090000 0x00030000
+flatmi.dll 0x0000000064040000 0x00040000
+fop.dll 0x0000000064020000 0x00010000
+fpicker.uno.dll 0x0000000064000000 0x00010000
+fps.dll 0x0000000063fc0000 0x00030000
+fps_office.uno.dll 0x0000000063f70000 0x00040000
+frmmi.dll 0x0000000063dd0000 0x00190000
+fsstorage.uno.dll 0x0000000063da0000 0x00020000
+ftransl.dll 0x0000000063d80000 0x00010000
+fwemi.dll 0x0000000063c90000 0x000e0000
+fwimi.dll 0x0000000063c30000 0x00050000
+fwkmi.dll 0x0000000063a50000 0x001d0000
+fwlmi.dll 0x0000000063a20000 0x00020000
+fwmmi.dll 0x00000000639f0000 0x00020000
+gdipluscanvas.uno.dll 0x0000000063980000 0x00060000
+gomi.dll 0x00000000638b0000 0x00060000
+guesslangmi.dll 0x0000000063890000 0x00010000
+hatchwindowfactory.uno.dll 0x0000000063860000 0x00020000
+helplinkermi.dll 0x0000000063820000 0x00030000
+hsqldb2.dll 0x00000000637d0000 0x00040000
+hwp.dll 0x0000000063740000 0x00080000
+hyphenmi.dll 0x0000000063710000 0x00020000
+i18nisolang1msc.dll 0x00000000636f0000 0x00010000
+i18npool.uno.dll 0x00000000635b0000 0x00130000
+i18nregexpmsc.dll 0x0000000063590000 0x00010000
+i18nsearch.uno.dll 0x0000000063570000 0x00010000
+i18nutilmsc.dll 0x0000000063540000 0x00020000
+icdmi.dll 0x0000000063520000 0x00010000
+icgmi.dll 0x00000000634f0000 0x00020000
+icudt36l.dll 0x0000000062b00000 0x009c0000
+icuin36.dll 0x0000000062a20000 0x000d0000
+icule36.dll 0x00000000629d0000 0x00040000
+icutu36.dll 0x00000000629a0000 0x00020000
+icuuc36.dll 0x00000000628b0000 0x000e0000
+idxmi.dll 0x0000000062880000 0x00020000
+imemi.dll 0x0000000062860000 0x00010000
+index_data.dll 0x00000000627c0000 0x00090000
+instooofiltmsi.dll 0x0000000062790000 0x00020000
+introspection.uno.dll 0x0000000062760000 0x00020000
+invocadapt.uno.dll 0x0000000062740000 0x00010000
+invocation.uno.dll 0x0000000062720000 0x00010000
+ipbmi.dll 0x0000000062700000 0x00010000
+ipdmi.dll 0x00000000626e0000 0x00010000
+ipsmi.dll 0x00000000626c0000 0x00010000
+iptmi.dll 0x00000000626a0000 0x00010000
+ipxmi.dll 0x0000000062680000 0x00010000
+irami.dll 0x0000000062660000 0x00010000
+itgmi.dll 0x0000000062640000 0x00010000
+itimi.dll 0x0000000062620000 0x00010000
+java_uno.dll 0x00000000625f0000 0x00020000
+java_uno_accessbridge.dll 0x00000000625d0000 0x00010000
+javaloader.uno.dll 0x00000000625b0000 0x00010000
+javavm.uno.dll 0x0000000062580000 0x00020000
+jdbc2.dll 0x0000000062510000 0x00060000
+jfregca.dll 0x00000000624d0000 0x00030000
+jmi_g.dll 0x00000000624b0000 0x00010000
+jpipe.dll 0x0000000062490000 0x00010000
+juh.dll 0x00000000623b0000 0x00010000
+juhx.dll 0x0000000062380000 0x00020000
+jvmaccess3msc.dll 0x0000000062360000 0x00010000
+jvmfwk3.dll 0x0000000062330000 0x00020000
+ldapbe2.uno.dll 0x0000000062300000 0x00020000
+legacy_binfiltersmi.dll 0x00000000622d0000 0x00020000
+libcurl.dll 0x0000000062290000 0x00030000
+libdb47.dll 0x00000000621f0000 0x00090000
+libeay32.dll 0x00000000620d0000 0x00110000
+libexslt.dll 0x00000000620a0000 0x00020000
+librdf.dll 0x0000000062070000 0x00020000
+libtextcat.dll 0x0000000062050000 0x00010000
+libxml2.dll 0x0000000061f50000 0x000f0000
+libxmlsec-mscrypto.dll 0x0000000061f10000 0x00030000
+libxmlsec.dll 0x0000000061eb0000 0x00050000
+libxslt.dll 0x0000000061e70000 0x00030000
+lngpckinsthlp.dll 0x0000000061cc0000 0x00040000
+lnthmi.dll 0x0000000061c90000 0x00020000
+localebe1.uno.dll 0x0000000061c70000 0x00010000
+localedata_en.dll 0x0000000061c40000 0x00020000
+localedata_es.dll 0x0000000061c10000 0x00020000
+localedata_euro.dll 0x0000000061b60000 0x000a0000
+localedata_others.dll 0x0000000061aa0000 0x000b0000
+logmi.dll 0x0000000061a70000 0x00020000
+lpsolve55.dll 0x0000000061970000 0x00070000
+mcnttype.dll 0x0000000061950000 0x00010000
+mozab2.dll 0x0000000061900000 0x00020000
+mozabdrv2.dll 0x0000000061880000 0x00070000
+msci_uno.dll 0x0000000061860000 0x00010000
+mysql2.dll 0x0000000061820000 0x00030000
+namingservice.uno.dll 0x0000000061800000 0x00010000
+npsoplugin.dll 0x00000000617e0000 0x00010000
+npsoplugin_so.dll 0x00000000617c0000 0x00010000
+nullcanvas.uno.dll 0x0000000061770000 0x00040000
+odbc2.dll 0x0000000061750000 0x00010000
+odbcbase2.dll 0x0000000061690000 0x000b0000
+offaccmi.dll 0x0000000061670000 0x00010000
+officebean.dll 0x0000000061650000 0x00010000
+oleautobridge.uno.dll 0x00000000615f0000 0x00050000
+oleautobridge2.uno.dll 0x0000000061590000 0x00050000
+onlinecheck.dll 0x0000000061570000 0x00010000
+ooofilt.dll 0x0000000061530000 0x00030000
+ooofiltproxy.dll 0x0000000061500000 0x00020000
+oooimprovecoremi.dll 0x00000000614e0000 0x00010000
+ooxmi.dll 0x0000000061190000 0x00340000
+ooxml.dll 0x0000000060f20000 0x00260000
+package2.dll 0x0000000060ec0000 0x00050000
+passwordcontainer.uno.dll 0x0000000060e90000 0x00020000
+patchmsi.dll 0x0000000060e30000 0x00050000
+pcrmi.dll 0x0000000060d40000 0x000e0000
+pdffiltermi.dll 0x0000000060d00000 0x00030000
+pdfimport.uno.dll 0x0000000060bf0000 0x000a0000
+placewaremi.dll 0x0000000060bd0000 0x00010000
+plmi.dll 0x0000000060b90000 0x00030000
+pptimportermi.dll 0x0000000060b70000 0x00010000
+preloadmi.dll 0x0000000060b40000 0x00020000
+productregistration.uno.dll 0x0000000060b20000 0x00010000
+protocolhandlermi.dll 0x0000000060b00000 0x00010000
+proxyfac.uno.dll 0x0000000060ae0000 0x00010000
+purpenvhelper3msc.dll 0x0000000060ac0000 0x00010000
+python23.dll 0x00000000609b0000 0x00100000
+pythonloader.uno.dll 0x0000000060990000 0x00010000
+pyuno.dll 0x0000000060930000 0x00050000
+qslnkmsi.dll 0x00000000608e0000 0x00040000
+raptor.dll 0x0000000060880000 0x00050000
+rasqal.dll 0x0000000060840000 0x00030000
+reflection.uno.dll 0x0000000060810000 0x00020000
+reg3.dll 0x00000000607e0000 0x00020000
+reg4allmsdoc.dll 0x0000000060790000 0x00040000
+regactivex.dll 0x0000000060710000 0x00020000
+regpatchactivex.dll 0x0000000060690000 0x00020000
+relnotes.dll 0x0000000060660000 0x00020000
+remotebridge.uno.dll 0x0000000060640000 0x00010000
+resmi.dll 0x0000000060610000 0x00020000
+resourcemodel.dll 0x0000000060580000 0x00080000
+rmcxt3.dll 0x00000000604f0000 0x00010000
+rotmi.dll 0x00000000604d0000 0x00010000
+rptmi.dll 0x0000000060400000 0x000c0000
+rptuimi.dll 0x0000000060320000 0x000d0000
+rptxmlmi.dll 0x00000000602c0000 0x00050000
+sal3.dll 0x0000000060100000 0x001b0000
+salhelper3msc.dll 0x00000000600e0000 0x00010000
+sax.uno.dll 0x00000000600a0000 0x00030000
+saxmi.dll 0x0000000060080000 0x00010000
+sbmi.dll 0x000000005ff20000 0x00150000
+scdmi.dll 0x000000005ff00000 0x00010000
+scmi.dll 0x000000005f820000 0x006d0000
+scnmi.dll 0x000000005f800000 0x00010000
+scriptframe.dll 0x000000005f7c0000 0x00030000
+scuimi.dll 0x000000005f760000 0x00050000
+sdbc2.dll 0x000000005f730000 0x00020000
+sdbtmi.dll 0x000000005f700000 0x00020000
+sddmi.dll 0x000000005f6e0000 0x00010000
+sdmi.dll 0x000000005f2a0000 0x00430000
+sdqsmsi.dll 0x000000005f250000 0x00040000
+sduimi.dll 0x000000005f1d0000 0x00070000
+sfxmi.dll 0x000000005eed0000 0x002f0000
+shlxthdl.dll 0x000000005ee60000 0x00060000
+shlxtmsi.dll 0x000000005ee00000 0x00050000
+simplecanvas.uno.dll 0x000000005ede0000 0x00010000
+simplecmmi.dll 0x000000005edc0000 0x00010000
+slideshow.uno.dll 0x000000005ec60000 0x00150000
+slideshowtestmi.dll 0x000000005e8b0000 0x003a0000
+smdmi.dll 0x000000005e890000 0x00010000
+smmi.dll 0x000000005e7f0000 0x00090000
+smplmail.uno.dll 0x000000005e7d0000 0x00010000
+sn_tools.dll 0x000000005e7a0000 0x00020000
+so_activex.dll 0x000000005e770000 0x00020000
+socomp.dll 0x000000005e750000 0x00010000
+sofficeapp.dll 0x000000005e6e0000 0x00060000
+soldepmi.dll 0x000000005e6a0000 0x00030000
+solvermi.dll 0x000000005e680000 0x00010000
+sotmi.dll 0x000000005e620000 0x00050000
+spellmi.dll 0x000000005e5e0000 0x00030000
+splmi.dll 0x000000005e5a0000 0x00030000
+srtrs1.dll 0x000000005e570000 0x00020000
+ssleay32.dll 0x000000005e520000 0x00040000
+stlport_vc7145.dll 0x000000005e470000 0x000a0000
+stlport_vc71_stldebug45.dll 0x000000005e340000 0x00120000
+stocservices.uno.dll 0x000000005e310000 0x00020000
+store3.dll 0x000000005e2e0000 0x00020000
+streams.uno.dll 0x000000005e2b0000 0x00020000
+stringresourcemi.uno.dll 0x000000005e280000 0x00020000
+stsmi.dll 0x000000005e1f0000 0x00080000
+sunjavaplugin.dll 0x000000005e1c0000 0x00020000
+svgfiltermi.dll 0x000000005e190000 0x00020000
+svgmi.dll 0x000000005e160000 0x00020000
+svlmi.dll 0x000000005e090000 0x000c0000
+svtmi.dll 0x000000005ddc0000 0x002c0000
+svtmisc.uno.dll 0x000000005dd90000 0x00020000
+svxmi.dll 0x000000005d4c0000 0x008c0000
+swdmi.dll 0x000000005d490000 0x00020000
+swmi.dll 0x000000005cd00000 0x00780000
+swuimi.dll 0x000000005cbc0000 0x00130000
+sysdtrans.dll 0x000000005cb90000 0x00020000
+sysmgr1.uno.dll 0x000000005cb70000 0x00010000
+syssh.uno.dll 0x000000005cb50000 0x00010000
+t602filtermi.dll 0x000000005cb20000 0x00020000
+textconv_dict.dll 0x000000005c9e0000 0x00040000
+textconversiondlgsmi.dll 0x000000005c9b0000 0x00020000
+textinstream.uno.dll 0x000000005c990000 0x00010000
+textoutstream.uno.dll 0x000000005c970000 0x00010000
+tfumi.dll 0x000000005c950000 0x00010000
+tkmi.dll 0x000000005c7c0000 0x00180000
+tlmi.dll 0x000000005c730000 0x00080000
+tvhlp1.dll 0x000000005c6f0000 0x00030000
+ucb1.dll 0x000000005c6a0000 0x00040000
+ucbhelper4msc.dll 0x000000005c630000 0x00060000
+ucpchelp1.dll 0x000000005c5e0000 0x00040000
+ucpdav1.dll 0x000000005c570000 0x00060000
+ucpexpand1.uno.dll 0x000000005c550000 0x00010000
+ucpfile1.dll 0x000000005c500000 0x00040000
+ucpftp1.dll 0x000000005c4c0000 0x00030000
+ucphier1.dll 0x000000005c480000 0x00030000
+ucppkg1.dll 0x000000005c440000 0x00030000
+ucptdoc1.uno.dll 0x000000005c3f0000 0x00040000
+udlgmi.dll 0x000000005c3d0000 0x00010000
+unopkgapp.dll 0x000000005c3a0000 0x00020000
+unordfmi.dll 0x000000005c360000 0x00030000
+unowinreg.dll 0x000000005c340000 0x00010000
+unoxmlmi.dll 0x000000005c2e0000 0x00050000
+unsafe_uno_uno.dll 0x000000005c2c0000 0x00010000
+updatefeed.uno.dll 0x000000005c290000 0x00020000
+updchk.uno.dll 0x000000005c250000 0x00030000
+updchkmi.dll 0x000000005c230000 0x00010000
+urp_uno.dll 0x000000005c200000 0x00020000
+utlmi.dll 0x000000005c170000 0x00080000
+uuimi.dll 0x000000005c130000 0x00030000
+uuresolver.uno.dll 0x000000005c110000 0x00010000
+uwinapi.dll 0x000000005c0e0000 0x00020000
+vbaobjmi.uno.dll 0x000000005bfd0000 0x00100000
+vclcanvas.uno.dll 0x000000005bf50000 0x00070000
+vclmi.dll 0x000000005bc50000 0x002f0000
+vos3msc.dll 0x000000005bc20000 0x00020000
+wininetbe1.uno.dll 0x000000005bc00000 0x00010000
+writerfilter.uno.dll 0x000000005bb30000 0x00010000
+writerfiltermi.dll 0x000000005b760000 0x003c0000
+xcrmi.dll 0x000000005b6c0000 0x00090000
+xmergesync.dll 0x000000005b690000 0x00020000
+xmlfami.dll 0x000000005b670000 0x00010000
+xmlfdmi.dll 0x000000005b650000 0x00010000
+xmlsecurity.dll 0x000000005b600000 0x00040000
+xmxmi.dll 0x000000005b5e0000 0x00010000
+xofmi.dll 0x000000005b580000 0x00050000
+xomi.dll 0x000000005b2b0000 0x002c0000
+xsec_fw.dll 0x000000005b280000 0x00020000
+xsec_xmlsec.dll 0x000000005b250000 0x00020000
+xsltdlgmi.dll 0x000000005b200000 0x00040000
+xsltfiltermi.dll 0x000000005b1e0000 0x00010000
+xstor.dll 0x000000005b190000 0x00040000
+npsoplugin.dll 0x000000005b0b0000 0x00010000
+migrationoo2.uno.dll 0x000000005b080000 0x00020000
+inprocserv.dll 0x000000005b060000 0x00010000
+lngmi.dll 0x000000005af50000 0x00100000
diff --git a/postprocess/rebase/makefile.mk b/postprocess/rebase/makefile.mk new file mode 100755 index 000000000000..84c8ce80f9d3 --- /dev/null +++ b/postprocess/rebase/makefile.mk @@ -0,0 +1,63 @@ +#*********************************************************************** +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.10 $ +# +# 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. +# +#************************************************************************* + +PRJ=.. + + +PRJNAME=postprocess +TARGET=rebase + +.INCLUDE : settings.mk + +.INCLUDE : target.mk + +STARTADDRESS=0x68000000 +BASEADDRESSES=$(MISC)$/coffbase.txt +EXCLUDELIST=no_rebase.txt +LOGFILE=$(MISC)$/rebase_log.txt +IMAGENAMES=$(SOLARBINDIR)$/*.dll $(SOLARBINDIR)$/so$/*.dll + +ALLTAR : REBASE + +REBASE .PHONY : $(BASEADDRESSES) +.IF "$(GUI)"=="WNT" +.IF "$(product)"=="full" + $(PERL) rebase.pl -C $(BASEADDRESSES) -b $(STARTADDRESS) -d -e 10000 -l $(LOGFILE) -m $(MISC) -v -R $(SOLARBINDIR) -N $(EXCLUDELIST) $(IMAGENAMES) +.ELSE # "$(product)"=="full" + @echo Doing nothing on non product builds ... +.ENDIF # "$(product)"=="full" +.ELSE # "$(GUI)"=="WNT" + @echo Nothing to do, 'rebase' is windows only. +.ENDIF + +$(BASEADDRESSES) : coffbase.txt + $(COPY) coffbase.txt $@ + diff --git a/postprocess/rebase/no_rebase.txt b/postprocess/rebase/no_rebase.txt new file mode 100644 index 000000000000..7d40ba3e031d --- /dev/null +++ b/postprocess/rebase/no_rebase.txt @@ -0,0 +1,33 @@ +cli_basetypes.dll +cli_cppuhelper.dll +cli_uretypes.dll +cli_oootypes.dll +cli_ure.dll +policy.1.0.cli_uretypes.dll +policy.1.0.cli_oootypes.dll +policy.1.0.cli_ure.dll +policy.1.0.cli_cppuhelper.dll +policy.1.0.cli_basetypes.dll +unicows.dll +gdiplus.dll +mingwm10.dll +msvcm80d.dll +msvcm80.dll +msvcm90d.dll +msvcm90.dll +msvcp70d.dll +msvcp70.dll +msvcp71d.dll +msvcp71.dll +msvcp80d.dll +msvcp80.dll +msvcp90d.dll +msvcp90.dll +msvcr70d.dll +msvcr70.dll +msvcr71d.dll +msvcr71.dll +msvcr80d.dll +msvcr80.dll +msvcr90d.dll +msvcr90.dll diff --git a/postprocess/rebase/rebase.pl b/postprocess/rebase/rebase.pl new file mode 100755 index 000000000000..8afe774a8f5e --- /dev/null +++ b/postprocess/rebase/rebase.pl @@ -0,0 +1,310 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: rebase.pl,v $ +# +# $Revision: 1.5 $ +# +# 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. +# +#************************************************************************* + +# +# rebase.pl - rebase windows dlls +# +# This perl script is to rebase all windows dlls. In principle this could +# be done with one simple command line like f.e. +# rebase -b 0x68000000 -d -R foo_dir -N bar.txt $(SOLARBINDIR)$/*.dll +# That would work fine for creating complete office install sets, but it +# could fail as soon as we are going to ship single dlls for a product +# patch. Therefore, this wrapper perl script is used. It reads a given base +# address file and rebases all files mentioned to the same address as +# previously. New dlls get appended to the list. + +use strict; + +#### globals ##### + +my $myname = ''; +my $options_string = ''; # order of options is important +my %options_hash; +my $rebase_files; +my $misc_dir = $ENV{TEMP}; +my $lastaddress; +my @old_files; +my @new_files; + +#### main ##### + +$myname = script_id(); +parse_options(); +my %lastrun = read_coffbase( \$lastaddress ); +# Get files specified on command line. Differ between those already +# listed in coffbase (%options_hash{'C'}) and additional ones. +get_files( \@old_files, \@new_files ); +# Rebase libraries already listed in coffbase to the addresses given there. +rebase_again( \@old_files, \@new_files ) if ( @old_files ); +# Rebase additional files. +rebase_initially( \@new_files, $lastaddress ) if ( @new_files ); + +exit 0; + + +#### subroutines #### + +sub script_id +{ + ( my $script_name = $0 ) =~ s/^.*[\\\/]([\w\.]+)$/$1/; + + my $script_rev; + my $id_str = ' $Revision$ '; + $id_str =~ /Revision:\s+(\S+)\s+\$/ + ? ($script_rev = $1) : ($script_rev = "-"); +# print "\n$script_name -- version: $script_rev\n"; + return $script_name; +} + + +sub parse_options +{ + use Getopt::Std; + if ( !getopts('C:b:de:l:m:R:N:v', \%options_hash) || ($#ARGV < 0) ) { + print STDERR "Error: invalid command line.\n\n"; + usage (); + exit 1; + } + # create options string (we cannot rely on a hash because for some options the + # order is important. -R option has to be specified before -N!) + foreach my $var ( 'C', 'b', 'e', 'l', 'R', 'N' ) { + if ($options_hash{$var} ) { + $options_string .= "-$var $options_hash{$var} "; + } + } + $options_string .= "-d " if $options_hash{"d"}; + $options_string .= "-v " if $options_hash{"v"}; + # some basic tests + if ( ! $options_hash{'C'}) { + print STDERR "Error: no coffbase specified\n\n"; + usage (); + exit 2; + } + if ( ! $options_hash{'b'}) { + print STDERR "Error: no initial base address specified\n\n"; + usage (); + exit 2; + } + if ($options_hash{"m"}) { + $misc_dir = $options_hash{"m"}; + } + if ( ! -d $misc_dir ) { + print STDERR "Error: no directory to write work files. Please specify with -m\n"; + usage (); + exit 3; + } + if ( $misc_dir !~ /[\/\\]$/ ) { + # append finishing path separator: + if ( $misc_dir =~ /([\/\\])/ ) { + $misc_dir .= $1; + } + } + $rebase_files = join " ", @ARGV; + # Cygwin's perl in a W32-4nt configuration wants / instead of \ . + $rebase_files =~ s/\\/\//g; + return; +} + + +sub read_coffbase +{ + my ($addref) = shift; + my %baseaddresses; + my @entry; + if ( $options_hash{'C'} ) { + my $filename = $options_hash{'C'}; + if ( -e $filename ) { + print "Repeated run, $filename present\n"; + open( COFFBASE, $filename) or die "Error: cannot open $filename"; + while ( my $line = <COFFBASE> ) { + # each row consists of three entries, separated by white space: + # dll-name base-address size + @entry = split /\s+/ , $line ; + if ( $entry[3] || ( ! $entry[2] ) ) { + print STDERR "Warning: coffbase file structure invalid?\n"; + } + $baseaddresses{$entry[0]} = $entry[1]; + if ( $entry[3] ) { + print STDERR "Warning: coffbase file structure invalid?\n"; + } + } + close( COFFBASE ); + $$addref = $entry[1]; + } else { + print "Initial run, $filename not yet present\n"; + } + } else { + die "Error: no coffbase specified."; + } + return %baseaddresses; +} + + +sub get_files +{ + use File::Basename; + my ( $oldfiles_ref, $newfiles_ref ) = @_; + my @target = split / /, $rebase_files; + foreach my $pattern ( @target ) { + foreach my $i ( glob( $pattern ) ) { + my $lib = File::Basename::basename $i; + $lib =~ s/\+/\\\+/g; + if ( grep /^$lib$/i, (keys %lastrun) ) { + push @$oldfiles_ref, $i; + } else { + push @$newfiles_ref, $i; + } + } + } + return; +} + + +sub rebase_again +# rebase using given coffbase file +{ + my $oldfiles_ref = shift; + my $newfiles_ref = shift; + my @grownfiles; + my $solarbin ="$ENV{SOLARVERSION}/$ENV{INPATH}/bin$ENV{UPDMINOREXT}"; + my $command = "rebase " . $options_string; + if ( $ENV{WRAPCMD} ) { + $command = $ENV{WRAPCMD} . " " . $command; + } + $command =~ s/-C /-i /; + $command =~ s/-d//; + $command =~ s/-b $options_hash{'b'}//; + my $fname = $misc_dir . "rebase_again.txt"; + open ( FILES, "> $fname") or die "Error: cannot open file $fname"; + my $filesstring = join " ", @$oldfiles_ref; + # For W32-4nt-cygwin-perl: rebase_again.txt needs \. + if ( "$ENV{USE_SHELL}" eq "4nt" ) { $filesstring =~ s/\//\\/g; } + print FILES "$filesstring\n"; + close FILES; + $command .= "\@$fname"; + # Cygwin's perl needs escaped \ in system() and open( COMMAND ... ) + if ( "$^O" eq "cygwin" ) { $command =~ s/\\/\\\\/g; } + print "\n$command\n"; + open( COMMAND, "$command 2>&1 |") or die "Error: Can't execute $command\n"; + if ( $? ) { + die "Error: rebase failed: $?!\n"; + } + while( <COMMAND> ) { + print; + # evaluate error messages + if ( /REBASE: ([^\s]+).*Grew too large/ ) { + my $toobig_name = $1; + if ( -e "$solarbin/so/$toobig_name" ) { + push @grownfiles, "$solarbin/so/$toobig_name"; + print "name was : $toobig_name\n"; + print "push $solarbin/so/$toobig_name\n"; + } else { + push @grownfiles, "$solarbin/$toobig_name"; + } + } + } + close( COMMAND ); + if ( @grownfiles ) { + # Some files are larger than expected and therefore could not be rebased. + # Remove respective entries from coffbase and schedule rebase in 'rebase_initially'. + push @$newfiles_ref, @grownfiles; + my $coffbase = $options_hash{'C'}; + my $coffbase_new = $options_hash{'C'} . ".new"; + open( COFFBASENEW, "> $coffbase_new") or die "Error: cannot open $coffbase_new"; + open( COFFBASE, $coffbase) or die "Error: cannot open $coffbase"; + my @entry; + while ( my $line = <COFFBASE> ) { + @entry = split /\s+/ , $line ; + if ( $entry[3] ) { + print STDERR "Warning: coffbase file structure invalid?\n"; + } + grep /^$entry[0]$/, @grownfiles or print COFFBASENEW $line; + } + close( COFFBASE ); + close( COFFBASENEW ); + rename $coffbase, $coffbase . ".old" or warn "Error: cannot rename $coffbase"; + rename $coffbase_new, $coffbase or warn "Error: cannot rename $coffbase_new"; + } +} + + +sub rebase_initially +{ + my ($files_ref, $start_address) = @_; + my $command = "rebase "; + if ( $ENV{WRAPCMD} ) { + $command = $ENV{WRAPCMD} . " " . $command; + } + $command .= $options_string; + if ( $start_address ) { + $command =~ s/-b $options_hash{'b'}/ -b $start_address/; + } + my $fname = $misc_dir . "rebase_new.txt"; + open ( FILES, "> $fname") or die "Error: cannot open file $fname"; + my $filesstring = join " ", @$files_ref; + # For W32-4nt-cygwin-perl: rebase_new.txt needs \. + if ( "$ENV{USE_SHELL}" eq "4nt" ) { $filesstring =~ s/\//\\/g; } + print FILES "$filesstring\n"; + close FILES; + $command .= "\@$fname"; + # Cygwin's perl needs escaped \ in system() and open( COMMAND ... ) + if ( "$^O" eq "cygwin" ) { $command =~ s/\\/\\\\/g; } + print "\n$command\n"; + my $error = system("$command"); + if ($error) { + $error /= 256; + die "Error: rebase failed with exit code $error!\n"; + } +} + + +sub usage +{ + print "Usage:\t $myname <-C filename> <-b address> [-d] [-e <Size>] [-l <filename>] [-v] [-m dir] [-R <roordir>] [-N <filename>] <file[list]> \n"; + # Options similar to rebase binary. Additional options: -m misc-directory + print "Options:\n"; + print "\t -C coffbase_filename Write the list of base adresses to file coffbase_filename. "; + print "Mandatory.\n"; + print "\t -b address Initial base address. Mandatory.\n"; + print "\t -e SizeAdjustment Extra size to allow for image growth.\n"; + print "\t -d Top down rebase.\n"; + print "\t -l filename Write logfile filename.\n"; + print "\t -m directory Directory to write work files.\n"; + print "\t -R directory Root directory.\n"; + print "\t -N filename Specify list of files not to be rebased.\n"; + print "\t -v Verbose.\n"; + return; +} + + diff --git a/postprocess/signing/makefile.mk b/postprocess/signing/makefile.mk new file mode 100644 index 000000000000..503b46d572ef --- /dev/null +++ b/postprocess/signing/makefile.mk @@ -0,0 +1,64 @@ +#*********************************************************************** +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: makefile.mk,v $ +# +# $Revision: 1.3 $ +# +# 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. +# +#************************************************************************* + +PRJ=.. + + +PRJNAME=postprocess +TARGET=signing + +.INCLUDE : settings.mk + +# PFXFILE has to be set elsewhere +# PFXPASSWORD has to be set elsewhere + +EXCLUDELIST=no_signing.txt +LOGFILE=$(MISC)$/signing_log.txt +IMAGENAMES=$(SOLARBINDIR)$/*.dll $(SOLARBINDIR)$/so$/*.dll $(SOLARBINDIR)$/*.exe $(SOLARBINDIR)$/so$/*.exe +TIMESTAMPURL*="http://timestamp.verisign.com/scripts/timstamp.dll" + +signing.done : +.IF "$(VISTA_SIGNING)"!="" +.IF "$(COM)"=="MSC" +.IF "$(product)"=="full" + $(PERL) signing.pl -e $(EXCLUDELIST) -f $(PFXFILE) -p $(PFXPASSWORD) -t $(TIMESTAMPURL) $(IMAGENAMES) && $(TOUCH) $(MISC)$/signing.done +.ELSE # "$(product)"=="full" + @echo Doing nothing on non product builds ... +.ENDIF # "$(product)"=="full" +.ELSE # "$(GUI)"=="MSC" + @echo Nothing to do, signing is Windows \(MSC\) only. +.ENDIF # "$(GUI)"=="MSC" +.ELSE # "$(VISTA_SIGNING)"!="" + @echo Doing nothing. To switch on signing set VISTA_SIGNING=TRUE ... +.ENDIF # "$(VISTA_SIGNING)"!="" + +.INCLUDE : target.mk + diff --git a/postprocess/signing/no_signing.txt b/postprocess/signing/no_signing.txt new file mode 100644 index 000000000000..7c663ccfc773 --- /dev/null +++ b/postprocess/signing/no_signing.txt @@ -0,0 +1,13 @@ +cli_basetypes.dll +cli_cppuhelper.dll +cli_uretypes.dll +cli_oootypes.dll +cli_ure.dll +policy.1.0.cli_uretypes.dll +policy.1.0.cli_oootypes.dll +policy.1.0.cli_ure.dll +policy.1.0.cli_cppuhelper.dll +policy.1.0.cli_basetypes.dll +unicows.dll +gdiplus.dll +mingwm10.dll diff --git a/postprocess/signing/signing.pl b/postprocess/signing/signing.pl new file mode 100644 index 000000000000..a2703f80d225 --- /dev/null +++ b/postprocess/signing/signing.pl @@ -0,0 +1,277 @@ +: +eval 'exec perl -wS $0 ${1+"$@"}' + if 0; +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2008 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# $RCSfile: signing.pl,v $ +# +# $Revision: 1.3 $ +# +# 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 strict; +use Getopt::Long; + +my $debug = 0; +my $max_files = 20; # sign $max_files with one command line + +#### globals ##### +my $myname = ""; +my $opt_dir = ""; +my $opt_exclude = ""; # file with a list of not signable dll and exe files +my $opt_verbose = 0; +my $opt_help = 0; +my $opt_log = ""; # for logging +my $opt_pass = ""; # password for signing +my $opt_pfxfile = ""; # Personal Information Exchange file +my $opt_timestamp_url = ""; # timestamp url +my %exclude_files = (); # list of not signable dll and exe files +my $signtool = "signtool.exe sign"; +my @args = (); +my @files_to_sign = (); + +#### main ##### +$myname = script_id(); +if ( $#ARGV < 2 ) { + usage(); + exit(1); +} +@args = parse_options(); +get_exclude_files(); +@files_to_sign = get_files(\@args); +if ( $opt_log ) { # logging + open(LOG,">$opt_log") || die "Can't open log file $opt_log\n"; +} +sign_files(\@files_to_sign); +close LOG if ($opt_log); # logging +exit 0; + + +#### subroutines #### + +sub script_id +{ + ( my $script_name = $0 ) =~ s/^.*[\\\/]([\w\.]+)$/$1/; + + my $script_rev; + my $id_str = ' $Revision$ '; + $id_str =~ /Revision:\s+(\S+)\s+\$/ + ? ($script_rev = $1) : ($script_rev = "-"); +# print "\n$script_name -- version: $script_rev\n"; + return $script_name; +} + +############################################################################ +sub parse_options #09.07.2007 08:13 +############################################################################ +{ + # e exclude list file + # v verbose + my $success = GetOptions('h' => \$opt_help, + 'd=s' => \$opt_dir, 'e=s'=>\$opt_exclude, 'f=s'=>\$opt_pfxfile, 'l=s'=>\$opt_log, + 'p=s'=>\$opt_pass,'v'=>\$opt_verbose, 't=s'=>\$opt_timestamp_url); + if ( !$success || $opt_help ) { + usage(); + exit(1); + } + if ( !$opt_exclude || !$opt_pfxfile || !$opt_pass || !$opt_timestamp_url) { + print "ERROR: Parameter missing!\n!"; + usage(); + exit(1); + } + return @ARGV; +} ##parse_options + +############################################################################ +sub get_exclude_files #09.07.2007 10:12 +############################################################################ +{ + if ( -e $opt_exclude ) { + # get data from cache file + open( IN, "<$opt_exclude") || die "Can't open exclude file $opt_exclude\n"; + while ( my $line = <IN> ) { + chomp($line); + $exclude_files{$line} = 1; # fill hash + print "$line - $exclude_files{$line}\n" if ($debug); + } + } else + { + print_error("Can't open $opt_exclude file!\n"); + } +} ##get_exclude_files + +############################################################################ +sub get_files #10.07.2007 10:19 +############################################################################ + { + use File::Basename; + my $target = shift; + my $file_pattern; + my $file; + my @files = (); + print "\n"; + foreach $file_pattern ( @$target ) + { + print "Files: $file_pattern\n"; + foreach $file ( glob( $file_pattern ) ) + { + my $lib = File::Basename::basename $file; + if ( ! $exclude_files{$lib} ) { + push @files,$file; + } + else + { + print "exclude=$lib\n" if ($opt_verbose); + } + } + } + print "\n"; + return @files; +} ##get_files + +############################################################################ +sub sign_files #09.07.2007 10:36 +############################################################################ +{ + my $files_to_sign = shift; + my $commandline_base = ""; # contains whole stuff without the file name + my $file = ""; + my $result = ""; + + print_error("Can't open PFX file: $opt_pfxfile\n") if ( ! -e $opt_pfxfile ); + print_error("Password is empty\n") if ( !$opt_pass ); + if ( $opt_pass =~ /\.exe$/ ) { + # get password by tool + open(PIPE, "$opt_pass 2>&1 |") || die "Can't open PIPE!\n"; + my $pass = <PIPE>; + close PIPE; + print_error("Can't get password!\n") if ( !$pass ); # exit here + $opt_pass = $pass; + } + $signtool .= " -v" if ($opt_verbose); + $commandline_base = $signtool . " " . "-f $opt_pfxfile -p $opt_pass -t $opt_timestamp_url"; + + # Here switch between: + # one command line for muliple files (all doesn't work, too much) / for each file one command line + if ( $max_files > 1 ) { + exec_multi_sign($files_to_sign, $commandline_base); + } else + { + exec_single_sign($files_to_sign, $commandline_base); + } +} ##sign_files + +############################################################################ +sub exec_single_sign #11.07.2007 09:05 +############################################################################ +{ + my $files_to_sign = shift; + my $commandline_base = shift; # contains whole stuff without the file name + my $file = ""; + my $commandline = ""; + + foreach $file (@$files_to_sign) + { + $commandline = $commandline_base . " $file"; + print "$commandline\n" if ($debug); + execute($commandline); + } #foreach +} ##exec_single_sign + +############################################################################ +sub exec_multi_sign #11.07.2007 08:56 +############################################################################ + { + # sign multiple file with one command line + my $files_to_sign = shift; + my $commandline_base = shift; # contains whole stuff without the file name + my $commandline = $commandline_base; # contains stuff which will be executed + my $file = ""; + my $counter = 0; + + foreach $file (@$files_to_sign) + { + $commandline .= " $file"; + ++$counter; + if ( $counter >= $max_files ) { + execute($commandline); + $counter = 0; # reset counter + $commandline = $commandline_base; # reset command line + } + } + execute($commandline) if ($counter > 0); +} ##exec_multi_sign + +############################################################################ +sub execute #11.07.2007 10:02 +############################################################################ +{ + my $commandline = shift; + my $result = ""; + + print "$commandline\n" if ($debug); + open(PIPE, "$commandline 2>&1 |") || die "Error: Cant open pipe!\n"; + while ( $result = <PIPE> ) { + print LOG "$result" if ($opt_log); # logging + if ( $result =~ /SignTool Error\:/ ) { + close PIPE; + print_error( "$result\n" ); + } # if error + } # while + close PIPE; +} ##execute + +############################################################################ +sub print_error #09.07.2007 11:21 +############################################################################ + { + my $text = shift; + print "ERROR: $text\n"; + print LOG "ERROR: $text\n" if ($opt_log); # logging + close LOG if ($opt_log); # logging + exit(1); +} ##print_error + +############################################################################ +sub usage #09.07.2007 08:39 +############################################################################ + { + print "Usage:\t $myname <-e filename> <-f filename> <-p password> <-t timestamp> [-l filename] [-v] <file[list]> \n"; + print "Options:\n"; + print "\t -e filename\t\t\tFile which contains a list of files which don't have to be signed.\n"; + print "Mandatory.\n"; + print "\t -f pfx_filename\t\t\"Personal Information Exchange\" file. "; + print "Mandatory.\n"; + print "\t -p password\t\t\tPassword for \"Personal Information Exchange\" file. Mandatory.\n"; + print "\t -t timestamp\t\t\tTimestamp URL e.g. \"http://timestamp.verisign.com/scripts/timstamp.dll\"\n"; + print "\t\t\t\t\tMandatory.\n"; + print "\t -l log_filename\t\tFile for logging.\n"; + print "\t -v\t\t\t\tVerbose.\n"; +} ##usage + + + + |