r8981 - in /scripts/qa: DebianQA.conf-sample DebianQA/BTS.pm DebianQA/Config.pm qareport.cgi templates/ templates/by_category

tincho-guest at users.alioth.debian.org tincho-guest at users.alioth.debian.org
Wed Nov 7 17:21:18 UTC 2007


Author: tincho-guest
Date: Wed Nov  7 17:21:18 2007
New Revision: 8981

URL: http://svn.debian.org/wsvn/?sc=1&rev=8981
Log:
- Config: Add parametrisation for CGI. Also use environment variable when
  read_config is called without arguments.
- BTS: Add more info into consolidated hash (subject, keywords and severity).
- qareport.cgi: separate template from code, take configuration parameters,
  stop reading bts cache, removed code from command-line version.
- templates/: template extracted from code, added balloon popup for bugs
  information, modified style a little.

Added:
    scripts/qa/templates/
    scripts/qa/templates/by_category   (with props)
Modified:
    scripts/qa/DebianQA.conf-sample
    scripts/qa/DebianQA/BTS.pm
    scripts/qa/DebianQA/Config.pm
    scripts/qa/qareport.cgi

Modified: scripts/qa/DebianQA.conf-sample
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA.conf-sample?rev=8981&op=diff
==============================================================================
--- scripts/qa/DebianQA.conf-sample (original)
+++ scripts/qa/DebianQA.conf-sample Wed Nov  7 17:21:18 2007
@@ -4,6 +4,10 @@
 #
 # A "~/" appearing at the beginning of a string will be replaced for the user's
 # home directory
+[qareport_cgi]
+templates_path = templates
+default_template = by_category
+
 [svn]
 repository = svn://svn.debian.org/svn/pkg-perl
 packages_path = trunk

Modified: scripts/qa/DebianQA/BTS.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/BTS.pm?rev=8981&op=diff
==============================================================================
--- scripts/qa/DebianQA/BTS.pm (original)
+++ scripts/qa/DebianQA/BTS.pm Wed Nov  7 17:21:18 2007
@@ -98,7 +98,12 @@
         # Remove done bugs
         @blist = grep( { ref $bugs{$pkgname}{$_}
                     and not $bugs{$pkgname}{$_}{done} } @blist );
-        $cbugs{$pkgname} = \@blist;
+        $cbugs{$pkgname} = {
+            map( { $_ => {
+                        keywords => $bugs{$pkgname}{$_}{keywords},
+                        severity => $bugs{$pkgname}{$_}{severity},
+                        subject  => $bugs{$pkgname}{$_}{subject}
+                    } } @blist) };
     }
     update_cache("consolidated", \%cbugs, "bts", 1, 0);
     unlock_cache("bts");

Modified: scripts/qa/DebianQA/Config.pm
URL: http://svn.debian.org/wsvn/scripts/qa/DebianQA/Config.pm?rev=8981&op=diff
==============================================================================
--- scripts/qa/DebianQA/Config.pm (original)
+++ scripts/qa/DebianQA/Config.pm Wed Nov  7 17:21:18 2007
@@ -19,6 +19,10 @@
 
 # Default values
 my %defaults = (
+    qareport_cgi => {
+        templates_path => "templates",
+        default_template => "by_category"
+    },
     svn => {
         repository => "svn://svn.debian.org/svn/pkg-perl",
         packages_path => "trunk"
@@ -62,7 +66,9 @@
 sub read_config(;$) {
     my $file = shift;
     unless($file) {
-        if(-e "/etc/DebianQA.conf") {
+        if($ENV{DEBIAN_QA_CONF}) {
+            $file = $ENV{DEBIAN_QA_CONF};
+        } elsif(-e "/etc/DebianQA.conf") {
             $file = "/etc/DebianQA.conf";
         } elsif(-e "DebianQA.conf") {
             $file = "DebianQA.conf";

Modified: scripts/qa/qareport.cgi
URL: http://svn.debian.org/wsvn/scripts/qa/qareport.cgi?rev=8981&op=diff
==============================================================================
--- scripts/qa/qareport.cgi (original)
+++ scripts/qa/qareport.cgi Wed Nov  7 17:21:18 2007
@@ -12,25 +12,20 @@
 
 use DebianQA::Cache;
 use DebianQA::Common;
-use DebianQA::Config;
+use DebianQA::Config qw(read_config %CFG);
 use DebianQA::DebVersions;
 use DebianQA::Svn;
-use DebianQA::BTS qw( bts_get );
 use CGI ();
 use CGI::Carp qw(fatalsToBrowser);
 use POSIX qw(locale_h);
 use Template ();
 use Date::Parse ();
 
-DebianQA::Config::read_config(
-    $ENV{DEBIAN_QA_CONF}
-    ||'/home/groups/pkg-perl/.debianqa/qa.conf'
-);
+read_config();
 
 my $cgi = new CGI;
 
 my $data = read_cache(consolidated => "");
-my $bts = bts_get();
 my $script_date = '$Date$';
 $script_date = join( ' ', (split(/ /, $script_date))[1..3] );
 my @modified = sort(
@@ -61,12 +56,7 @@
     my $archsuit = $data->{archive}{$pkg}{most_recent_src} || 0;
     my $uver = $data->{watch}{$pkg}{upstream_ver};
     my $m_uver = $data->{watch}{$pkg}{upstream_mangled};
-    my @bugs = sort @{$data->{bts}{$pkg}};
-
-    #use Data::Dumper;
-    #die Dumper($bts->{$pkg});
-
-    push @{ $bugs_by_severity{$pkg}{$bts->{$pkg}{$_}{severity}}||=[] }, $_ foreach @bugs;
+    my @bugs = sort keys %{$data->{bts}{$pkg}};
 
     my $note;
     if(! $dver) {
@@ -93,19 +83,6 @@
         push @wip, $pkg;
     }
     push @with_bugs, $pkg if @bugs;
-#    print "$pkg:", ( $pkg ne $svnpath ? " (SVN: $svnpath)" : '' ), "\n";
-#    if($status) {
-#        print " - Version status: $status\n";
-#        print "   + Watch status: ", $werr || "OK", "\n";
-#        print "   + SVN: ", $dver || "none";
-#        print " (mangled: ", $m_dver || "none", ")";
-#        print " (unreleased: $undver)" if($undver);
-#        print " Archive: ", $archver || "Not uploaded";
-#        print " ($archsuit)" if($archsuit);
-#        print " Upstream: ", $uver || "Unknown";
-#        print " (mangled: ", $m_uver || "Unknown", ")\n";
-#    }
-#    print "   + Bugs: ", join(", ", @bugs), "\n" if(@bugs);
 }
 
 if( $ENV{GATEWAY_INTERFACE} )
@@ -138,15 +115,17 @@
     setlocale(LC_TIME, $old_locale);
 }
 
+my $template = $cgi->param("template") || $CFG{qareport_cgi}{default_template};
 my $tt = new Template(
     {
-        INTERPOLATE=>1,
+        INCLUDE_PATH => $CFG{qareport_cgi}{templates_path},
+        INTERPOLATE  => 1,
         POST_CHOMP   => 1,
-    },
+    }
 );
 
 $tt->process(
-    \*DATA,
+    $template,
     {
         data    => $data,
         for_upgrade => \@for_upgrade,
@@ -154,164 +133,8 @@
         waiting => \@waiting,
         wip => \@wip,
         with_bugs   => \@with_bugs,
-        bugs_by_severity    => \%bugs_by_severity,
     },
 ) || die $tt->error;
 
 exit 0;
 
-__END__
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-[% BLOCK bts_link %]
-[% IF data.bts.$pkg.size %]
-<div class="bts-info">
-[% IF data.bts.$pkg.size > 1 %]
-<div style="text-align: right"><a 
-href="http://bugs.debian.org/$pkg">${data.bts.$pkg.size} bugs</a></div>
-[% END %]
-<div class="bts-info-details">
-[% FOREACH s IN bugs_by_severity.$pkg %]
-[% FOREACH b IN s.value %]<a class="bts-$s.key" href="http://bugs.debian.org/$b">$b</a> [% END %]
-[% END #FOREACH %]
-</div>
-</div>
-[% END #IF bugs %]
-[% END #BLOCK bts_link %]
-
-[% BLOCK package %]
-    [% SET arch_ver = data.archive.$pkg.most_recent %]
-    [% SET svn_ver = data.svn.$pkg.version %]
-    [% SET svn_un_ver = data.svn.$pkg.un_version %]
-    <tr>
-        <td>$pkg</td>
-        <td><a href="http://svn.debian.org/wsvn/pkg-perl/trunk/$pkg/debian/changelog?op=file&amp;rev=0&amp;sc=0">$svn_ver[% IF svn_un_ver AND (svn_un_ver != svn_ver) %]<span style="font-size: smaller"> ($svn_un_ver)</span>[% END #IF %]</a></td>
-        <td>[% IF arch_ver %]<a href="http://packages.qa.debian.org/$pkg">$arch_ver</a>[% END #IF %]</td>
-        <td>[% INCLUDE bts_link data=data pkg=pkg %]</td>
-        <td>${data.watch.$pkg.upstream_mangled || data.watch.$pkg.error}</td>
-    </tr>
-[% END #BLOCK package %]
-
-[% BLOCK section %]
-    [% IF list.size %]
-    <tbody>
-        <tr>
-            <th colspan="5" class="clickable"><a style="display: block" href="javascript:toggle_visibility('$name')">$title ($list.size)</a></th>
-        </tr>
-    </tbody>
-    <tbody id="$name">
-        <tr>
-            <th>Package</th>
-            <th>Repository</th>
-            <th>Archive</th>
-            <th>Bugs</th>
-            <th>Upstream</th>
-        </tr>
-        [% FOREACH pkg IN list %]
-        [% INCLUDE package pkg=pkg data=data %]
-        [% END #FOREACH list %]
-    </tbody>
-    [% END #IF list.size %]
-[% END #BLOCK section %]
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-<head>
-    <title>pkg-perl packages overview</title>
-    <style type="text/css">
-        body {
-            background: Window;
-            color: WindowText;
-            margin: 0;
-            padding: 8px;
-        }
-        table {
-            border: 1px solid black;
-            border-collapse: collapse;
-            empty-cells: show;
-        }
-        td, th {
-            border: 1px solid black;
-        }
-        th.clickable, th.clickable a, th.clickable a:visited {
-            background: Menu;
-            color: MenuText;
-        }
-/*  before enabling this, think about the link colors -- they all have to
-    be visible with the new background
-        tr:hover td, tr:hover th {
-            background: Highlight;
-            color: HighlightText;
-        }
-*/
-        .bts-info {
-            float: right;
-            margin: 0 0 1pt 2pt;
-            font-size: 75%;
-            z-index: 0;
-/*            border-bottom: 1px dashed black;
-            border-left: 1px dashed black; */
-        }
-/*        .bts-info:hover {
-            background: InfoBackground;
-            border: 1px outset InfoBackground;
-        } */
-        .bts-info a, .bts-info a:visited {
-            text-decoration: none;
-        }
-
-        .bts-info-details {
-            /*display: none;*/
-        }
-        .bts-info:hover .bts-info-details {
-            display: block;
-        }
-        .bts-wishlist {
-            color: green;
-        }
-        .bts-minor {
-            color: #004000;  /* darkgreen */
-        }
-        .bts-normal, .bts-important {
-        }
-        .bts-grave {
-            color: red;
-        }
-        .bts-critical {
-            color: red;
-            text-decoration: blink;
-        }
-    </style>
-    <script type="text/javascript">
-        function toggle_visibility(id)
-        {
-            var el = document.getElementById(id);
-            el.style.display = (el.style.display == 'none' ? 'table-row-group' : 'none');
-        }
-    </script>
-</head>
-<body>
-<h1><a href="http://pkg-perl.alioth.debian.org/">Debian Perl Group</a></h1>
-<table>
-    [% INCLUDE section data=data list=for_upgrade name="for_upgrade" title="Newer upstream available" %]
-    [% INCLUDE section data=data list=for_upload name="for_upload" title="Ready for upload" %]
-    [% INCLUDE section data=data list=waiting name="waiting" title="NEW and incoming" %]
-    [% INCLUDE section data=data list=wip name="wip" title="Work in progress" %]
-    [% INCLUDE section data=data list=with_bugs name="with_bugs" title="With bugs" %]
-</table>
-<p>
-    <a href="http://validator.w3.org/check?uri=referer"><img
-        style="border:0;width:88px;height:31px"
-        src="http://www.w3.org/Icons/valid-xhtml10-blue"
-        alt="Valid XHTML 1.0 Strict"/></a>
-    <a href="http://jigsaw.w3.org/css-validator/check/referer">
-        <img style="border:0;width:88px;height:31px"
-        src="http://jigsaw.w3.org/css-validator/images/vcss" 
-        alt="Valid CSS!" /></a>
-</p>
-[% META id='$Id$' %]
-<p style="border-top: 1px solid black">
-    <code>$template.id</code>
-</p>
-</body>
-</html>

Added: scripts/qa/templates/by_category
URL: http://svn.debian.org/wsvn/scripts/qa/templates/by_category?rev=8981&op=file
==============================================================================
--- scripts/qa/templates/by_category (added)
+++ scripts/qa/templates/by_category Wed Nov  7 17:21:18 2007
@@ -1,0 +1,186 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- vim:ts=4:sw=4:et:ai:sts=4:syntax=xhtml
+-->
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+
+[% BLOCK bts_link %]
+[% IF data.bts.$pkg.size %]
+<span class="bts-info popup"><a href="http://bugs.debian.org/$pkg"
+>${data.bts.$pkg.size} bug[% IF data.bts.$pkg.size > 1 %]s[% END %]</a>
+<span class="paren">[</span>
+<span class="bts-info-details balloon">
+[% FOREACH s IN data.bts.$pkg.keys.sort %]
+<a class="bts-${data.bts.$pkg.$s.severity}" href="http://bugs.debian.org/$s"
+>#$s</a>: ${data.bts.$pkg.$s.subject}
+[% IF data.bts.$pkg.$s.keywords.length > 0 %]
+(${data.bts.$pkg.$s.keywords.split(" ").join(", ")})
+[% END %]
+<br />
+[% END #FOREACH %]
+</span>
+<span class="paren">]</span>
+</span>
+[% END #IF bugs %]
+[% END #BLOCK bts_link %]
+
+[% BLOCK package %]
+    [% SET arch_ver = data.archive.$pkg.most_recent %]
+    [% SET svn_ver = data.svn.$pkg.version %]
+    [% SET svn_un_ver = data.svn.$pkg.un_version %]
+    <tr>
+        <td>$pkg</td>
+        <td><a href="http://svn.debian.org/wsvn/pkg-perl/trunk/$pkg/debian/changelog?op=file&amp;rev=0&amp;sc=0">$svn_ver[% IF svn_un_ver AND (svn_un_ver != svn_ver) %]<span style="font-size: smaller"> ($svn_un_ver)</span>[% END #IF %]</a></td>
+        <td>[% IF arch_ver %]<a href="http://packages.qa.debian.org/$pkg">$arch_ver</a>[% END #IF %]</td>
+        <td>[% INCLUDE bts_link data=data pkg=pkg %]</td>
+        <td>${data.watch.$pkg.upstream_mangled || data.watch.$pkg.error}</td>
+    </tr>
+[% END #BLOCK package %]
+
+[% BLOCK section %]
+    [% IF list.size %]
+    <tbody>
+        <tr>
+            <th colspan="5" class="clickable"><a style="display: block" href="javascript:toggle_visibility('$name')">$title ($list.size)</a></th>
+        </tr>
+    </tbody>
+    <tbody id="$name">
+        <tr>
+            <th>Package</th>
+            <th>Repository</th>
+            <th>Archive</th>
+            <th>Bugs</th>
+            <th>Upstream</th>
+        </tr>
+        [% FOREACH pkg IN list %]
+        [% INCLUDE package pkg=pkg data=data %]
+        [% END #FOREACH list %]
+    </tbody>
+    [% END #IF list.size %]
+[% END #BLOCK section %]
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+    <title>pkg-perl packages overview</title>
+    <style type="text/css">
+        body {
+            background: Window;
+            color: WindowText;
+            margin: 0;
+            padding: 8px;
+        }
+        table {
+            border: 1px solid black;
+            border-collapse: collapse;
+            empty-cells: show;
+        }
+        td, th {
+            border: 1px solid black;
+            padding: 0.2em;
+        }
+        th.clickable, th.clickable a, th.clickable a:visited {
+            background: Menu;
+            color: MenuText;
+        }
+/*  before enabling this, think about the link colors -- they all have to
+    be visible with the new background
+        tr:hover td, tr:hover th {
+            background: Highlight;
+            color: HighlightText;
+        }
+*/
+        .bts-info {
+            /*
+            float: right;
+            margin: 0 0 1pt 2pt;
+            font-size: 75%;
+            z-index: 0;
+            border-bottom: 1px dashed black;
+            border-left: 1px dashed black;
+        }
+        .bts-info:hover {
+            background: InfoBackground;
+            border: 1px outset InfoBackground;
+        }
+        .bts-info-details {
+            display: none;
+        }
+        .bts-info:hover .bts-info-details {
+            display: block;
+            */
+        }
+        .bts-info a, .bts-info a:visited {
+            text-decoration: none;
+        }
+        .bts-wishlist {
+            color: green;
+        }
+        .bts-minor {
+            color: #004000;  /* darkgreen */
+        }
+        .bts-normal, .bts-important {
+        }
+        .bts-grave {
+            color: red;
+        }
+        .bts-critical {
+            color: red;
+            text-decoration: blink;
+        }
+        /* From ikiwiki templates */
+        .popup {
+                border-bottom: 1px dotted #366;
+                color: #366;
+        }
+        .popup .balloon,
+        .popup .paren,
+        .popup .expand {
+                display: none;
+        }
+        .popup:hover .balloon,
+        .popup:focus .balloon {
+                position: absolute;
+                display: inline;
+                margin: 1em 0 0 -2em;
+                padding: 0.625em;
+                border: 2px solid;
+                background-color: #dee;
+                color: black;
+                /* Nonstandard, but very nice. */
+                opacity: 0.95;
+                -moz-opacity: 0.95;
+                filter: alpha(opacity=95);
+        }
+    </style>
+    <script type="text/javascript">
+        function toggle_visibility(id)
+        {
+            var el = document.getElementById(id);
+            el.style.display = (el.style.display == 'none' ? 'table-row-group' : 'none');
+        }
+    </script>
+</head>
+<body>
+<h1><a href="http://pkg-perl.alioth.debian.org/">Debian Perl Group</a></h1>
+<table>
+    [% INCLUDE section data=data list=for_upgrade name="for_upgrade" title="Newer upstream available" %]
+    [% INCLUDE section data=data list=for_upload name="for_upload" title="Ready for upload" %]
+    [% INCLUDE section data=data list=waiting name="waiting" title="NEW and incoming" %]
+    [% INCLUDE section data=data list=wip name="wip" title="Work in progress" %]
+    [% INCLUDE section data=data list=with_bugs name="with_bugs" title="With bugs" %]
+</table>
+<p>
+    <a href="http://validator.w3.org/check?uri=referer"><img
+        style="border:0;width:88px;height:31px"
+        src="http://www.w3.org/Icons/valid-xhtml10-blue"
+        alt="Valid XHTML 1.0 Strict"/></a>
+    <a href="http://jigsaw.w3.org/css-validator/check/referer">
+        <img style="border:0;width:88px;height:31px"
+        src="http://jigsaw.w3.org/css-validator/images/vcss" 
+        alt="Valid CSS!" /></a>
+</p>
+[% META id='$Id$' %]
+<p style="border-top: 1px solid black">
+    <code>$template.id</code>
+</p>
+</body>
+</html>

Propchange: scripts/qa/templates/by_category
------------------------------------------------------------------------------
    svn:keywords = Id




More information about the Pkg-perl-cvs-commits mailing list