diff options
Diffstat (limited to 'solenv/bin')
-rw-r--r-- | solenv/bin/build.pl | 18 | ||||
-rw-r--r-- | solenv/bin/buildalyzer | 138 | ||||
-rwxr-xr-x | solenv/bin/deliver.pl | 18 | ||||
-rwxr-xr-x | solenv/bin/macosx-create-bundle | 2 | ||||
-rw-r--r-- | solenv/bin/modules/CreatePDBRelocators.pm | 61 | ||||
-rwxr-xr-x | solenv/bin/modules/SourceConfig.pm | 4 | ||||
-rw-r--r-- | solenv/bin/modules/installer/control.pm | 32 | ||||
-rw-r--r-- | solenv/bin/modules/installer/environment.pm | 1 | ||||
-rw-r--r-- | solenv/bin/modules/installer/globals.pm | 1 | ||||
-rwxr-xr-x | solenv/bin/packmodule | 58 |
10 files changed, 294 insertions, 39 deletions
diff --git a/solenv/bin/build.pl b/solenv/bin/build.pl index 3b325b62ad98..ed9dcc3721e6 100644 --- a/solenv/bin/build.pl +++ b/solenv/bin/build.pl @@ -230,6 +230,7 @@ }; my $workspace_path = get_workspace_path(); # This also sets $initial_module my $source_config = SourceConfig -> new($workspace_path); + check_partial_gnumake_build($initial_module); if ($html) { if (defined $html_path) { @@ -3527,3 +3528,20 @@ sub fill_modules_queue { mp_success_exit(); }; }; + +sub is_gnumake_module { + my $module = shift; + my $bridgemakefile = $source_config->get_module_path($module) . "/prj/makefile.mk"; + return (-e $bridgemakefile); +} + +sub check_partial_gnumake_build { + if(!$build_all_parents && is_gnumake_module(shift)) { + print "This module has been migrated to GNU make.\n"; + print "You can only use build --all/--since here with build.pl.\n"; + print "To do the equivalent of 'build && deliver' call:\n"; + print "\tmake -sr\n"; + print "in the module root (This will modify the solver).\n"; + exit 1; + } +} diff --git a/solenv/bin/buildalyzer b/solenv/bin/buildalyzer new file mode 100644 index 000000000000..8b278e66b8e6 --- /dev/null +++ b/solenv/bin/buildalyzer @@ -0,0 +1,138 @@ +#!/usr/bin/env python +import sys +import os + +class CxxTarget: + def __init__(self, line): + self.directory = '' + self.outputfile = '' + self.includeflags = [] + self.cxxflags = [] + self.inputfiles = [] + self.nolink = False + options = line[:-1].split(' ') + self.directory = options.pop(0) + parsing_outputfile = False + for option in options: + if parsing_outputfile: + self.outputfile = option + parsing_outputfile = False + elif option == '-o': + parsing_outputfile = True + elif option == '-c': + self.nolink = True + elif option.startswith('-I'): + self.includeflags.append(CxxFlag(option)) + elif option.startswith('-'): + self.cxxflags.append(CxxFlag(option)) + else: + self.inputfiles.append(option) + self.cxxflags.sort() + self.includeflags.sort() + cxxflags_tmp = dict() + for flag in self.cxxflags: + cxxflags_tmp[flag.name] = flag + self.cxxflags = cxxflags_tmp.values() + includeflags_tmp = dict() + for flag in self.includeflags: + includeflags_tmp[flag.name] = flag + self.includeflags = includeflags_tmp.values() + CxxTargets.by_name[self.getFullOutputname()] = self + def __str__(self): + return '%s' % (self.getFullOutputname()) + def getFullOutputname(self): + return self.directory + '/' + self.outputfile + def __cmp__(self, other): + return cmp(self.getFullOutputname(), other.getFullOutputname()) + +class CxxFlag: + def __init__(self, name): + self.name = name + CxxFlags.by_name[self.name] = self + def __str__(self): + return 'Flag %s' % (self.name) + def __cmp__(self, other): + return cmp(self.name, other.name) + +class CxxFlags: + by_name = dict() + +class CxxTargets: + by_name = dict() + +if __name__ == '__main__': + [CxxTarget(line) for line in sys.stdin.readlines()] + compile_targets = [target for target in CxxTargets.by_name.values() if target.nolink] + link_targets = [target for target in CxxTargets.by_name.values() if not target.nolink] + common_compile_flags = [] + for flag in CxxFlags.by_name.values(): + if sum((flag in target.cxxflags for target in compile_targets)) == len(compile_targets): + common_compile_flags.append(flag) + common_link_flags = [] + for flag in CxxFlags.by_name.values(): + if sum((flag in target.cxxflags for target in compile_targets)) == len(compile_targets): + common_link_flags.append(flag) + + for target in compile_targets: + target.cxxflags = [flag for flag in target.cxxflags if flag not in common_compile_flags] + target.cxxflags.sort() + for target in link_targets: + target.cxxflags = [flag for flag in target.cxxflags if flag not in common_link_flags] + target.cxxflags.sort() + + common_compile_flags.sort() + common_link_flags.sort() + print 'common compile flags: %s' % (' '.join(flag.name for flag in common_compile_flags)) + print 'common link flags: %s' % (' '.join(flag.name for flag in common_link_flags)) + + by_flagset = dict() + for target in CxxTargets.by_name.values(): + flagset = ' '.join((flag.name for flag in target.cxxflags)) + if flagset not in by_flagset: + by_flagset[flagset] = list() + by_flagset[flagset].append(target) + for targetlist in by_flagset.values(): + targetlist.sort() + flagsets = by_flagset.keys() + flagsets.sort() + print '%d compilerflag groups:' % (len(flagsets)) + for flagset in flagsets: + print flagset + for target in by_flagset[flagset]: + print '%s' % (target) + print + + by_flagset = dict() + for target in CxxTargets.by_name.values(): + flagset = ' '.join((flag.name for flag in target.includeflags)) + if flagset not in by_flagset: + by_flagset[flagset] = list() + by_flagset[flagset].append(target) + for targetlist in by_flagset.values(): + targetlist.sort() + flagsets = by_flagset.keys() + flagsets.sort() + print '%d include flag groups:' % (len(flagsets)) + for flagset in flagsets: + print flagset + for target in by_flagset[flagset]: + print '%s' % (target) + print + + print 'sources:' + by_name = dict() + for target in CxxTargets.by_name.values(): + by_name[os.path.basename(target.outputfile)] = target + names = by_name.keys() + names.sort() + for target in CxxTargets.by_name.values(): + if len(target.inputfiles) > 1: + objects = [os.path.basename(object) for object in target.inputfiles] + sources = list() + for object in objects: + if object in by_name: + sources.append(by_name[object].inputfiles[0]) + else: + sources.append('!!!!' + object) + sources.sort() + print '%s %s' % (target.getFullOutputname(), ' '.join(sources)) diff --git a/solenv/bin/deliver.pl b/solenv/bin/deliver.pl index 5c604d27b309..b87665c6b011 100755 --- a/solenv/bin/deliver.pl +++ b/solenv/bin/deliver.pl @@ -789,11 +789,6 @@ sub copy_if_newer if ( $opt_delete ) { print "REMOVE: $to\n" if $opt_verbose; $rc = unlink($to) unless $opt_check; - # handle special packaging of *.dylib files for Mac OS X - if ( $to =~ s/\.dylib$/.jnilib/ ) { - print "REMOVE: $to\n" if $opt_verbose; - $rc += unlink "$to" unless $opt_check; - } return 1 if $opt_check; return $rc; } @@ -858,19 +853,6 @@ sub copy_if_newer # handle special packaging of *.dylib files for Mac OS X if ( $^O eq 'darwin' ) { - if ( $to =~ /\.dylib/ ) { - system("macosx-create-bundle", $to); - my $bundlelib = $to; - $bundlelib =~ s/\.dylib$//; - $bundlelib .= ".jnilib"; - if ( $opt_delete ) { - print "REMOVE: $bundlelib\n" if $opt_verbose; - unlink "$bundlelib" unless $opt_check; - } else { - push_on_ziplist($bundlelib) if $opt_zip; - push_on_loglist("LINK", basename($to), "$bundlelib") if $opt_log; - } - } system("macosx-create-bundle", "$to=$from.app") if ( -d "$from.app" ); system("ranlib", "$to" ) if ( $to =~ /\.a/ ); } diff --git a/solenv/bin/macosx-create-bundle b/solenv/bin/macosx-create-bundle index ba7d624e68f3..4b03e076f3ae 100755 --- a/solenv/bin/macosx-create-bundle +++ b/solenv/bin/macosx-create-bundle @@ -96,7 +96,7 @@ while [ $# != 0 ]; do # Link jnilib ln -sf "$inputfilename" "$outputdir/$inputjnilibname" - printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n" + #printf "macosx-create-bundle: $outputdir/$inputjnilibname successfully created\n" fi else printf "macosx-create-bundle: error: file is not an executable or shared library.\n" >&2 diff --git a/solenv/bin/modules/CreatePDBRelocators.pm b/solenv/bin/modules/CreatePDBRelocators.pm index c31e3a053b0c..753075a2bfea 100644 --- a/solenv/bin/modules/CreatePDBRelocators.pm +++ b/solenv/bin/modules/CreatePDBRelocators.pm @@ -45,8 +45,11 @@ sub new { my $Object = shift; my $solarversion = shift; + my $workdir; + my $relworkdir; my $self = {}; - my @repositories; + my @basedirs; + my @repos; if (!defined ($solarversion)) { $solarversion = $ENV{SOLARVERSION}; @@ -58,14 +61,33 @@ sub new $self->{SOLARVERSION} = $solarversion; - my $SourceConfigObj = SourceConfig->new(); - @repositories = $SourceConfigObj->get_repositories(); + $workdir = $ENV{WORKDIR}; + if ( !$workdir ) { + print STDERR "can't determine WORKDIR.\n"; + exit (1); + } - if (!scalar @repositories) { - print STDERR "no repository and no working directory found.\n"; + if ( $workdir =~ /^$solarversion/ ) { + $relworkdir = $workdir; + $relworkdir =~ s/^$solarversion\///; + } else { + print STDERR "ERROR: workdir outside $solarversion unsupported\n"; + exit (2); + } + my $SourceConfigObj = SourceConfig->new(); + @repos = $SourceConfigObj->get_repositories(); + if ( defined $ENV{UPDMINOREXT} ) { + foreach my $onedir ( @repos ) { + push( @basedirs, $onedir.$ENV{UPDMINOREXT} ); + } + } + # basdirs is repositories (dmake) + workdir (gnu make) + push(@basedirs, $relworkdir); + if (!scalar @basedirs) { + print STDERR "no basedir and no working directory found.\n"; exit (2); } - $self->{REPOSITORIES} = \@repositories; + $self->{BASEDIRS} = \@basedirs; bless($self, $Object); return $self; } @@ -106,10 +128,10 @@ sub create_pdb_relocators } # collect files - foreach my $repository (@{$self->{REPOSITORIES}}) { + foreach my $basedir (@{$self->{BASEDIRS}}) { my @pdb_files; - my $o = $self->{SOLARVERSION} . "/$repository"; - $repository =~ s/(.*?)\.(.*)/$1/; + my $o = $self->{SOLARVERSION} . "/$basedir"; + $basedir =~ s/(.*?)\.(.*)/$1/; $self->collect_files( $o, $inpath, \@pdb_files); foreach (@pdb_files) { @@ -122,12 +144,12 @@ sub create_pdb_relocators my $target = ""; if ( $src_location =~ /\/so\// ) { - $location = "../../../$repository$milestoneext/" . $src_location; + $location = "../../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/so/$relocator"; } else { - $location = "../../$repository$milestoneext/" . $src_location; + $location = "../../$basedir$milestoneext/" . $src_location; $target = "$pdb_dir/$relocator"; } @@ -142,14 +164,14 @@ sub create_pdb_relocators return 1; } -sub collect_files_from_all_repositories +sub collect_files_from_all_basedirs { my $self = shift; my ($platform, $filesref) = @_; - my $repository; + my $basedir; my $ret; - foreach $repository (@{$self->{REPOSITORIES}}) { - my $srcdir = $self->{SOLARVERSION} . "/$repository"; + foreach $basedir (@{$self->{BASEDIRS}}) { + my $srcdir = $self->{SOLARVERSION} . "/$basedir"; $ret |= $self->collect_files ($srcdir, $platform, $filesref); } return $ret; @@ -160,14 +182,16 @@ sub collect_files my $self = shift; my ($srcdir, $platform, $filesref) = @_; my $template = "$srcdir/*/$platform"; + my $template2 = "$srcdir/LinkTarget"; if ( $ENV{GUI} eq "WNT" ) { # collect all pdb files on o: # regular glob does not work with two wildcard on WNT my @bin = glob("$template/bin/*.pdb"); my @bin_so = glob("$template/bin/so/*.pdb"); + my @workdir = glob("$template2/*/*.pdb"); # we are only interested in pdb files which are accompanied by # .exe or .dll which the same name - foreach (@bin, @bin_so) { + foreach (@bin, @bin_so, @workdir) { my $dir = dirname($_); my $base = basename($_, ".pdb"); my $exe = "$dir/$base.exe"; @@ -180,13 +204,16 @@ sub collect_files else { # collect all shared libraries on o: my @lib = glob("$template/lib/*.so*"); + my @workdir_lib = glob("$template2/Library/*.so*"); my @lib_so = glob("$template/lib/so/*.so*"); my @mac_lib = glob("$template/lib/*.dylib*"); + my @mac_workdir_lib = glob("$template2/Library/*.dylib*"); my @mac_lib_so = glob("$template/lib/so/*.dylib*"); # collect all binary executables on o: my @bin = $self->find_binary_execs("$template/bin"); + my @workdir_bin = $self->find_binary_execs("$template2/Executable"); my @bin_so = $self->find_binary_execs("$template/bin/so"); - push(@$filesref, (@lib, @lib_so, @mac_lib, @mac_lib_so, @bin, @bin_so)); + push(@$filesref, (@lib, @lib_so, @workdir_lib, @mac_lib, @mac_workdir_lib, @mac_lib_so, @bin, @workdir_bin, @bin_so)); } return 1; } diff --git a/solenv/bin/modules/SourceConfig.pm b/solenv/bin/modules/SourceConfig.pm index 116a5e9fb893..e7b526e2cfca 100755 --- a/solenv/bin/modules/SourceConfig.pm +++ b/solenv/bin/modules/SourceConfig.pm @@ -320,14 +320,14 @@ sub read_config_file { next; }; }; - croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . 'violates format. Please make your checks!!'); + croak("Line $line in " . $self->{SOURCE_CONFIG_FILE} . ' violates format. Please make your checks!'); }; close SOURCE_CONFIG_FILE; if (!scalar keys %{$self->{REPOSITORIES}}) { get_fallback_repository($self); }; } else { - croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . 'for reading'); + croak('Cannot open ' . $self->{SOURCE_CONFIG_FILE} . ' for reading'); }; }; diff --git a/solenv/bin/modules/installer/control.pm b/solenv/bin/modules/installer/control.pm index bd700be38758..20bc2efdcf4f 100644 --- a/solenv/bin/modules/installer/control.pm +++ b/solenv/bin/modules/installer/control.pm @@ -329,6 +329,11 @@ sub check_logfile my @output = (); my $contains_error = 0; + my $ignore_error = 0; + my $make_error_to_warning = 0; + + if (( ! $installer::globals::pro ) && ( $installer::globals::ignore_error_in_logfile )) { $ignore_error = 1; } + for ( my $i = 0; $i <= $#{$logfile}; $i++ ) { my $line = ${$logfile}[$i]; @@ -346,6 +351,12 @@ sub check_logfile { $contains_error = 1; push(@errors, $line); + + if ( $ignore_error ) + { + $contains_error = 0; + $make_error_to_warning = 1; + } } } @@ -368,7 +379,26 @@ sub check_logfile } else { - my $line = "\n***********************************************************\n"; + my $line = ""; + + if ( $make_error_to_warning ) + { + $line = "\n*********************************************************************\n"; + push(@output, $line); + $line = "The following errors in the log file were ignored:\n\n"; + push(@output, $line); + + for ( my $i = 0; $i <= $#errors; $i++ ) + { + $line = "$errors[$i]"; + push(@output, $line); + } + + $line = "*********************************************************************\n"; + push(@output, $line); + } + + $line = "\n***********************************************************\n"; push(@output, $line); $line = "Successful packaging process!\n"; push(@output, $line); diff --git a/solenv/bin/modules/installer/environment.pm b/solenv/bin/modules/installer/environment.pm index 98bdffb3122a..c0d166081032 100644 --- a/solenv/bin/modules/installer/environment.pm +++ b/solenv/bin/modules/installer/environment.pm @@ -128,6 +128,7 @@ sub set_global_environment_variables if ( $ENV{'SOLAR_JAVA'} ) { $installer::globals::solarjavaset = 1; } if ( $ENV{'RPM'} ) { $installer::globals::rpm = $ENV{'RPM'}; } if ( $ENV{'DONTCOMPRESS'} ) { $installer::globals::solarisdontcompress = 1; } + if ( $ENV{'IGNORE_ERROR_IN_LOGFILE'} ) { $installer::globals::ignore_error_in_logfile = 1; } if (( $ENV{'DISABLE_STRIP'} ) && ( $ENV{'DISABLE_STRIP'} ne '' )) { $installer::globals::strip = 0; } if ( $installer::globals::localinstalldir ) { $installer::globals::localinstalldirset = 1; } diff --git a/solenv/bin/modules/installer/globals.pm b/solenv/bin/modules/installer/globals.pm index 7d6e8c4a9b8f..144cf4c88a4b 100644 --- a/solenv/bin/modules/installer/globals.pm +++ b/solenv/bin/modules/installer/globals.pm @@ -243,6 +243,7 @@ BEGIN @logfileinfo = (); @errorlogfileinfo = (); @globallogfileinfo = (); + $ignore_error_in_logfile = 0; $exitlog = ""; $globalinfo_copied = 0; $quiet = 0; diff --git a/solenv/bin/packmodule b/solenv/bin/packmodule new file mode 100755 index 000000000000..dd1ac0439308 --- /dev/null +++ b/solenv/bin/packmodule @@ -0,0 +1,58 @@ +#! /usr/bin/env python +#************************************************************************* +# +# 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. +# +#************************************************************************* +import os, os.path, sys, zipfile + +def paths_to_pack(loglines): + """Returns a generator iterating the outdir fields (with platform) of gb_deliver.log lines.""" + return (line.split()[2] for line in loglines) + +def stripped_paths_to_pack(loglines): + """returns a generator iterating the outdir fields (stripped of the platform) of gb_deliver.log lines.""" + return (path.partition('/')[2] for path in paths_to_pack(loglines)) + +def main(args): + """creates/overwrites a file at OUTDIR/zip/MODULE.zip containing the contents of the gb_deliver.log.""" + if len(args) != 3: + print('usage: packmodule OUTDIR MODULE') + sys.exit(2) + (executable, outdir, module) = args + os.chdir(outdir) + zipdir = 'zip' + try: + os.makedirs(zipdir) + except OSError: + pass + deliverlog = open(os.path.join('inc', module, 'gb_deliver.log')) + packedmodule = zipfile.ZipFile(os.path.join(zipdir,module+'.zip'), 'w') + [packedmodule.write(path) for path in stripped_paths_to_pack(deliverlog)] + packedmodule.close() + +if __name__ == "__main__": + main(sys.argv) + +# vim:set et sw=4 ts=4 filetype=python: |