xref: /aoo41x/main/solenv/bin/cwstouched.pl (revision 7e90fac2)
1af750e96SMathias Bauer:
2af750e96SMathias Bauereval 'exec perl -wS $0 ${1+"$@"}'
3af750e96SMathias Bauer    if 0;
4af750e96SMathias Bauer
5*7e90fac2SAndrew Rist#**************************************************************
6*7e90fac2SAndrew Rist#
7*7e90fac2SAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
8*7e90fac2SAndrew Rist#  or more contributor license agreements.  See the NOTICE file
9*7e90fac2SAndrew Rist#  distributed with this work for additional information
10*7e90fac2SAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
11*7e90fac2SAndrew Rist#  to you under the Apache License, Version 2.0 (the
12*7e90fac2SAndrew Rist#  "License"); you may not use this file except in compliance
13*7e90fac2SAndrew Rist#  with the License.  You may obtain a copy of the License at
14*7e90fac2SAndrew Rist#
15*7e90fac2SAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
16*7e90fac2SAndrew Rist#
17*7e90fac2SAndrew Rist#  Unless required by applicable law or agreed to in writing,
18*7e90fac2SAndrew Rist#  software distributed under the License is distributed on an
19*7e90fac2SAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20*7e90fac2SAndrew Rist#  KIND, either express or implied.  See the License for the
21*7e90fac2SAndrew Rist#  specific language governing permissions and limitations
22*7e90fac2SAndrew Rist#  under the License.
23*7e90fac2SAndrew Rist#
24*7e90fac2SAndrew Rist#**************************************************************
25af750e96SMathias Bauer
26af750e96SMathias Baueruse strict;
27af750e96SMathias Baueruse Cwd;
28af750e96SMathias Bauer
29af750e96SMathias Bauer#### module lookup
30af750e96SMathias Bauermy @lib_dirs;
31af750e96SMathias BauerBEGIN {
32af750e96SMathias Bauer    if ( !defined($ENV{SOLARENV}) ) {
33af750e96SMathias Bauer        die "No environment found (environment variable SOLARENV is undefined)";
34af750e96SMathias Bauer    }
35af750e96SMathias Bauer    push(@lib_dirs, "$ENV{SOLARENV}/bin/modules");
36af750e96SMathias Bauer}
37af750e96SMathias Baueruse lib (@lib_dirs);
38af750e96SMathias Bauer
39af750e96SMathias Baueruse Cws;
40af750e96SMathias Bauer
41af750e96SMathias Bauer# Prototypes
42af750e96SMathias Bauersub getMinor($);
43af750e96SMathias Bauersub getCwsWorkStamp();
44af750e96SMathias Bauer
45af750e96SMathias Bauermy $workstamp = $ENV{'WORK_STAMP'};
46af750e96SMathias Bauermy $solenv= $ENV{'SOLARENV'};
47af750e96SMathias Bauermy $cwsWorkStamp = getCwsWorkStamp();
48af750e96SMathias Bauermy $minor = getMinor($cwsWorkStamp);
49af750e96SMathias Bauer
50af750e96SMathias Bauermy $oldWorkStamp = $workstamp."_".$minor;
51af750e96SMathias Bauermy $svndiff="svn diff --summarize --old=svn://svn.services.openoffice.org/ooo/tags/".$oldWorkStamp." --new=svn://svn.services.openoffice.org/ooo/cws/".$cwsWorkStamp;
52af750e96SMathias Bauer
53af750e96SMathias Bauermy @diff = `$svndiff`;
54af750e96SMathias Bauer
55af750e96SMathias Bauermy @modules;
56af750e96SMathias Bauerforeach(@diff)
57af750e96SMathias Bauer{
58af750e96SMathias Bauer    if (/.*svn:\/\/svn.services.openoffice.org.*/)
59af750e96SMathias Bauer    {
60af750e96SMathias Bauer        $_ =~ /.*$oldWorkStamp\/(\w*)/;
61af750e96SMathias Bauer        my $newModule=$1;
62af750e96SMathias Bauer        if (defined($newModule))
63af750e96SMathias Bauer        {
64af750e96SMathias Bauer            if ( ! grep(/$newModule/,@modules))
65af750e96SMathias Bauer            {
66af750e96SMathias Bauer                push(@modules, $newModule);
67af750e96SMathias Bauer            }
68af750e96SMathias Bauer
69af750e96SMathias Bauer        }
70af750e96SMathias Bauer    }
71af750e96SMathias Bauer}
72af750e96SMathias Bauer
73af750e96SMathias Bauerforeach(@modules)
74af750e96SMathias Bauer{
75af750e96SMathias Bauer    print "$_\n";
76af750e96SMathias Bauer}
77af750e96SMathias Bauer
78af750e96SMathias Bauerexit(0);
79af750e96SMathias Bauer
80af750e96SMathias Bauersub getMinor($)
81af750e96SMathias Bauer{
82af750e96SMathias Bauer    my $workst = shift;
83af750e96SMathias Bauer    my $min="";
84af750e96SMathias Bauer
85af750e96SMathias Bauer    if ( ! defined($ENV{'UPDMINOR'}))
86af750e96SMathias Bauer    {
87af750e96SMathias Bauer        my $cws = Cws->new();
88af750e96SMathias Bauer        $cws->child($workst);
89af750e96SMathias Bauer        $cws->master($ENV{'WORK_STAMP'});
90af750e96SMathias Bauer        my $masterws = $cws->master();
91af750e96SMathias Bauer        my $childws  = $cws->child();
92af750e96SMathias Bauer
93af750e96SMathias Bauer        # check if we got a valid child workspace
94af750e96SMathias Bauer        my $id = $cws->eis_id();
95af750e96SMathias Bauer        if ( !$id )
96af750e96SMathias Bauer        {
97af750e96SMathias Bauer            print("Child workspace '$childws' for master workspace '$masterws' not found in EIS database.\n");
98af750e96SMathias Bauer            exit(1);
99af750e96SMathias Bauer        }
100af750e96SMathias Bauer
101af750e96SMathias Bauer        my @milestones = $cws->milestone();
102af750e96SMathias Bauer        foreach (@milestones) {
103af750e96SMathias Bauer            if ( defined($_) )
104af750e96SMathias Bauer            {
105af750e96SMathias Bauer                $min=$_;
106af750e96SMathias Bauer            }
107af750e96SMathias Bauer        }
108af750e96SMathias Bauer    }
109af750e96SMathias Bauer    else
110af750e96SMathias Bauer    {
111af750e96SMathias Bauer        $min = $ENV{'UPDMINOR'};
112af750e96SMathias Bauer    }
113af750e96SMathias Bauer
114af750e96SMathias Bauer    chomp($min);
115af750e96SMathias Bauer    return $min;
116af750e96SMathias Bauer}
117af750e96SMathias Bauer
118af750e96SMathias Bauersub getCwsWorkStamp()
119af750e96SMathias Bauer{
120af750e96SMathias Bauer    my $cwsWorkSt="";
121af750e96SMathias Bauer
122af750e96SMathias Bauer    if ( ! defined($ENV{'CWS_WORK_STAMP'}))
123af750e96SMathias Bauer    {
124af750e96SMathias Bauer        my $currPath= cwd;
125af750e96SMathias Bauer
126af750e96SMathias Bauer        chdir($ENV{'SOLARENV'});
127af750e96SMathias Bauer
128af750e96SMathias Bauer        my @info = `svn info`;
129af750e96SMathias Bauer
130af750e96SMathias Bauer        foreach(@info)
131af750e96SMathias Bauer        {
132af750e96SMathias Bauer            if ( /URL:.*/ )
133af750e96SMathias Bauer            {
134af750e96SMathias Bauer                # URL: svn+ssh://svn@svn.services.openoffice.org/ooo/cws/qadev37/solenv
135*7e90fac2SAndrew Rist                $_ =
136*7e90fac2SAndrew Rist~ /.*svn.services.openoffice.org(.*\/(.*))\/\w*/;
137af750e96SMathias Bauer                $cwsWorkSt=$2; #qadev37
138af750e96SMathias Bauer            }
139af750e96SMathias Bauer        }
140af750e96SMathias Bauer
141af750e96SMathias Bauer    }
142af750e96SMathias Bauer    else
143af750e96SMathias Bauer    {
144af750e96SMathias Bauer        $cwsWorkSt = $ENV{'CWS_WORK_STAMP'};
145af750e96SMathias Bauer    }
146af750e96SMathias Bauer    return $cwsWorkSt
147af750e96SMathias Bauer}
148