Update ooo320-m1
[ooovba.git] / solenv / bin / cwstouched.pl
blob4b2f09f5a524a0f20182ab9b31b688b1e1d2363a
2 eval 'exec perl -wS $0 ${1+"$@"}'
3 if 0;
5 #*************************************************************************
6 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7 #
8 # Copyright 2008 by Sun Microsystems, Inc.
10 # OpenOffice.org - a multi-platform office productivity suite
12 # This file is part of OpenOffice.org.
14 # OpenOffice.org is free software: you can redistribute it and/or modify
15 # it under the terms of the GNU Lesser General Public License version 3
16 # only, as published by the Free Software Foundation.
18 # OpenOffice.org is distributed in the hope that it will be useful,
19 # but WITHOUT ANY WARRANTY; without even the implied warranty of
20 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 # GNU Lesser General Public License version 3 for more details
22 # (a copy is included in the LICENSE file that accompanied this code).
24 # You should have received a copy of the GNU Lesser General Public License
25 # version 3 along with OpenOffice.org. If not, see
26 # <http://www.openoffice.org/license.html>
27 # for a copy of the LGPLv3 License.
28 #***********************************************************************/
30 use strict;
31 use Cwd;
33 #### module lookup
34 my @lib_dirs;
35 BEGIN {
36 if ( !defined($ENV{SOLARENV}) ) {
37 die "No environment found (environment variable SOLARENV is undefined)";
39 push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
41 use lib (@lib_dirs);
43 use Cws;
45 # Prototypes
46 sub getMinor($);
47 sub getCwsWorkStamp();
49 my $workstamp = $ENV{'WORK_STAMP'};
50 my $solenv= $ENV{'SOLARENV'};
51 my $cwsWorkStamp = getCwsWorkStamp();
52 my $minor = getMinor($cwsWorkStamp);
54 my $oldWorkStamp = $workstamp."_".$minor;
55 my $svndiff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/".$oldWorkStamp." --new=svn://svn.services.openoffice.org/ooo/cws/".$cwsWorkStamp;
57 my @diff = `$svndiff`;
59 my @modules;
60 foreach(@diff)
62 if (/.*svn:\/\/svn.services.openoffice.org.*/)
64 $_ =~ /.*$oldWorkStamp\/(\w*)/;
65 my $newModule=$1;
66 if (defined($newModule))
68 if ( ! grep(/$newModule/,@modules))
70 push(@modules, $newModule);
77 foreach(@modules)
79 print "$_\n";
82 exit(0);
84 sub getMinor($)
86 my $workst = shift;
87 my $min="";
89 if ( ! defined($ENV{'UPDMINOR'}))
91 my $cws = Cws->new();
92 $cws->child($workst);
93 $cws->master($ENV{'WORK_STAMP'});
94 my $masterws = $cws->master();
95 my $childws = $cws->child();
97 # check if we got a valid child workspace
98 my $id = $cws->eis_id();
99 if ( !$id )
101 print("Child workspace '$childws' for master workspace '$masterws' not found in EIS database.\n");
102 exit(1);
105 my @milestones = $cws->milestone();
106 foreach (@milestones) {
107 if ( defined($_) )
109 $min=$_;
113 else
115 $min = $ENV{'UPDMINOR'};
118 chomp($min);
119 return $min;
122 sub getCwsWorkStamp()
124 my $cwsWorkSt="";
126 if ( ! defined($ENV{'CWS_WORK_STAMP'}))
128 my $currPath= cwd;
130 chdir($ENV{'SOLARENV'});
132 my @info = `svn info`;
134 foreach(@info)
136 if ( /URL:.*/ )
138 # URL: svn+ssh://svn@svn.services.openoffice.org/ooo/cws/qadev37/solenv
139 $_ = ~ /.*svn.services.openoffice.org(.*\/(.*))\/\w*/;
140 $cwsWorkSt=$2; #qadev37
145 else
147 $cwsWorkSt = $ENV{'CWS_WORK_STAMP'};
149 return $cwsWorkSt