• Home
  • Services
    • Consultancy
    • Custom Software Solutions
    • Systems Adminsitration
    • SCM
      • Clearcase
      • Multisite
      • Clearquest
      • Release Managment
      • CVS
    • Web Applications
    • Customers
  • Publications
    • Clearcase
      • Triggers
      • Open Source Builds
    • Clearquest
      • Clearquest Daemon
      • DB Conversions
    • Systems Admin
      • Unix/Linux
      • Windows
    • Scripting
      • Perl
      • PHP
      • ECRDig
  • About
    • Services
    • Our People
    • Our Philosophy
    • Contact Us
 

ClearSCM Inc.

You are viewing an unstyled version of this page. Either your browser does not support Cascading Style Sheets (CSS) or CSS styling has been disabled.

Releasenotes.cgi Code Listing

\n";
1 #!/usr/bin/perl
2 ################################################################################
3 #
4 # File:         releasenotes.cgi,v
5 # Revision:     1.1.1.1
6 # Description:  Produce an HTML table of bugs for a release page
7 # Author:       Andrew@DeFaria.com
8 # Created:      Fri May 31 15:34:50  2002
9 # Modified:     2007/05/17 07:45:48
10 # Language:     Perl
11 #
12 # (c) Copyright 2007, ClearSCM, Inc., all rights reserved.
13 #
14 ################################################################################
15 use strict;
16 use CGI qw/:standard *table/;
17 use Cwd;
18 use lib qw(//sonscentral/users/adefaria/www/cgi-bin);
19 use cqc;
20
21 %cqc::fields;
22 $cqc::command;
23
24 my $page = new CGI;
25
26 my $release = $page->param ("release");
27 my @intro_notes;
28 my @buglines;
29
30 # Colors
31 my $header_background = "#ffffcc";
32 my $header_foreground = "#000000";
33 my $data_background   = "#ffffff";
34 my $data_foreground   = "#000000";
35
36 sub Error;
37 sub Footing;
38
39 sub ReleaseForm {
40   print
41     start_form ({-action => "/Release/releasenotes.cgi",
42                  -method => "post"}) . 
43       h4 ("Look up other Release:",
44           textfield ({-name  => "release",
45                       -size  => 12,
46                       -value => "Please specify"}),
47           submit ({-value => "Display"})
48            ) . end_form . "\n";
49 } # ReleaseForm
50
51 sub Heading {
52   my $release = shift;
53
54   if ($release) {
55     print header     (-title   => "Release $release")          . "\n" .
56           start_html (-title   => "Release $release",
57                       -author  => "Andrew\@DeFaria.com",
58                       -link    => "#0000ee",
59                       -vlink   => "#cc33cc",
60                       -alink   => "#ff0000",
61                       -bgcolor => "#eeffff",
62                       -text    => "#000000",
63                       -script  => {-language => "JavaScript1.2",
64                                    -src      => "/Javascript/Heading.js"}),
65           p          ({-align => "right"},
66                      a ({-href => "/Release/addbug"}, "Add a bug to a release") . "\n" . br
67                      a ({-href => "file://///sons-clearcase/Views/official/Tools/bin/clearcase/triggers/data/rel_2.2.lst"}, "Official US 2.2 list") . "\n" . br
68                      a ({-href => "file://///sons-cc/Views/official/Tools/bin/clearcase/triggers/data/china_2.2.lst"}, "Official Shanghai 2.2 list")) . "\n" .
69           h1         ({-align=>"CENTER"}, "Release $release") . "\n" .
70           h2         ("Introduction")                         . "\n";
71   } else {
72     print header     (-title  => "Release $release")          . "\n" .
73           start_html (-title  => "Release $release",
74                       -author => "Andrew\@DeFaria.com")                . "\n";
75     Error "Release not specified!";
76   } # if
77 } # Heading
78
79 sub Footing {
80   ReleaseForm;
81   print script ({-language => "JavaScript1.2",
82                  -src      => "/JavaScript/Footing.js"}) . "\n";
83   print end_html;
84 } # Footing
85
86 sub PrintIntroNotes {
87   (scalar (@intro_notes) == 0) ? return : print ul (@intro_notes) . "\n";
88 } # PrintIntroNotes
89
90 sub LockedLabel {
91   my $bugid = shift;
92
93   # We need to set a view context. Use the official view
94   my $cwd = cwd;
95
96   my $vob_server = "sons-clearcase";
97   my $view_path  = "Views";
98   my $view_name  = "official";
99   my $vob        = "salira";
100   my $official_view = '\\\\'       .
101                       $vob_server  .
102                       '\\'         .
103                       $view_path   .
104                       '\\'         .
105                       $view_name   .
106                       '\\'         .
107                       $vob;
108
109   chdir $official_view or die "Unable to set view context";
110   my $output = `cleartool lslock -short lbtype:$bugid`;
111   chomp $output;
112   chdir $cwd or die "Unable to return from view context\n";
113
114   # lslock returns the label if it is locked, otherwise it returns
115   # an empty string
116   return $output;
117 } # LabelLocked
118
119 sub ParseBugFile {
120   my $buglist = shift;
121   my ($result, $owner, $description, $bugid, $state, $line);
122   my $bugnbr = 0;
123   my $locked;
124
125   open BUGLIST, "$buglist" or Error "Unable to open buglist: $buglist";
126
127   while ($line = ) {
128     next if $line =~ /^\#/;     # Skip comments
129     chomp $line;
130     if ($line =~ /^\*/) {
131       ($result, $line) = split (/\* /, $line);
132       push (@intro_notes, li ([$line]) . "\n");
133     } else {
134       ($bugid) = split (/\s+/, $line);
135       $result = cqc::GetBugRecord ($bugid, %fields);
136       ($result <= 0) ? $owner = "Unknown" : $owner = $fields {owner};
137       if ($result < 0) {
138         $description = "Unable to connect to server!";
139       } elsif ($result > 0) {
140         $description = "Bug ID not found in Clearquest!";
141       } else {
142         # Description's too large. Use headline instead.
143         $description = $fields {headline};
144       } # if
145
146       if (LockedLabel ($bugid)) {
147         $locked = img ({-src => "/Images/CheckMark.gif"});
148       } else {
149         $locked = " ";
150       } #if
151
152       if ($fields {state} eq "Verified" or $fields {state} eq "Closed") {
153         $state = $fields {state};
154         $locked = img ({-src => "/Images/CheckMark.gif"});
155       } else {
156         $state = b (font ({-color => "Red"}, $fields {state}));
157       } # if
158
159       push (@buglines,
160         td ({-width   => "25",
161              -align   => "center",
162              -bgcolor => $data_background},
163             small ++$bugnbr) .
164         td ({-bgcolor => $data_background},
165             small (a ({-href => "/cgi-bin/bugdetails.cgi?bugid=$bugid"}, $bugid))) .
166         td ({-bgcolor => $data_background},
167             small $state) .
168         td ({-align   => "center",
169              -bgcolor => $data_background},
170             small (a ({-href => "mailto:$owner\@salira.com"}, $owner))) .
171         td ({-align   => "center",
172              -valign  => "center",
173              -bgcolor => $data_background},
174             $locked) . 
175         td ({-bgcolor => $data_background},
176             small $description) . "\n");
177     } # if
178   } # while
179 } # ParseBugFile
180
181 sub PrintBugTable {
182   if (scalar (@buglines) == 0) {
183     print h3 ("No bugs found!");
184   } else {
185     my $bugs = (scalar (@buglines) > 1) ? " bugs" : " bug";
186     print "\n";
187     print caption (small (strong (scalar (@buglines) . $bugs . " in this release"))) . "\n";
188     print "
189     print start_table({-align       => "center",
190                        -border      => 1,
191                        -cellspacing => 1,
192                        -cellpadding => 2,
193                        -width       => "100%"}) . "\n" .
194       Tr ({-valign => "top", -bgcolor => $header_background}, [
195         th ({-width => "25"}, 
196              font ({-color => $header_foreground}, small ("#"))) .
197         th (font ({-color => $header_foreground}, small ("Bug ID"))) .
198         th (font ({-color => $header_foreground}, small ("State"))) .
199         th (font ({-color => $header_foreground}, small ("Owner"))) .
200         th (font ({-color => $header_foreground}, small ("Locked?"))) .
201         th (font ({-color => $header_foreground}, small ("Description")))
202         ]) . "\n" .  
203       Tr({-valign=>"TOP"}, \@buglines) . "\n" .
204       end_table . "\n" .
205       end_table;
206   } # if
207 } # PrintBugTable
208
209 sub Error {
210   my $errmsg = shift;
211   print h3 ({-style => "Color: red;",
212              -align => "CENTER"}, "ERROR: " . $errmsg);
213   Footing;
214   exit 1;
215 } # Error
216
217 # Main
218 Heading $release;
219 if ($release) {
220   ParseBugFile ($release . ".bugs");
221   PrintIntroNotes (@intro_notes);
222   PrintBugTable (@buglines);
223   Footing;
224 } # if

Last modified: March 28 2008 @ 8:50 am
Copyright © 2010, ClearSCM Inc. - All rights reserved