xref: /aoo41x/main/solenv/bin/cwstouched.pl (revision af750e96)
1:
2eval 'exec perl -wS $0 ${1+"$@"}'
3    if 0;
4
5#*************************************************************************
6# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7#
8# Copyright 2000, 2010 Oracle and/or its affiliates.
9#
10# OpenOffice.org - a multi-platform office productivity suite
11#
12# This file is part of OpenOffice.org.
13#
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.
17#
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).
23#
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#
29#***********************************************************************/
30
31use strict;
32use Cwd;
33
34#### module lookup
35my @lib_dirs;
36BEGIN {
37    if ( !defined($ENV{SOLARENV}) ) {
38        die "No environment found (environment variable SOLARENV is undefined)";
39    }
40    push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
41}
42use lib (@lib_dirs);
43
44use Cws;
45
46# Prototypes
47sub getMinor($);
48sub getCwsWorkStamp();
49
50my $workstamp = $ENV{'WORK_STAMP'};
51my $solenv= $ENV{'SOLARENV'};
52my $cwsWorkStamp = getCwsWorkStamp();
53my $minor = getMinor($cwsWorkStamp);
54
55my $oldWorkStamp = $workstamp."_".$minor;
56my $svndiff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/".$oldWorkStamp." --new=svn://svn.services.openoffice.org/ooo/cws/".$cwsWorkStamp;
57
58my @diff = `$svndiff`;
59
60my @modules;
61foreach(@diff)
62{
63    if (/.*svn:\/\/svn.services.openoffice.org.*/)
64    {
65        $_ =~ /.*$oldWorkStamp\/(\w*)/;
66        my $newModule=$1;
67        if (defined($newModule))
68        {
69            if ( ! grep(/$newModule/,@modules))
70            {
71                push(@modules, $newModule);
72            }
73
74        }
75    }
76}
77
78foreach(@modules)
79{
80    print "$_\n";
81}
82
83exit(0);
84
85sub getMinor($)
86{
87    my $workst = shift;
88    my $min="";
89
90    if ( ! defined($ENV{'UPDMINOR'}))
91    {
92        my $cws = Cws->new();
93        $cws->child($workst);
94        $cws->master($ENV{'WORK_STAMP'});
95        my $masterws = $cws->master();
96        my $childws  = $cws->child();
97
98        # check if we got a valid child workspace
99        my $id = $cws->eis_id();
100        if ( !$id )
101        {
102            print("Child workspace '$childws' for master workspace '$masterws' not found in EIS database.\n");
103            exit(1);
104        }
105
106        my @milestones = $cws->milestone();
107        foreach (@milestones) {
108            if ( defined($_) )
109            {
110                $min=$_;
111            }
112        }
113    }
114    else
115    {
116        $min = $ENV{'UPDMINOR'};
117    }
118
119    chomp($min);
120    return $min;
121}
122
123sub getCwsWorkStamp()
124{
125    my $cwsWorkSt="";
126
127    if ( ! defined($ENV{'CWS_WORK_STAMP'}))
128    {
129        my $currPath= cwd;
130
131        chdir($ENV{'SOLARENV'});
132
133        my @info = `svn info`;
134
135        foreach(@info)
136        {
137            if ( /URL:.*/ )
138            {
139                # URL: svn+ssh://svn@svn.services.openoffice.org/ooo/cws/qadev37/solenv
140                $_ =
140~ /.*svn.services.openoffice.org(.*\/(.*))\/\w*/;
141                $cwsWorkSt=$2; #qadev37
142            }
143        }
144
145    }
146    else
147    {
148        $cwsWorkSt = $ENV{'CWS_WORK_STAMP'};
149    }
150    return $cwsWorkSt
151}
152