Subversion Repositories DevTools

Rev

Rev 4362 | Rev 5710 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4362 Rev 4382
Line 31... Line 31...
31
my $opt_help = 0;
31
my $opt_help = 0;
32
my $opt_delete;
32
my $opt_delete;
33
my $opt_age = 1;
33
my $opt_age = 1;
34
my $opt_user;
34
my $opt_user;
35
my $opt_buildadm = 0;
35
my $opt_buildadm = 0;
-
 
36
my $opt_region = '';
36
 
37
 
37
my @vlist;
38
my @vlist;
38
my $now = time;
39
my $now = time;
39
 
40
 
40
#-------------------------------------------------------------------------------
41
#-------------------------------------------------------------------------------
Line 50... Line 51...
50
            "verbose|v:+"       => \$opt_verbose,
51
            "verbose|v:+"       => \$opt_verbose,
51
            "delete"            => \$opt_delete,
52
            "delete"            => \$opt_delete,
52
            "age=i"             => \$opt_age,
53
            "age=i"             => \$opt_age,
53
            "user=s"            => \$opt_user,
54
            "user=s"            => \$opt_user,
54
            "buildviews"        => \$opt_buildadm,
55
            "buildviews"        => \$opt_buildadm,
-
 
56
            "region=s"          => \$opt_region,
55
 
57
 
56
            );
58
            );
57
 
59
 
58
            #
60
            #
59
            #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
61
            #   UPDATE THE DOCUMENTATION AT THE END OF THIS FILE !!!
Line 93... Line 95...
93
if ( $opt_buildadm )
95
if ( $opt_buildadm )
94
{
96
{
95
    $opt_user = '_[0-9]{10,}_';
97
    $opt_user = '_[0-9]{10,}_';
96
}
98
}
97
 
99
 
-
 
100
if ($opt_region)
-
 
101
{
-
 
102
    $opt_region = ' -region ' . $opt_region;
-
 
103
}
-
 
104
 
98
#
105
#
99
#   Scan for views
106
#   Scan for views
100
#
107
#
101
my $cmd = "cleartool lsview";
108
my $cmd = "cleartool lsview $opt_region";
102
Verbose2($cmd);
109
Verbose2($cmd);
103
Verbose2("User: $opt_user");
110
Verbose2("User: $opt_user");
104
open(SHOWCMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
111
open(SHOWCMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
105
while (<SHOWCMD>)
112
while (<SHOWCMD>)
106
{
113
{
Line 116... Line 123...
116
#    next unless ( m~jzhou1_~ );
123
#    next unless ( m~jzhou1_~ );
117
#    next unless ( m~_build_~ );
124
#    next unless ( m~_build_~ );
118
#    next unless ( m~buildadm_AUPERA~ );
125
#    next unless ( m~buildadm_AUPERA~ );
119
 
126
 
120
    my @data = split (' ' );
127
    my @data = split (' ' );
121
    Verbose ("View: $data[0]");
128
    Verbose ("View: '$data[0]'");
122
    push @vlist, $data[0];
129
    push @vlist, $data[0];
123
}
130
}
124
close(SHOWCMD);
131
close(SHOWCMD);
125
 
132
 
126
#
133
#
Line 130... Line 137...
130
{
137
{
131
 
138
 
132
    Verbose ("Process View: $view");
139
    Verbose ("Process View: $view");
133
    my $uuid;
140
    my $uuid;
134
    my $view_tag_uuid;
141
    my $view_tag_uuid;
135
    my $cmd = "cleartool lsview -age $view";
142
    my $cmd = "cleartool lsview -age $opt_region $view";
136
    Verbose2($cmd);
143
    Verbose2($cmd);
137
    open(SHOWCMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
144
    open(SHOWCMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
138
    my @text = <SHOWCMD>;
145
    my @text = <SHOWCMD>;
139
    close(SHOWCMD);
146
    close(SHOWCMD);
140
 
147
 
Line 165... Line 172...
165
        {
172
        {
166
            print "Skip view. Too new\n";
173
            print "Skip view. Too new\n";
167
        }
174
        }
168
        else
175
        else
169
        {
176
        {
170
           ClearTool ("rmview -force -tag $view");
177
           ClearTool ("rmview -force -tag \"$view\"");
171
 
178
 
172
            #
179
            #
173
            #   If the view tag still exists then delete the view the hard way
180
            #   If the view tag still exists then delete the view the hard way
174
            #   Use 'lsview' to locate the views uuid
181
            #   Use 'lsview' to locate the views uuid
175
            #
182
            #
176
            Verbose("Look for View Tag");
183
            Verbose("Look for View Tag");
177
            my $cmd = "cleartool lsview -long $view";
184
            my $cmd = "cleartool lsview -long \"$view\"";
178
            open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
185
            open(CMD, "$cmd 2>&1 |") || Error( "can't run command: $!");
179
            while (<CMD>)
186
            while (<CMD>)
180
            {
187
            {
181
                #
188
                #
182
                #   Filter output from the user
189
                #   Filter output from the user
Line 191... Line 198...
191
            if ( $uuid )
198
            if ( $uuid )
192
            {
199
            {
193
                Warning ("Deleting view - the hard way");
200
                Warning ("Deleting view - the hard way");
194
                ClearTool( "--Quiet", "rmview -force -all -uuid $uuid" );
201
                ClearTool( "--Quiet", "rmview -force -all -uuid $uuid" );
195
                ClearTool( "--Quiet", "unregister -view -uuid $uuid" );
202
                ClearTool( "--Quiet", "unregister -view -uuid $uuid" );
196
                ClearTool( "--Quiet", "rmtag -view -all $view" );
203
                ClearTool( "--Quiet", "rmtag -view -all \"$view\"" );
197
            }
204
            }
198
            elsif ($view_tag_uuid)
205
            elsif ($view_tag_uuid)
199
            {
206
            {
200
                ClearTool( "--Quiet", "rmtag -view -all $view" );
207
                ClearTool( "--Quiet", "rmtag -view -all \"$view\"" );
201
            }
208
            }
202
        }
209
        }
203
    }
210
    }
204
}
211
}
205
 
212
 
Line 303... Line 310...
303
    -verbose[=n]        - Verbose operation
310
    -verbose[=n]        - Verbose operation
304
    -delete             - Delete the views. Default is to list.
311
    -delete             - Delete the views. Default is to list.
305
    -age=nn             - Only older than nn days (default1 1)
312
    -age=nn             - Only older than nn days (default1 1)
306
    -user=text          - Only a users views. default current user
313
    -user=text          - Only a users views. default current user
307
    -buildviews         - Only views created by the build daemon
314
    -buildviews         - Only views created by the build daemon
-
 
315
    -region=region      - Specify ClearCase Region
308
 
316
 
309
=head1 OPTIONS
317
=head1 OPTIONS
310
 
318
 
311
=over 8
319
=over 8
312
 
320