Commits

hr  committed 4f136d4

#i93829#: remove old CWS tools

  • Participants
  • Parent commits 19cbf3f

Comments (0)

Files changed (18)

File solenv/bin/cwsadd

-#!/bin/sh
-if [ x${SOLARENV}x = xx ]; then
-    echo No environment found, please use 'configure' or 'setsolar'
-    exit 1
-fi
-exec perl -w $SOLARENV/bin/cwsadd.pl "$@"

File solenv/bin/cwsadd.pl

-:
-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: cwsadd.pl,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.
-#
-#*************************************************************************
-
-#
-# cwsadd.pl - add modules to child workspaces
-#
-
-use strict;
-use Getopt::Long;
-use Cwd;
-use IO::Handle;
-use File::Copy;
-#### module lookup
-my @lib_dirs;
-BEGIN {
-    if ( !defined($ENV{SOLARENV}) ) {
-        die "No environment found (environment variable SOLARENV is undefined)";
-    }
-    push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
-    push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS});
-}
-use lib (@lib_dirs);
-
-use Cws;
-use CwsConfig;
-
-eval { require CopyPrj; import CopyPrj; };
-use CvsModule;
-
-#### script id #####
-
-( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
-
-my $script_rev;
-my $id_str = ' $Revision: 1.10 $ ';
-$id_str =~ /Revision:\s+(\S+)\s+\$/
-  ? ($script_rev = $1) : ($script_rev = "-");
-
-print "$script_name -- version: $script_rev\n";
-
-#### global #####
-
-my $force_checkout = '';
-my $allow_modified = 0;
-my $is_debug = 0;
-my $opt_dir  = '';  # dir option
-my $vcsid = "unknown";
-my $add_output_tree = 1;
-my $keep_output_trees = 0;
-my $force_output_tree_copy = 0;
-my $sointernal = undef;
-my @found_platforms = ();
-
-my @args_bak = @ARGV;
-      # store the @ARGS here for logging
-
-# module names to be rejected
-my @invalid_names =
-qw(common common.pro cvs cws wntmsci unxsols unxsoli unxlngi unxlngp macosxp);
-
-
-#### main #####
-
-my @modules = parse_options();
-my ($dir, $cws) = get_and_verify_cws();
-my @modules_to_add = check_modules($cws, @modules);
-my $workspace_db;
-if ( @modules_to_add ) {
-    if ($sointernal) {
-        require EnvHelper; import EnvHelper;
-        $workspace_db = EnvHelper::get_workspace_db();
-        @modules_to_add = copy_modules($cws, $dir, $workspace_db, @modules_to_add);
-    } else {
-        @modules_to_add = update_modules($cws, $dir, @modules_to_add);
-    };
-    if ( @modules_to_add ) {
-        my @registered_modules = ();
-        my $success = 0;
-        my $module;
-        foreach (@modules_to_add) {
-            $module = $_;
-            $success = branch_module($cws, $dir, $module);
-            last unless $success;
-            $success = register_module($cws, $workspace_db, $module);
-            last unless $success;
-            push(@registered_modules, $module);
-        }
-        if ( @registered_modules ) {
-            my $modules_str = join(", ", @registered_modules);
-            my $child = $cws->child();
-            print "\n";
-            print_message("Summary:");
-            print_message("Sucessfully added and registered module(s) '$modules_str'.");
-        }
-        if ( !$success ) {
-            print_error("Adding and/or registering module '$module' failed!", 5);
-        }
-    }
-}
-
-exit(0);
-
-#### subroutines ####
-
-#
-# Subroutine updates module
-#
-sub update_modules {
-    my ($cws, $stand_dir, @modules_to_update) = @_;
-    my (@updated_modules, @rejected_modules);
-    my $master_tag = $cws->get_master_tag();
-    foreach my $module (@modules_to_add) {
-        my $cvs_module = CvsModule->new();
-        $cvs_module->module($module);
-        print "\tUpdating '$module' ...\n";
-        my $result = $cvs_module->update($stand_dir, $master_tag);
-        my ($updated, $merged, $conflicts) = 
-            $cvs_module->handle_update_information($result);
-        if ( ( $merged && ! $allow_modified ) || $conflicts ) {
-            push(@rejected_modules, $module);
-            next;
-        };
-        push(@updated_modules, $module);
-    };
-    if (@rejected_modules) {
-        print_warning("Found conflicts and/or locally modified files in the following modules:");
-        print STDERR "$_\n" foreach (@rejected_modules);
-        print_warning("These modules will not be added to CWS. Clean up and try adding them again.");
-    };
-    return @updated_modules;
-};
-
-sub get_and_verify_cws
-{
-    # get current child workspace from environment
-    my $childws  = $ENV{CWS_WORK_STAMP};
-    my $masterws = $ENV{WORK_STAMP};
-
-    if ( !defined($childws) || !defined($masterws) ) {
-        print_error("Can't determine child workspace environment.\n"
-                    . "Please initialize environment with setsolar ...", 1);
-    }
-
-    # get destination directory for modules to add
-    my $dir = $ENV{SRC_ROOT};
-
-    if ( !defined($dir) )
-    {
-        print_error("Need to get destination from SOURCE_ROOT - but it's not defined!",1);
-    }
-
-    my $cws = Cws->new();
-    $cws->child($childws);
-    $cws->master($masterws);
-
-    # check if we got a valid child workspace
-    my $id = $cws->eis_id();
-    print "Master: $masterws, Child: $childws, $id\n" if $is_debug;
-    if ( !$id ) {
-        print_error("Child workspace $childws for master workspace $masterws not found in EIS database.", 2);
-    }
-    return ($dir, $cws);
-}
-
-sub parse_options
-{
-    # parse options and do some sanity checks
-    # returns freshly allocated Cws reference
-
-    # linking and unlinking requires UNIX
-    if ( $^O =~ "MSWin32" )
-    {
-        print_error("Sorry! not for non-cygwin Windows environment",2);
-    }
-    my $help;
-    my $success = GetOptions(
-                '-h' => \$help,
-                '-a' => \$force_checkout,
-                '-f' => \$allow_modified,
-                '-o' => \$force_output_tree_copy,
-                '-k' => \$keep_output_trees
-            );
-    if ( $force_checkout && $force_output_tree_copy ) {
-        print_error ("Can't copy output trees with checkout forced!", 2);
-    }
-    if ( $keep_output_trees && $force_output_tree_copy ) {
-        print_error ("Can't copy output trees but keep existing...", 2);
-    }
-    if ( $help || !$success || $#ARGV < 0 ) {
-        usage();
-        exit(1);
-    }
-
-    return @ARGV;
-}
-
-sub check_modules
-{
-    # check if modules are registered with child workspace
-    # returns list of modules which can be added
-
-    my $cws     = shift;
-    my @modules = @_;
-
-    my @registered_modules = $cws->modules();
-
-    # create hash for easier searching
-    my %registered_modules_hash = ();
-    for (@registered_modules) {
-        $registered_modules_hash{$_}++;
-    }
-    my %invalid_names_hash = ();
-    for (@invalid_names) {
-        $invalid_names_hash{$_}++;
-    }
-
-    my $config = CwsConfig->get_config();
-	$sointernal = $config->sointernal();
-    my $cvs_module = CvsModule->new();
-    $cvs_module->cvs_method($config->get_cvs_server_method());
-    $cvs_module->vcsid($config->get_cvs_server_id());
-    $cvs_module->cvs_server($config->get_cvs_server());
-    $cvs_module->cvs_repository($config->get_cvs_server_repository());
-    my @new_modules = ();
-    my %cvs_aliases = $cvs_module->get_aliases_hash();
-    foreach (@modules) {
-        if ( $_ =~ /[\s\t\|\$\(\)\[\]\{\\}]/ || exists $invalid_names_hash{lc($_)} ) {
-            print_error("'$_' is an invalid module name.", 3);
-        }
-        if ( exists $registered_modules_hash{$_} ) {
-            print_warning("Module '$_' already registered, skipping.");
-            next;
-        };
-        if (!($sointernal) && !defined $cvs_aliases{$_}) {
-            print_error("There is no such module alias '$_'.", 3);
-        };
-        push(@new_modules, $_);
-    }
-
-    return @new_modules;
-}
-
-sub copyprj_module_sourcetree
-{
-    my $module_name = shift;
-    my $src_dest = shift;
-    print "copyprj $module_name\n";
-
-    # hash, that should contain all the
-	# data needed by CopyPrj module
-	my %ENVHASH = ();
-    my %platforms_to_copy = ();
-    $ENVHASH{'platforms_hash'} = \%platforms_to_copy;
-    if ( $add_output_tree && !$force_checkout ) {
-        $platforms_to_copy{$_}++ foreach (@found_platforms);
-    };
-	my %projects_to_copy = ();
-	$ENVHASH{'projects_hash'} = \%projects_to_copy;
-	$ENVHASH{'no_otree'} = 1; # does this match with %platforms_to_copy???
-	$ENVHASH{'no_path'} = 1;
-	$ENVHASH{'only_otree'} = 0;
-	$ENVHASH{'only_update'} = 1;
-	$ENVHASH{'last_minor'} = 0;
-	$ENVHASH{'spec_src'} = 0;
-	$ENVHASH{'dest'} = "$src_dest";
-	$ENVHASH{'prj_to_copy'} = '';
-	$ENVHASH{'i_server'} = '';
-	$ENVHASH{'current_dir'} = cwd();
-	$ENVHASH{'remote'} = '';
-    $ENVHASH{'force_checkout'} = 1 if ($force_checkout);
-
-	$projects_to_copy{$module_name}++;
-
-	CopyPrj::copy_projects(\%ENVHASH);
-
-};
-
-sub copy_modules
-{
-    # copy modules from master workspace into child workspace
-    my $cws          = shift;
-    my $dir          = shift;
-    my $workspace_db = shift;
-    my @modules      = @_;
-
-    my $masterws = $cws->master();
-    my $childws  = $cws->child();
-    my $milestone  = $cws->milestone();
-
-    # ause: Deine Spielwiese
-    my $result;
-    my @success_modules = ();
-
-    my $workspace = $workspace_db->get_key($masterws);
-    if ( !$workspace ) {
-        print_error("Master workspace '$masterws' not found in workspace database.", 3);
-    }
-
-    my $wslocation = $workspace_db->get_value($masterws."/Drives/o:/UnixVolume");
-    if ( !defined($wslocation) ) {
-        print_error("Location of master workspace '$masterws' not found in workspace database.", 3);
-    }
-
-    print "$wslocation\n" if $is_debug;
-
-    my $source_root = $ENV{SOURCE_ROOT};
-    if ( !defined( $source_root )) {
-        print_error("SOURCE_ROOT not defined! Please setup a valid environment for CWS \"$childws\"", 1);
-    }
-    my $cws_solver = "$source_root/$masterws";
-
-    my $start_dir = getcwd();
-    $result = chdir($dir);
-    if ( !$result ) {
-        print_error("Cannot change to $dir!", 1);
-    }
-
-    # assume that every valid platform on child "solver" has to be copied
-    $result = opendir( SOLVER, "$cws_solver");
-    if ( !$result ){ print_error ("Root dir of child workspace not accessible: $!", 1) };
-    my @found_dirs = readdir( SOLVER );
-    closedir( SOLVER );
-
-    # hack to get the milestone :-(((((
-    if ( ! defined($milestone))
-    {
-        $milestone = $ENV{UPDMINOR};
-    }
-    if ( $#found_dirs )
-    {
-        foreach my $dir_candidate ( @found_dirs )
-        {
-            if ( -d "$cws_solver/$dir_candidate/inc.".$milestone )
-            {
-                push @found_platforms, $dir_candidate;
-            }
-        }
-    }
-    # preparing pseudo environment for copyprj
-    $ENV{SRC_ROOT}="$wslocation/$masterws/src.$ENV{UPDMINOR}";
-
-    print "$ENV{SRC_ROOT}\n" if ( $is_debug );
-    print "working dir: ".getcwd()."\n" if ( $is_debug );
-    foreach my $one_module (@modules) {
-        # do some snity checks for this module
-        if ( -e "$one_module.lnk" && -e "$one_module" )
-        {
-            print_error("Duplicate representation of module $one_module ($one_module.lnk $one_module)", 0);
-            print_error("Please clean up!", 0);
-            print_error("Will NOT add module $one_module to child workspace!", 0);
-            # fail for this module
-            next;
-        }
-        if ( -e "$one_module.backup.lnk" || -e "$one_module.backup" )
-        {
-            print_error("Backup of module $one_module already exists.", 0);
-            print_error("Please clean up!", 0);
-            print_error("Will NOT add module $one_module to child workspace!", 0);
-            # fail for this module
-            next;
-
-        }
-
-        $result = 0;
-        $result = rename($one_module, "$one_module.backup.lnk") if ( -l $one_module );
-        if ( ! -l $one_module && -e $one_module ) {
-            $result ||= rename($one_module, "$one_module.backup");
-            # if it is no link, assume incompatible build
-            # -> don't copy output tree unless required
-            $add_output_tree = 0 if ( !$force_output_tree_copy );
-        }
-        $result ||= rename("$one_module.lnk", "$one_module.backup.lnk") if ( -e "$one_module.lnk" );
-        $result = 0 if ( -e $one_module || -e "$one_module.lnk" );
-        if ( ! $result )
-        {
-            print_error("Couldn't backup existing module $one_module before copying", 0);
-            print_error("Will NOT add module $one_module to child workspace!", 0);
-            # fail for this module
-            next;
-        }
-
-        # now copy sources
-        $result = copyprj_module_sourcetree( $one_module, "." );
-        if ( $result )
-        {
-            if ( -d $one_module )
-            {
-                $result = rename("$one_module", "$one_module.failed");
-                $result = system("rm -rf $one_module.failed");
-            }
-            print_error("Couldn't copy module $one_module, restoring previous.", 0);
-            if ( -e "$one_module.backup" )
-            {
-                $result = rename("$one_module.backup", $one_module);
-            }
-            else
-            {
-                $result = rename("$one_module.backup.lnk", "$one_module.lnk");
-            }
-            print_error("Restoring link for $one_module failed! Cleanup is in your hands now", 1) if ( ! $result );
-            # fail for this module
-            next;
-        }
-
-        # remove backuped link
-        unlink("$one_module.backup.lnk") if -l "$one_module.backup.lnk";
-
-        # or backuped directory...
-        if ( -d "$one_module.backup" )
-        {
-            my $keep_this_module = 0;
-		    if ( $^O =~ "MSWin32" || $^O =~ "cygwin" )
-		    {
-		        print_error("Sorry! not for windows, nobody should ever get here!",2);
-		    }
-            if ( $keep_output_trees ) {
-                # copy output trees from backup to added module
-                foreach my $i ( @found_platforms ) {
-                    
-                    if ( ! move "$one_module.backup/$i", "$one_module/$i" ) {
-                        print_warning("Could not keep \"$one_module/$i\" autommatically.");
-                        print_warning("Keeping backuped module \"$one_module.back\" to allow manual copying...");
-                        $keep_this_module = 1;
-                    }
-                }
-            }
-            if ( ! $keep_this_module ) {
-                $result = system("rm -rf $one_module.backup");
-                print_warning("Couldn't remove backuped module \"$one_module.backup\".") if $result;
-            }
-        }
-
-        # insert module in list of successfull copied modules
-        push(@success_modules, $one_module);
-    }
-
-    chdir($start_dir);
-
-#    return my @empty = (); # ause - disable all further steps
-    return @success_modules;
-}
-
-sub branch_module
-{
-    # tag modules with cws branch cws root tag
-    my $cws          = shift;
-    my $dir          = shift;
-    my $module       = shift;
-
-    my ($cws_master_tag, $cws_branch_tag, $cws_root_tag) = $cws->get_tags();
-
-    # Sanity check
-    print "operating on $dir/$_\n" if $is_debug;
-    if ( -S "$dir/$module" || ! -d "$dir/$module" ) {
-        print_error("Can't find physical copy of module '$module'", 4);
-    }
-
-    STDOUT->autoflush(1);
-    print_message("Tagging module '$module'.");
-    my $cvs_module = CvsModule->new();
-    $cvs_module->module($module);
-    $cvs_module->verbose(1);
-
-    print_message("Tag with branch tag '$cws_branch_tag'.");
-    my ($branched_files, $branch_errors) = $cvs_module->tag($dir, $cws_branch_tag, '-b');
-    if ( $branched_files < 1 ) {
-        print_error("Tagging module '$module' failed.", 0);
-        return 0;
-    }
-    if ( $branch_errors > 0 ) {
-        print_error(cleanup_tags_msg($module), 0);
-        return 0;
-    }
-    print_message("Tagged $branched_files files in module '$module' with branch tag.");
-
-    print_message("Tag with tag '$cws_root_tag'.");
-    my ($tagged_files, $anchor_errors) = $cvs_module->tag($dir, $cws_root_tag);
-    if ( $tagged_files < 1 || $anchor_errors > 0
-            || $branched_files != $tagged_files )
-    {
-        print_error(cleanup_tags_msg($module), 0);
-        return 0;
-    }
-    print_message("Tagged $tagged_files files in module '$module'.");
-
-    print_message("Updating module '$module' to branch '$cws_branch_tag'.");
-    my @dirs = $cvs_module->update($dir, $cws_branch_tag);
-    if ( $#dirs < 0 ) {
-        print_error("Updating module '$module' to branch '$cws_branch_tag' failed.\n", 0);
-        return 0;
-    }
-    STDOUT->autoflush(0);
-    return 1;
-}
-
-sub cleanup_tags_msg
-{
-    my $module = shift;
-    my ($cws_master_tag, $cws_branch_tag, $cws_root_tag) = $cws->get_tags();
-
-    my $msg = "Tagging module '$module' failed partly. Can't continue.\n";
-    $msg .= "Please remember to manually remove the tags '$cws_branch_tag' and '$cws_root_tag'\n";
-    $msg .= "from module '$module' before retrying the operation!";
-
-    return $msg;
-}
-
-# Register module with EIS.
-sub register_module
-{
-    my $cws          = shift;
-    my $workspace_db = shift;
-    my $module       = shift;
-
-    my $public = 1;
-
-    # find out if module has public flag
-    my $master = $cws->master();
-    if ($sointernal) {
-        my $key = "$master/Drives/o:/Projects/$module/SCS";
-        my $scs = $workspace_db->get_value($key);
-
-        if ( !defined($scs) ) {
-            print_error("Can't find module '$module' in workspace db", 0);
-            return 0;
-        }
-
-        # FIXME - this really shouldn't be hard coded
-        if ( $scs !~ /tunnel/ ) {
-            $public = 0;
-        }
-    } 
-
-    my $success = $cws->add_module($module, $public);
-    if ( !$success ) {
-        print_error("Can't register module '$module' with EIS!", 0);
-        return 0;
-    }
-    print_message("Succesfully registered module '$module'.");
-    return 1;
-}
-
-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;
-}
-
-sub usage
-{
-    print STDERR "Usage: cwsadd [-h] [-a] [-f ] [-o|-k] <module> ... \n";
-    print STDERR "Add one or more modules to child workspace.\n";
-    print STDERR "Options:\n";
-    print STDERR "    -a    use cvs checkout instead of copying\n";
-    print STDERR "    -f    incorporate modified files into cws\n";
-    print STDERR "    -o    force copying output trees (in copy mode only)\n";
-    print STDERR "    -k    keep existing output trees\n";
-    print STDERR "    -h    print this help\n";
-
-}

File solenv/bin/cwsaddtask

-#!/bin/sh
-if [ x${SOLARENV}x = xx ]; then
-    echo No environment found, please use 'configure' or 'setsolar'
-    exit 1
-fi
-exec perl -w $SOLARENV/bin/cwsaddtask.pl "$@"

File solenv/bin/cwsaddtask.pl

-:
-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: cwsaddtask.pl,v $
-#
-# $Revision: 1.6 $
-#
-# 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.
-#
-#*************************************************************************
-
-#
-# cwsaddtask.pl - add taskids (issues) to child workspaces
-#
-
-use strict;
-use Getopt::Long;
-
-#### module lookup
-my @lib_dirs;
-BEGIN {
-    if ( !defined($ENV{SOLARENV}) ) {
-        die "No environment found (environment variable SOLARENV is undefined)";
-    }
-    push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
-    push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS});
-}
-use lib (@lib_dirs);
-
-use Cws;
-use CvsModule;
-use CwsConfig;
-
-#### script id #####
-
-( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/; 
-
-my $script_rev;
-my $id_str = ' $Revision: 1.6 $ ';
-$id_str =~ /Revision:\s+(\S+)\s+\$/
-  ? ($script_rev = $1) : ($script_rev = "-");
-
-print "$script_name -- version: $script_rev\n";
-
-#### global #####
-
-my $is_debug = 0;
-
-# CWS states for which adding tasks are blocked.
-my @states_blocked_for_adding = (
-                                  "integrated",
-                                  "nominated",
-                                  "approved by QA"
-                                );
-
-#### main #####
-
-my ($cws, $vcsid) = get_and_verify_cws();
-my @taskids = parse_options();
-register_taskids($cws, $vcsid, @taskids);
-
-exit(0);
-
-#### subroutines ####
-
-# Get current child workspace from environment.
-sub get_and_verify_cws
-{
-    my $childws  = $ENV{CWS_WORK_STAMP};
-    my $masterws = $ENV{WORK_STAMP};
-    
-    my $config = CwsConfig->get_config();
-    my $vcsid  = $config->vcsid();
-    if ( !defined($vcsid) ) {
-        print_error("VCSID environment variable not set", 1);
-    }
-
-    if ( !defined($childws) || !defined($masterws) ) {
-        print_error("Can't determine child workspace environment.\n"
-                    . "Please initialize environment with setsolar ...", 1);
-    }
-
-    my $cws = Cws->new();
-    $cws->child($childws);
-    $cws->master($masterws);
-
-    # Check if we got a valid child workspace.
-    my $id = $cws->eis_id();
-    print "Master: $masterws, Child: $childws, $id\n" if $is_debug;
-    if ( !$id ) {
-        print_error("Child workspace $childws for master workspace $masterws not found in EIS database.", 2);
-    }
-
-    return ($cws, $vcsid);
-}
-
-# Parse options and do some sanity checks;
-sub parse_options
-{
-    my $help;
-    my $success = GetOptions('h' => \$help);
-    if ( !$success || $help || $#ARGV < 0 ) {
-        usage();
-        exit(1);
-    }
-    
-    return @ARGV;
-}
-
-# Register taskids with EIS database;
-# checks taksids for sanity, will notify user
-# if taskid is already registered.
-sub register_taskids
-{
-    
-    my $cws     = shift;
-    my $vcsid   = shift;
-    my @taskids = @_;
-
-    my $child = $cws->child();
-
-    my $status = $cws->get_approval();
-    
-    if ( !defined($status) ) {
-        print_error("Can't determine status of child workspace `$child`.", 4);
-    }
-
-    if ( grep($status eq $_, @states_blocked_for_adding) ) {
-        print_error("Can't add tasks to child workspace '$child' with state '$status'.", 5);
-    }
-
-    my @registered_taskids = $cws->taskids();
-
-    # Create hash for easier searching.
-    my %registered_taskids_hash = ();
-    for (@registered_taskids) {
-        $registered_taskids_hash{$_}++;
-    }
-
-    my @new_taskids = ();
-    foreach (@taskids) {
-        if ( $_ !~ /^([ib]?\d+)$/ ) {
-            print_error("'$_' is an invalid task ID.", 3);
-        }
-        if ( exists $registered_taskids_hash{$1} ) {
-            print_warning("Task ID '$_' already registered, skipping.");
-            next;
-        }
-        push(@new_taskids, $_);
-    }
-
-    my $added_taskids_ref = $cws->add_taskids($vcsid, @new_taskids);
-    if ( !$added_taskids_ref )  {
-        my $taskids_str = join(" ", @new_taskids);
-        print_error("Couldn't register taskID(s) '$taskids_str' with child workspace '$child'.", 4);
-    }
-    my @added_taskids = @{$added_taskids_ref};
-    if ( @added_taskids ) {
-        my $taskids_str = join(" ", @added_taskids);
-        print_message("Registered taskID(s) '$taskids_str' with child workspace '$child'.");
-    }
-    return;
-
-}
-
-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;
-}
-
-sub usage 
-{
-    print STDERR "Usage: cwsaddtask [-h] <taskID> ... \n";
-    print STDERR "Add one or more taskIDs to child workspace.\n";
-    print STDERR "Options:\n";
-    print STDERR "    -h    print this help\n";
-}

File solenv/bin/cwsanalyze

-#!/bin/sh
-if [ x${SOLARENV}x = xx ]; then
-    echo No environment found, please use 'configure' or 'setsolar'
-    exit 1
-fi
-exec perl -w $SOLARENV/bin/cwsanalyze.pl "$@"

File solenv/bin/cwsanalyze.pl

-:
-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: cwsanalyze.pl,v $
-#
-# $Revision: 1.20 $
-#
-# 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.
-#
-#*************************************************************************
-#
-# cwsanalyze.pl   - analyze child workspace, report findings
-# cwsintegrate.pl - integrate child workspace into master workspace
-#
-# TODO implements 'alerts' for integrate mode
-use strict;
-use File::Basename;
-use Getopt::Long;
-use Cwd;
-use IO::Handle;
-use Carp;
-
-#### module lookup
-my @lib_dirs;
-BEGIN {
-    if ( !defined($ENV{SOLARENV}) ) {
-        die "No environment found (environment variable SOLARENV is undefined)";
-    }
-    push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
-    push(@lib_dirs, "$ENV{COMMON_ENV_TOOLS}/modules") if defined($ENV{COMMON_ENV_TOOLS});
-}
-use lib (@lib_dirs);
-
-use Cws;
-use CvsModule;
-use Cvs;
-
-#### script id #####
-
-( my $script_name = $0 ) =~ s/^.*\b(\w+)\.pl$/$1/;
-my $config = CwsConfig->get_config();
-my $sointernal = $config->sointernal();
-
-my $script_rev;
-my $id_str = ' $Revision: 1.20 $ ';
-$id_str =~ /Revision:\s+(\S+)\s+\$/
-  ? ($script_rev = $1) : ($script_rev = "-");
-
-print "$script_name -- version: $script_rev\n";
-
-#### FIXME: hardcoded globals #####
-
-# Don't use this tool on a MWS workspaces in the veto
-# list, because the behavior may not be clearly defined
-# examples:
-#   no MWS branch exists
-#   MWS branch is obsolete
-my @veto_list = (
-                    'SRX644',
-                    'FIX645'
-                );
-
-my %veto_hash;
-foreach (@veto_list) {
-    $veto_hash{$_}++;
-}
-
-# Commit veto pattern. Never integrate files matching this pattern
-my %commit_veto_hash;
-my @commit_veto_list = (
-                        # The defs file mechanism is not compatible with CWS.
-                        # It really needs to be changed.
-                        'defs\/wntmsci\d+$'
-                       );
-foreach (@commit_veto_list) {
-    $commit_veto_hash{$_}++;
-}
-
-
-#### global #####
-
-my $is_debug              = 0;              # misc traces for debugging purposes
-my $checklicense          = 1;              # grep for LGPL 2.1 license header
-my $mode                  = $script_name;   # operational mode (cwsanalyze|cwsintegrate)
-my $opt_fast              = 0;              # fast mode, disable conflict check
-my $opt_force             = 0;              # force integration
-my $opt_no_set_integrated = 0;              # don't toggle integration status
-my $vcsid = "unknown";
-my $opt_auto_int          = 0;              # integrate automatically if no conflicts are shown
-my $opt_resume            = 0;              # resume a broken integration
-my $opt_quiet             = 0;              # minimal output
-my @args_bak = @ARGV;
-my @problem_log = ();
-
-#### main #####
-
-my ($dir, @modules) = parse_options();
-my $cws = get_and_verify_cws();
-@modules = verify_modules($cws, @modules);
-if ( $mode eq 'cwsanalyze' ) {
-    analyze($cws, $dir, @modules);
-}
-else {
-    auto_int($cws, $dir,@modules) if ($opt_auto_int); # will exit and doesn't return
-    integrate($cws, $dir, @modules);
-}
-print_plog();
-exit(0);
-
-#### subroutines ####
-
-# Get current child workspace from environment.
-sub get_and_verify_cws
-{
-    my $childws  = $ENV{CWS_WORK_STAMP};
-    my $masterws = $ENV{WORK_STAMP};
-
-    if ( exists $veto_hash{$masterws} ) {
-        print_error("Please don't use this tool for a CWS based on MWS '$masterws',", 0);
-        print_error("before you haven't resynced it to a more recent MWS.", 1);
-    }
-
-    if ( !defined($childws) || !defined($masterws) ) {
-        print_error("Can't determine child workspace environment.\n"
-                    . "Please initialize environment with setsolar ...", 1);
-    }
-
-    my $cws = Cws->new();
-    $cws->child($childws);
-    $cws->master($masterws);
-
-    # check if we got a valid child workspace
-    my $id = $cws->eis_id();
-    print "Master: $masterws, Child: $childws, $id\n" if $is_debug;
-    if ( !$id ) {
-        print_error("Child workspace $childws for master workspace $masterws not found in EIS database.", 2);
-    }
-
-    # old code lines must not get checked against current license header
-    if ( lc $masterws eq "srx645" || $masterws =~ /^\w\w\w680$/ ) {
-        $checklicense = 0;
-    }
-
-    return $cws;
-}
-
-# Parse options and do some sanity checks;
-# returns freshly allocated Cws reference.
-sub parse_options
-{   my $dir = 0;
-    my $help = 0;
-    my $success = GetOptions('d=s' => \$dir, 'n' => \$opt_fast, 'h' => \$help,
-                             'F' => \$opt_force, 'q' => \$opt_no_set_integrated, 'A' => \$opt_auto_int, 'r' => \$opt_resume, 'z' => \$opt_quiet);
-    if ( !$success || @ARGV<1 ) {
-        usage();
-        exit(1);
-    }
-
-    if ( $dir && $opt_fast ) {
-        usage();
-        exit(1);
-    }
-
-    $dir = $dir ? $dir : cwd();
-
-    # check directory
-    if ( ! -d $dir ) {
-        print_error("'$dir' is not a directory.", 1);
-    }
-    if ( ! -w $dir ) {
-        print_error("Can't write to directory '$dir'.", 1);
-    }
-
-    unless ( $opt_fast ) {
-        my @cvsdirs = glob("$dir/*/CVS");
-        if ( @cvsdirs ) {
-            print_error("'$dir' contains CVS modules. Please specify an empty scratch directory.", 1);
-        }
-    }
-
-    return ($dir, @ARGV);
-}
-
-# Check if requested modules are registered with child workspace.
-sub verify_modules
-{
-    my $cws     = shift;
-    my @modules = @_;
-
-    my @registered_modules = $cws->modules();
-    my $child = $cws->child();
-
-    # call with empty modules list
-    return @registered_modules if $modules[0] eq 'all';
-
-    # create hash for easier searching
-    my %registered_modules_hash = ();
-    for (@registered_modules) {
-        $registered_modules_hash{$_}++;
-    }
-
-    foreach (@modules) {
-        if ( !exists $registered_modules_hash{$_} ) {
-            print_error("Module '$_' is not registered for child '$child'.", 2);
-        }
-    }
-    return @modules;
-}
-
-# Check whether there are new modules registred with this CWS
-sub have_new_modules
-{
-    my $cws     = shift;
-    my ( $newmods_ref, $newmodspriv_ref );
-
-    $newmods_ref = eval {
-        $cws->new_modules();
-    } || [];
-    if ( $@ ) {
-        # Method 'new_modules()' for package 'Cws' is not available on all workspaces.
-        # In case it's not there give an error message, but do not fail
-        print_error( $@ );
-    }
-    $newmodspriv_ref = eval {
-        $cws->new_modules_priv();
-    } || [];
-    if ( $@ ) {
-        print_error ($@ );
-    }
-    return ( $newmods_ref, $newmodspriv_ref );
-}
-
-# Analyze changes in child work space
-sub analyze
-{
-    my $cws     = shift;
-    my $dir     = shift;
-    my @modules = @_;
-
-    my $child = $cws->child();
-    my $master = $cws->master();
-
-    print_message("Analyzing child workspace '$child', master workspace '$master'.");
-    print_message("*** Conflict check disabled ***") if $opt_fast;
-    # display child workspace approval status
-    my $approval = $cws->get_approval();
-    if ( !$approval ) {
-        print_error("Internal error: can't get approval status for '$child'.", 3);
-    }
-    print_message("Child workspace approval status: '$approval'");
-
-    my ($ntotal_merged, $ntotal_new, $ntotal_removed, $ntotal_conflicts, $ntotal_alerts)
-            = (0, 0, 0, 0);
-    foreach (@modules) {
-        my ($nmerged, $nnew, $nremoved, $nconflicts, $nalerts) = analyze_module($cws, $dir, $_);
-        $ntotal_merged    += $nmerged;
-        $ntotal_new       += $nnew;
-        $ntotal_removed   += $nremoved;
-        $ntotal_conflicts += $nconflicts;
-        $ntotal_alerts    += $nalerts;
-    }
-    my $merge_str = $opt_fast ? 'change(s)' : 'clean merge(s)';
-    my $stats = "All Modules: $ntotal_merged $merge_str, $ntotal_new new, ";
-    $stats .=   "$ntotal_removed removed";
-    $stats .= $opt_fast ? '' : ", $ntotal_conflicts conflict(s), $ntotal_alerts alert(s)";
-    print_message($stats);
-
-    my ( $new_modules_ref, $new_private_modules_ref ) = have_new_modules( $cws );
-    print_message( "New public modules: " . join ' ', @$new_modules_ref ) if @$new_modules_ref;
-    print_message( "New internal modules: " . join ' ', @$new_private_modules_ref ) if @$new_private_modules_ref;
- 
-    return ($ntotal_conflicts,$ntotal_alerts) if $opt_auto_int;
-}
-
-# Integrate child workspace into master.
-sub integrate
-{
-    my $cws     = shift;
-    my $dir     = shift;
-    my @modules = @_;
-
-    my $child  = $cws->child();
-    my $master = $cws->master();
-
-    print_message("Integrating child workspace '$child' into master workspace '$master'.");
-    # check if child workspace has been approved for integration
-    my $approval = $cws->get_approval();
-    if ( !$approval ) {
-        print_error("Internal error: can't get approval status for '$child'.", 3);
-    }
-
-    if ( $approval eq 'new' ) {
-        print_error("Child workspace '$child' is not approved for integration.", 3);
-    }
-    elsif ( $approval eq 'integrated' ) {
-        print_error("Child workspace '$child' is already integrated.", 3) unless $opt_force;
-    }
-    elsif ( $approval eq 'canceled' ) {
-        print_error("Child workspace '$child' has been canceled.", 3);
-    }
-    elsif ( $approval eq 'nominated' ) {
-        print_message("Child workspace '$child' is nominated for integration, proceeding ...");
-    }
-    else {
-        # can't happen
-        print_error("Internal error: can't get approval status for '$child'.", 3);
-    }
-
-    my ($ntotal_merged, $ntotal_new, $ntotal_removed, $ntotal_conflicts, $ntotal_alerts) =
-                (0, 0, 0, 0, 0);
-    my @failed_registrations;
-    foreach (@modules) {
-        my($nmerged, $nnew, $nremoved, $nconflicts, $nalerts, $eisfailure_ref) = integrate_module($cws, $dir, $_);
-        $ntotal_new       += $nnew;
-        $ntotal_removed   += $nremoved;
-        $ntotal_merged    += $nmerged;
-        $ntotal_conflicts += $nconflicts;
-        $ntotal_alerts    += $nalerts;
-        push @failed_registrations, @$eisfailure_ref;
-    }
-
-    # If some files could not be registered to EIS try again
-    # (EIS may have been temporarily unavailable)
-    my @repeated_regfailures;
-    foreach my $arg_ref ( @failed_registrations ) {
-        $cws->add_file( @$arg_ref ) or push @repeated_regfailures, $$arg_ref[0] .'/'. $$arg_ref[1];
-    }
-
-    print "All modules: $ntotal_new new, $ntotal_removed removed, $ntotal_merged merge(s), $ntotal_conflicts conflicts(s). $ntotal_alerts alert(s)\n";
-
-    my ( $new_modules_ref, $new_private_modules_ref ) = have_new_modules( $cws );
-    print_message( "New public modules: " . join ' ', @$new_modules_ref ) if @$new_modules_ref;
-    print_message( "New internal modules: " . join ' ', @$new_private_modules_ref ) if @$new_private_modules_ref;
-
-    if ( @repeated_regfailures ) {
-        prompt_manual_registration( $child, $master, @repeated_regfailures );
-    }
-
-    # set CWS status
-    if ( !$opt_no_set_integrated ) {
-        if ( $cws->set_integrated() ) {
-            print_message("\nSet child workspace status to: integrated.");
-        }
-        else {
-            print_error("Could not set child workspace status to integrated.", 0);
-        }
-    }
-}
-
-# Analyze child workspace module
-sub analyze_module
-{
-    my $cws    = shift;
-    my $dir    = shift;
-    my $module = shift;
-
-    print_message("========== Analyzing module '$module' ==========");
-
-    my $cvs_module = get_cvs_module($cws, $module);
-    if ( !$cvs_module ) {
-        print_error("Failure during analysis of '$module', skipping.", 0);
-        plog("A\t$module: analysis failed!");
-        return (0, 0, 0, 0, 1);
-    }
-    my $changed_files_ref = get_changed_files($cws, $cvs_module);
-
-    if ( !defined($changed_files_ref) ) {
-        print_warning("Analysis of module '$module' failed.");
-        return undef;
-    }
-
-    my ($master_branch_tag, $cws_branch_tag, $cws_root_tag) = $cws->get_tags();
-    my ($nnew, $nremoved, $nmerged, $nconflicts, $nalerts) = (0, 0, 0, 0, 0);
-    if ( @{$changed_files_ref} ) {
-        # ok we've got changed files
-        # to check for conflicts we check out the module on the master branch
-        # and update all changed files against the child workspace branch
-        my $save_dir;
-        if ( !$opt_fast ) {
-            STDOUT->autoflush(1);
-            print_message("Check out for conflict check ...");
-            my $co_ref = $cvs_module->checkout($dir, $master_branch_tag);
-            STDOUT->autoflush(0);
-            if ( !@{$co_ref} ) {
-                print_error("Was not able to checkout module '$module',", 0);
-                print_error("this might be caused by connection failures or authentification problems.", 0);
-                print_error("Please check your \$HOME/.cvspass for missing entries!", 50);
-            }
-            # save working dir for later perusal
-            # chdir into module
-            $save_dir = cwd();
-            if ( !chdir("$dir/$module") ) {
-                my $test = cwd();
-                if ( $test !~ /.+$dir\/$module$/) {
-                    print_error("Can't chdir() to '$dir/$module'", 6);
-                }
-            }
-        }
-      ANALYZE: foreach my $change_ref (@{$changed_files_ref}) {
-            # Check against vetoed files
-            foreach my $veto_pattern ( keys %commit_veto_hash ) {
-                if ( $change_ref->[0] =~ /$veto_pattern/ ) {
-                    next ANALYZE; # jump to next changed file
-                }
-            }
-            if ( !defined($change_ref->[1]) && !defined($change_ref->[2]) ) {
-                # removed file
-                print "\tR", "\t", $change_ref->[0], "\n";
-                $nremoved++;
-            }
-            elsif ( !defined($change_ref->[1]) ) {
-                # new file
-                print "\tN","\t", $change_ref->[0], "\t", $change_ref->[2], "\n";
-                $nnew++;
-                if ( $checklicense && ! $opt_fast ) {
-                    # check for outdated license header
-                    my $repository = $cvs_module->cvs_repository();
-                    if ( $repository !~ /cvs_so/ ) {
-                        my $archive = $change_ref->[0];
-                        if ( defined($change_ref->[2]) && !-d dirname($archive) ) {
-                            # A new file appeared in a directory which has not yet
-                            # been added to our local CVS tree.
-                            sanitize_cvs_hierarchy($archive);
-                        }
-                        my $cvs_archive = get_cvs_archive($archive);
-                        my $rc = update_file($cvs_archive, $cws_branch_tag, $cws_root_tag);
-                        if ( check_for_lgpl21($archive) ) {
-                            print "\tA", "\t",
-                                  $archive, " file has old license header (LGPL v. 2.1)\n";
-                            plog("A\t$module/$archive: file has LGPL v. 2.1.");
-                            $nalerts++;
-                        }
-                    }
-                }
-            }
-            else {
-                # modified file
-                if ( $opt_fast ) {
-                    print "\tM", "\t", $change_ref->[0], "\t",
-                          $change_ref->[1], " -> ",
-                          $change_ref->[2], "\n";
-                    $nmerged++;
-                }
-                else {
-                    my $archive = $change_ref->[0];
-                    if ( !-e $archive ) {
-                        # changes have been made on the CWS for
-                        # a file which has been removed on the MWS
-                        print "\tA", "\t",
-                              $change_ref->[0], " file removed on MWS but changed on CWS\n";
-                        plog("A\t$module/$change_ref->[0]: file removed on MWS but changed on CWS. Please check!");
-                        $nalerts++;
-                    }
-                    my $cvs_archive = get_cvs_archive($archive);
-                    my $rc = update_file($cvs_archive, $cws_branch_tag, $cws_root_tag);
-                    if ( $rc eq 'merged' ) {
-                        print "\tM", "\t", $change_ref->[0], "\t",
-                              $change_ref->[1], " -> ",
-                              $change_ref->[2], "\n";
-                        $nmerged++;
-                    }
-                    elsif ( $rc eq 'conflict' ) {
-                        print "\tC", "\t", $change_ref->[0], "\t",
-                              $change_ref->[1], " -> ",
-                              $change_ref->[2], "\n";
-                        plog("C\t$module/$change_ref->[0]: conflict!");
-                        $nconflicts++;
-                    }
-                    else {
-                        print_error("update_file() operation failed.", 6);
-                    }
-
-                    # check for outdated license header
-                    my $repository = $cvs_module->cvs_repository();
-                    if ( $checklicense && $repository !~ /cvs_so/ ) {
-                        if ( check_for_lgpl21($archive) ) {
-                            print "\tA", "\t",
-                                  $archive, " file has old license header (LGPL 2.1)\n";
-                            plog("A\t$module/$archive: file has LGPL 2.1.");
-                            $nalerts++;
-                        }
-                    }
-                }
-            }
-        }
-        # chdir back
-        chdir($save_dir) if( !$opt_fast );
-    }
-
-    # emit some statistics
-    my $merge_str = $opt_fast ? 'change(s)' : 'clean merge(s)';
-    my $stats = "'$module': $nmerged $merge_str, $nnew new, ";
-    $stats .=   "$nremoved removed";
-    $stats .= $opt_fast ? '' : ", $nconflicts conflict(s), $nalerts alert(s)";
-    print_message($stats);
-
-    return ($nmerged, $nnew, $nremoved, $nconflicts, $nalerts);
-}
-
-# Integrate child workspace module.
-sub integrate_module
-{
-    # TODO break integrate_module() down into several routines
-    my $cws    = shift;
-    my $dir    = shift;
-    my $module = shift;
-
-    print_message("========== Integrating module '$module' ==========");
-
-    my $cvs_module = get_cvs_module($cws, $module);
-    if ( !$cvs_module ) {
-        print_error("Failure during integration of '$module', skipping.", 0);
-        plog("A\t$module: integration failed!");
-        return (0, 0, 0, 0, 1);
-    }
-    my $changed_files_ref = get_changed_files($cws, $cvs_module);
-
-    if ( !defined($changed_files_ref) ) {
-        print_warning("Integration of module '$module' failed.");
-        return undef;
-    }
-    my $child = $cws->child();
-
-    my ($master_branch_tag, $cws_branch_tag, $cws_root_tag) = $cws->get_tags();
-
-    # statistics counters
-    my ($nnew, $nremoved, $nmerged, $nconflicts, $nalerts) = (0, 0, 0, 0, 0);
-    # for error handling of EIS registrations
-    my @failed2register;
-
-    if ( @{$changed_files_ref} && $opt_resume ) { 
-        # opt_resume: we already have integrated parts of this CWS
-        $changed_files_ref = clear_finished_files( $cws, $module, $changed_files_ref );
-    }
-
-    if ( @{$changed_files_ref} ) {
-        # ok we've got changed files
-        STDOUT->autoflush(1);
-        print_message("Checking out ...");
-        $cvs_module->checkout($dir, $master_branch_tag);
-        STDOUT->autoflush(0);
-        # save working dir for later perusal
-        my $save_dir = cwd();
-        # chdir into module
-        if ( !chdir("$dir/$module") ) {
-                print_error("Can't chdir() to '$dir/$module'", 0);
-        }
-      COMMIT: foreach my $change_ref (@{$changed_files_ref}) {
-            my $archive = $change_ref->[0];
-            # Check against vetoed files
-            foreach my $veto_pattern ( keys %commit_veto_hash ) {
-                if ( $archive =~ /$veto_pattern/ ) {
-                    next COMMIT; # jump to next changed file
-                }
-            }
-            if ( defined($change_ref->[2]) && !-d dirname($archive) )
-            {
-                if ( defined($change_ref->[1]) ) {
-                }
-                else {
-                    # A new file appeared in a directory which has not yet
-                    # been added to our local CVS tree.
-                    sanitize_cvs_hierarchy($archive);
-                }
-            }
-            my $cvs_archive = get_cvs_archive($archive);
-            #  Determine the branch root of the CWS branch and the master branch
-            my $branch_rev = $cvs_archive->get_branch_rev($cws_branch_tag);
-            my $master_branch_rev = $cvs_archive->get_branch_rev($master_branch_tag);
-            if ( !$branch_rev ) {
-                # If this go wrong it's most likely due to a CVS problem
-                print_error("Can't determine CWS branch root, CVS problems?", 99);
-            }
-            my @merge_comments;
-            push(@merge_comments, get_revision_comments($cvs_archive, $branch_rev));
-            my $change_type;
-            if ( !defined($change_ref->[1]) && !defined($change_ref->[2]) ) {
-                # removed file
-                push(@merge_comments, "INTEGRATION: CWS $child ($branch_rev); FILE REMOVED\n");
-                $change_type = 'removed';
-            }
-            elsif ( !defined($change_ref->[1]) ) {
-                # new file
-                push(@merge_comments, "INTEGRATION: CWS $child ($branch_rev); FILE ADDED\n");
-                $change_type = 'new';
-            }
-            else {
-                # modified file
-                push(@merge_comments, "INTEGRATION: CWS $child ($branch_rev); FILE MERGED\n");
-                $change_type = 'changed';
-            }
-
-            # write out merge comment file
-            my $merge_comment_file = $archive . '.mergecomment';
-            if ( !open(COMMENTFILE, ">$merge_comment_file") ) {
-                print_error("$script_name: can't open $merge_comment_file: $!", 0);
-            }
-            print COMMENTFILE reverse @merge_comments;
-            close(COMMENTFILE);
-
-            # get the revision authors and taskids
-            my $revision_authors_ref = get_revision_authors($cvs_archive, $branch_rev);
-            my $revision_taskids_ref = get_revision_taskids($cvs_archive, $branch_rev);
-
-            # do the update
-            my $new_revision;
-            my $rc = update_file($cvs_archive, $cws_branch_tag, $cws_root_tag);
-            if ( !$rc ) {
-                print_error("Update operation for file '$archive' failed for unknown reasons.", 0);
-                plog("$module/$archive: update operation failed for unknown reasons, can't commit changes!");
-            }
-            elsif ( $rc eq 'merged' ) {
-                # commit merges
-                ($rc, $new_revision) = commit_file($cvs_archive, $merge_comment_file);
-                unless ( $rc eq 'success' || $rc eq 'nothingcomitted' ) {
-                    print_error("Can't commit changes to '$archive'", 0);
-                    plog("\t$module/$archive: can't commit changes!");
-                    next;
-                }
-                print "\tN\t$archive\n" and $nnew++ if $change_type eq 'new';
-                print "\tR\t$archive\n" and $nremoved++ if $change_type eq 'removed';
-                print "\tM\t$archive\n" and $nmerged++ if $change_type eq 'changed';
-                unlink($merge_comment_file) if $rc eq 'success';
-            }
-            elsif ( $rc eq 'conflict' ) {
-                print "\tC\t$archive\n";
-                plog("C\t$module/$archive: conflict!");
-                $nconflicts++;
-
-                # TODO: clean up this mess
-                # Find out what the new revision will be after the conflict has been
-                # solved. We are going to report it to EIS even if the commit
-                # has not yet been done
-                my $last_rev;
-                if ( !$master_branch_rev ) {
-                    # master branch is head branch
-                    $last_rev = $cvs_archive->get_head();
-                }
-                else {
-                    my $revs_ref = $cvs_archive->get_sorted_revs();
-                    foreach my $rev (@{$revs_ref}) {
-                        if ( $rev =~ /^$master_branch_rev\.\d+/ ) {
-                            $last_rev = $rev;
-                        }
-                    }
-                    if ( !defined($last_rev) ) {
-                        # no revision has ever been committed on the
-                        # master branch => give $last_rev an artificial 
-                        # "0" revision 
-                        $last_rev = $master_branch_rev . '.0';
-                    }
-                }
-                my @rev_field = split(/\./, $last_rev);
-                $rev_field[-1]++;
-                $new_revision = join('.', @rev_field);
-            }
-            else {
-                # can't happen
-                print_error("Internal error: update failed for unknown reasons", 0);
-            }
-
-            # check for outdated license header
-            my $repository = $cvs_module->cvs_repository();
-            if ( $checklicense && $repository !~ /cvs_so/ ) {
-                if ( check_for_lgpl21($archive) ) {
-                    print "\tA", "\t",
-                          $archive, " file has old license header (LGPL 2.1)\n";
-                    plog("A\t$module/$archive: file has LGPL 2.1.");
-                    $nalerts++;
-                }
-            }
-
-            # register new revision with EIS
-            if ( ! $cws->add_file($module, $archive, $new_revision,
-                           $revision_authors_ref, $revision_taskids_ref) ) {
-                push @failed2register, [$module, $archive, $new_revision, 
-                           $revision_authors_ref, $revision_taskids_ref];
-            }
-
-        }
-        # chdir back
-        chdir($save_dir);
-    }
-
-    # emit some statistics
-    print "'$module': $nnew new, $nremoved removed, $nmerged merge(s), $nconflicts conflicts(s). $nalerts alert(s)\n";
-    return ($nmerged, $nnew, $nremoved, $nconflicts, $nalerts, \@failed2register);
-}
-
-# Get all revision comments on child workspace branch.
-sub get_revision_comments
-{
-    my $cvs_archive    = shift;
-    my $branch_rev     = shift;
-
-    # Collect all the logging information of the revisions on the branch
-    my @merge_comment = ();
-    my $revs_ref = $cvs_archive->get_sorted_revs();
-    foreach my $rev (@{$revs_ref}) {
-        if ( $rev =~ /^$branch_rev\.\d+/ ) {
-            my $log_ref = $cvs_archive->get_data_by_rev()->{$rev};
-            my $comment = "$log_ref->{'DATE'} $log_ref->{'AUTHOR'} $rev: $log_ref->{'COMMENT'}";
-            if ( $log_ref !~ /^RESYNC:/ ) {
-                push(@merge_comment, $comment);
-            }
-        }
-    }
-    wantarray ? @merge_comment : \@merge_comment;
-}
-
-sub get_revision_authors
-{
-    my $cvs_archive    = shift;
-    my $branch_rev     = shift;
-
-    # Collect all the authors of the revisions on the branch
-    my @authors;
-    my %authors_hash;
-    my $revs_ref = $cvs_archive->get_sorted_revs();
-    foreach my $rev (@{$revs_ref}) {
-        if ( $rev =~ /^$branch_rev\.\d+/ ) {
-            my $log_ref = $cvs_archive->get_data_by_rev()->{$rev};
-            $authors_hash{$log_ref->{'AUTHOR'}}++;
-        }
-    }
-    push(@authors, sort keys %authors_hash);
-    wantarray ? @authors : \@authors;
-}
-
-sub get_revision_taskids
-{
-    my $cvs_archive    = shift;
-    my $branch_rev     = shift;
-
-    # Collect all the taskids of the revisions on the branch
-    my @task_ids;
-    my %task_ids_hash;
-    my $revs_ref = $cvs_archive->get_sorted_revs();
-    foreach my $rev (@{$revs_ref}) {
-        if ( $rev =~ /^$branch_rev\.\d+/ ) {
-            my $log_ref = $cvs_archive->get_data_by_rev()->{$rev};
-            my @ids = extract_taskids($log_ref->{'COMMENT'});
-            foreach (@ids) {
-                $task_ids_hash{$_}++;
-            }
-        }
-    }
-    push(@task_ids, sort keys %task_ids_hash);
-    wantarray ? @task_ids : \@task_ids;
-}
-
-# Extract task ids from revision comment.
-sub extract_taskids
-{
-    # Task ids can be of the form:
-    #     #12345#,#4711# pr #12345,4711#
-    # Optionally task ids may be prefixed with
-    #   'i' for issuezilla tasks
-    #   'b' for for bugtraq+ tasks
-    #   'm' for mozilla bugzilla tasks
-    #   'g' for gnome bugzilla tasks
-    #   'e' for evolution bugzilla tasks
-    # We may have to cope with a bit of white space, too.
-    my $comment = shift;
-
-    my @ids;
-    my @candidates;
-    if ( @candidates = ($comment =~ /#([ibmge\d\s,]+)#/gi) ) {
-        foreach my $candidate (@candidates) {
-            my @field = split(/,/, $candidate);
-            foreach (@field) {
-                tr/ //d;
-                push(@ids, $_) if /^[ibmge]?\d+$/i ;
-            }
-        }
-    }
-    wantarray ? @ids : \@ids;
-}
-
-
-# Update file and report findings.
-sub update_file
-{
-
-    my $cvs_archive    = shift;
-    my $cws_branch_tag = shift;
-    my $cws_root_tag   = shift;
-
-    my $file = $cvs_archive->name();
-    my $merge_option = '';
-    if ( -e $file ) {
-        # find out if we need to use the '-kk' flag for merging
-        my ($status, $working_rev, $repository_rev, $sticky_tag, $branch_rev,
-                $sticky_date, $sticky_options) = $cvs_archive->status();
-        if ( $status eq 'unknownfailure' || $status eq 'connectionfailure' ) {
-            print_error("can't get status of '$file': $status", 0);
-            return undef;
-        }
-        $merge_option = ($sticky_options eq 'kb') ? '' : '-kk';
-    }
-
-    my $rc = $cvs_archive->update("$merge_option -j$cws_root_tag -j$cws_branch_tag");
-    if ( $rc eq 'success' ) {
-        return 'merged';
-    }
-    elsif ( $rc eq 'conflict' ) {
-        return 'conflict';
-    }
-    else {
-        return undef;
-    }
-}
-
-sub commit_file
-{
-    my $cvs_archive = shift;
-    my $merge_comment_file = shift;
-
-    my ($rc, $new_revision) = $cvs_archive->commit("-F $merge_comment_file");
-    return ($rc, $new_revision);
-}
-
-# Returns changed files for module.
-sub get_changed_files
-{
-    my $cws        = shift;
-    my $cvs_module = shift;
-
-    my ($master_branch_tag, $cws_branch_tag, $cws_root_tag) = $cws->get_tags();
-
-    $cvs_module->verbose(1) if (! $opt_quiet);
-    STDOUT->autoflush(1);
-    print_message("Retrieving changes ...");
-    my $changed_files_ref;
-    eval { $changed_files_ref = $cvs_module->changed_files($cws_root_tag,$cws_branch_tag) };
-    if ( $@ ) {
-        if ( $@ =~ /server died silently/ ) {
-            my $time_str = localtime();
-            print_error("The CVS server has died silently on 'cvs rdiff' operation.", 0);
-            print_error("Please inform Release Engineering!", 0);
-            print_error("Time of failure: '$time_str'", 99);
-        }
-        else {
-            croak($@); # rethrow
-        }
-    }
-    STDOUT->autoflush(0);
-    return $changed_files_ref;
-}
-
-sub check_for_lgpl21
-# checks file for old LGPL 2.1 license header
-# note: also detects even older dual license header LGPL2.1 / SISSL
-{
-    my $file = shift;
-    my $old_license = 0;
-    open( FILE, "< $file" ) or return 0;
-    GREP: while (<FILE>) {
-        if ( /^\W*GNU Lesser General Public License version 3/ ) {
-            # correct
-            last GREP;
-        } elsif ( /^\W*GNU Lesser General Public License Version 2\.1/ ) {
-            $old_license ++;
-            last GREP;
-        }
-    }
-    close( FILE );
-    return $old_license;
-}
-
-# For repeated integrations (only to be done in case of crashes):
-# clear files list, avoid integrating twice
-sub clear_finished_files
-{
-    my $cws       = shift;
-    my $module    = shift;
-    my $files_ref = shift;
-    my ($integrated_files_ref, %integrated_files, @remaining_files);
-
-    $integrated_files_ref = $cws->files();
-    foreach ( @$integrated_files_ref ) {
-        my @filedata = split /,/, $_;
-        next unless ( $filedata[0] eq $module );
-        if ( $filedata[1] ) {
-            $integrated_files{$filedata[1]} ++;
-        }
-    }
-    foreach my $change_ref (@{$files_ref}) {
-        push @remaining_files, $change_ref unless $integrated_files{$$change_ref[0]};
-    }
-    if ( my $n_in_EIS = keys %integrated_files ) {
-        print_message("skipping $n_in_EIS file(s): already integrated\n");
-    }
-    return \@remaining_files;
-}
-
-# New files may be in new CVS subdirectories.
-# Check if the CVS subdir is available or
-# add it to the local CVS tree
-sub sanitize_cvs_hierarchy
-{
-    my $file = shift;
-
-    my $cvs_dir = dirname($file);
-    return if $cvs_dir eq '.'; # no need to check current dir
-
-    my @elements = split(/\//, $cvs_dir);
-
-    my $save_dir = cwd();
-
-    my $cvs_binary = $config->cvs_binary();
-
-    foreach ( @elements ) {
-        if ( ! -d $_ ) {
-            my $rc = mkdir($_);
-            print_error("can create directory '$_': $!", 9) unless $rc;
-            # TODO use a Cvs method for this
-            system("$cvs_binary add $_ > /dev/null 2>&1 ");
-        }
-        if ( !chdir($_) ) {
-            print_error("Can't chdir() to '$_'", 9);
-        }
-    }
-
-    # chdir back
-    chdir($save_dir);
-}
-
-# Retrieve CvsModule object for passed module.
-sub get_cvs_module
-{
-    my $cws    = shift;
-    my $module = shift;
-
-    my $cvs_module = CvsModule->new();
-    my ($method, $vcsid, $server, $repository);
-    if ( $sointernal ) {
-        ($method, $vcsid, $server, $repository) = get_cvs_root($cws, $module);
-    }
-    else {
-        # For now just take the configured OOo sever. Later we might implement a mechanism were
-        # only known OOo modules are fetched from the OOo server, the rest from a local
-        # server
-        ($method, $vcsid, $server, $repository) = ($config->get_cvs_server_method(),
-                                                   $config->get_cvs_server_id(),
-                                                   $config->get_cvs_server(),
-                                                   $config->get_cvs_server_repository());
-    }
-
-    return undef if  !($method && $vcsid && $server && $repository);
-
-    $cvs_module->module($module);
-    $cvs_module->cvs_method($method);
-    $cvs_module->vcsid($vcsid);
-    $cvs_module->cvs_server($server);
-    $cvs_module->cvs_repository($repository);
-
-    return $cvs_module;
-}
-
-# Return Cvs object for passed file.
-sub get_cvs_archive
-{
-    my $file = shift;
-
-    my $cvs_archive = Cvs->new();
-    $cvs_archive->name($file);
-
-    return $cvs_archive;
-}
-
-# Find out which CVS server holds the module, returns
-# the elements of CVSROOT.
-sub get_cvs_root
-{
-    require EnvHelper; import EnvHelper;
-    my $cws    = shift;
-    my $module = shift;
-
-    my $master = $cws->master();
-
-    my $vcsid = $ENV{VCSID};
-    if ( !$vcsid ) {
-        print_error("Can't determine VCSID. Please use setsolar.", 5);
-    }
-
-    my $workspace_db = EnvHelper::get_workspace_db();
-    if ( !$workspace_db ) {
-        print_error("Can't load workspace database.", 4);
-    }
-
-    my $key = "$master/drives/o:/projects/$module/scs";
-    my $cvsroot = $workspace_db->get_value($key);
-
-    if ( !$cvsroot  ) {
-        print_error("No such module '$module' for '$master' in workspace database.", 0);
-        return (undef, undef, undef, undef);
-    }
-
-    my ($dummy1, $method, $user_at_server, $repository) = split(/:/, $cvsroot);
-    $repository =~ s/^\d*//;
-    my ($dummy2, $server) = split(/@/, $user_at_server);
-
-    if ( ! ($method && $server && $repository ) ) {
-        print_error("Can't determine CVS server for module '$module'.", 0);
-        return (undef, undef, undef, undef);
-    }
-
-    return ($method, $vcsid, $server, $repository);
-}
-
-sub plog
-{
-    my $message = shift;
-
-    push(@problem_log, $message);
-}
-
-sub print_plog
-{
-    if ( @problem_log ) {
-        print_message("========== Problem Log ==========");
-        foreach ( @problem_log ) {
-            print "\t$_\n";
-        }
-        print_message("========== End Problem Log ==========");
-    }
-}
-
-sub auto_int
-{
-    my $ai_cws = shift;
-    my $ai_dir = shift;
-    my @ai_modules = @_;
-    print "\n**** starting with automatic integration after successful analyses.****\n" if (! $opt_quiet);
-
-    # ... more stuff
-    my $conflicts = 1;
-    my $alarms    = 1;
-    ($conflicts,$alarms) = analyze($ai_cws, $ai_dir, @ai_modules);
-    $alarms = &check_alarms($alarms) if ($alarms > 0);
-    if ( $conflicts + $alarms == 0 ) {
-        print "no conflicts or alarms are shown during analyses.\n" if (! $opt_quiet);
-        print "starting integration...\n" if (! $opt_quiet);
-        # remove directory
-        if ( $ai_dir ne cwd() )
-	{
-        	system("rm -rf $ai_dir");
-        	print_error("Can't remove directory '$ai_dir'", 6)  if (-e $ai_dir );
-        	mkdir ($ai_dir,0775);
-        	print_error("Can't mkdir() to '$ai_dir'", 6) if ( !-e $ai_dir );
-	} else
-	{
-        	system("rm -rf *");
-	}
-        integrate($ai_cws, $ai_dir, @ai_modules);
-        my @final_log = &check_status_plog($ai_dir);    # can't commit changes
-        if ( scalar(@final_log) > 0 ) {
-            print "====================== Final Problem Log =====================\n";
-            foreach my $problem(@final_log)
-            {
-                print "$problem\n"
-            }
-            print "==============================================================\n";
-        } else
-        {
-            print "\n**************** All can't commit changes problems are resolved. ****************\n";
-            print "****************        No further problems are known            ****************\n";
-        }
-    } else
-    {
-	&print_plog();
-        print STDERR "Conflicts and/or alarms occured during analysis.\n";
-        print STDERR "Can't continue...... Bye!\n";
-    }
-    exit;
-}
-
-sub prompt_manual_registration
-{
-    return unless ($sointernal);
-    my $cws_name = shift;
-    my $mws_name = shift;
-    my @files = @_;
-    print_warning( "Could not register all files to EIS. Please manually call");
-    foreach my $file ( @files ) {
-        print STDERR "\tperl \$COMMON_ENV_TOOLS/cwsaddfile.pl -c $cws_name -m $mws_name $file\n";
-    }
-}
-
-sub check_alarms
-{
-	my $alarms = shift;
-	foreach my $line(@problem_log)
-	{
-	    if ($line =~ /def\sfile\sdetected/g)
-	    {
-	    	print "ignoreing def file alarm....\n";
-		$alarms--;
-	    }
-	}
-	return $alarms;
-}
-
-sub check_status_plog
-{
-    # cvs status file -> "up to date"? -> ok!
-
-    my $ai_dir          = shift;
-    my $problem;
-    my @final_problem_log = ();
-
-    print "Checking CVS status of files which can't be commited.....\n" if (! $opt_quiet);
-    foreach $problem(@problem_log) {                        # @problem_log is global defined!
-        my @result = split(":",$problem);
-        if ( $result[1] =~ "can't commit changes!" ) {
-            $result[0] =~ s/^\s+//;   # remove leading blanks
-            my @result2 = split("/",$result[0]);
-            my $module = $result2[0];             # get module name
-            $result[0] =~ s/^$module\///g;        # get rest of the file path
-            if (!chdir("$ai_dir/$module") ) {
-                my $test = cwd();
-                print STDERR "Check Status: CWD=$test\n";
-                if ( $test !~ /.+$dir\/$module$/) {
-                    print_error("Check Status: Can't chdir() to '$dir/$module'", 6);
-                }
-            }
-
-            my $cvs_archive = get_cvs_archive($result[0]);
-            my ($status, $working_rev, $repository_rev, $sticky_tag, $branch_rev,
-                    $sticky_date, $sticky_options) = $cvs_archive->status();
-            if ( $status =~ /Up-to-date/ ) {      # OK!
-                next;
-            } else
-            {
-                push(@final_problem_log,($problem . "    CVS Status:$status"));
-            }
-        } else
-        {
-            # conflicts and other problems
-            push(@final_problem_log, $problem);
-        }
-    }
-    return @final_problem_log;
-}   ##check_status
-
-sub print_message
-{
-    my $message     = shift;
-
-    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;
-}
-
-sub usage
-{
-    if ( $mode eq 'cwsintegrate' ) {
-        print STDERR "Usage: cwsintegrate [-h] [-d dir] [-q] [-F] <all|module> ... \n";
-        print STDERR "Integrate one or more child workspace modules into master workspace.\n";
-        print STDERR "Options:\n";
-        print STDERR "\t-h \tprint this help\n";
-        print STDERR "\t-d dir\tscratch space\n";
-        print STDERR "\t-q \tdo not set child workspace status to 'integrated'\n";
-        print STDERR "\t-F\tdo integration even if status is already 'integrated'\n";
-        print STDERR "\t-A\trun cwsanalyze previously and integrate automatically when no conflicts or alerts are shown.\n";
-        print STDERR "\t  \tCheck files with 'can't commit changes' message after integration automatically.\n";
-        print STDERR "\t-z\tminimial output (quiet mode)\n";
-    }
-    else {
-        print STDERR "Usage: cwsanalyze [-h] [-d dir] [-n] <all|module> ... \n";
-        print STDERR "Analyze one or more child workspace modules.\n";
-        print STDERR "Options:\n";
-        print STDERR "\t-h \tprint this help\n";
-        print STDERR "\t-d dir\tscratch space\n";
-        print STDERR "\t-n\tdisable conflict check (no need for checkout)\n";
-        print STDERR "The -d and -n options are mutually exclusive.\n";
-    }
-}

File solenv/bin/cwsclone

-#!/bin/sh
-if [ x${SOLARENV}x = xx ]; then
-    echo No environment found, please use 'configure' or 'setsolar'
-    exit 1
-fi
-exec perl -w $SOLARENV/bin/cwsclone.pl "$@"

File solenv/bin/cwsclone.pl

-:
-eval 'exec perl -wS $0 ${1+"$@"}'
-    if 0;