r9653 - in /scripts/qa: qareport.cgi templates/by_category

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Thu Nov 22 08:46:09 UTC 2007


Author: dmn
Date: Thu Nov 22 08:46:09 2007
New Revision: 9653

URL: http://svn.debian.org/wsvn/?sc=1&rev=9653
Log:
Migrate qareport.cgi to Classification.pm

Modified:
    scripts/qa/qareport.cgi
    scripts/qa/templates/by_category

Modified: scripts/qa/qareport.cgi
URL: http://svn.debian.org/wsvn/scripts/qa/qareport.cgi?rev=9653&op=diff
==============================================================================
--- scripts/qa/qareport.cgi (original)
+++ scripts/qa/qareport.cgi Thu Nov 22 08:46:09 2007
@@ -11,9 +11,8 @@
 use warnings;
 
 use DebianQA::Cache;
-use DebianQA::Common;
+use DebianQA::Classification;
 use DebianQA::Config qw(read_config %CFG);
-use DebianQA::DebVersions;
 use DebianQA::Svn;
 use CGI ();
 use CGI::Carp qw(fatalsToBrowser);
@@ -25,13 +24,13 @@
 
 my $cgi = new CGI;
 
-my $data = read_cache(consolidated => "");
+my $cache = read_cache(consolidated => "");
 my $script_date = '$Date$';
 $script_date = join( ' ', (split(/ /, $script_date))[1..3] );
 my @modified = sort(
     map(
         {
-            find_stamp($data, $_)
+            find_stamp($cache, $_)
         } qw(svn watch archive bts pkglist),
     ),
     Date::Parse::str2time($script_date),
@@ -39,90 +38,39 @@
 my $last_modified = $modified[-1];
 my $ims;
 my @pkglist = get_pkglist();
+my $cls = classify(@pkglist);
+
+foreach(keys %$cls)
+{
+    delete $cls->{$_} unless(%{$cls->{$_}{hilight}});
+}
 
 my( @for_upload, @for_upgrade, @weird, @waiting, @wip, @with_bugs, @all );
-my %bugs_by_severity;
 
-foreach my $pkg (sort @pkglist)
+foreach my $pkg (sort keys %$cls)
 {
-    next if($pkg =~ /^\//);
-    my $svnpath = $data->{svn}{$pkg}{dir};
-    my $werr = $data->{watch}{$pkg}{error};
-    my $dver = $data->{svn}{$pkg}{version} || 0;
-    my $dwerr = $data->{svn}{$pkg}{watch_error};
-    my $m_dver = $data->{svn}{$pkg}{mangled_ver} || 0;
-    my $m_uver = $data->{svn}{$pkg}{mangled_un_ver} || 0;
-    my $undver = $data->{svn}{$pkg}{un_version};
-    my $archver = $data->{archive}{$pkg}{most_recent} || 0;
-    my $archsuit = $data->{archive}{$pkg}{most_recent_src} || 0;
-    my $uver = $data->{watch}{$pkg}{upstream_version};
-    my $u_uver = $data->{watch}{$pkg}{upstream_mangled} || 0;
-    my $uurl = $data->{watch}{$pkg}{upstream_url};
-    my @bugs = sort keys %{$data->{bts}{$pkg}};
+    my $data = $cls->{$pkg};
 
-    my @notes;
-    my %todo;
     my $dest;   # like "destiny" :)
     my %info = (
         name => $pkg,
-        notes   => \@notes,
-        todo    => \%todo,
-        watch   => $data->{watch}{$pkg},
-        archive => $data->{archive}{$pkg},
-        svn     => $data->{svn}{$pkg},
-        bts     => $data->{bts}{$pkg},
+        map(
+            ($_=>$data->{$_}),
+            qw( watch archive svn bts notes hilight ),
+        ),
     );
-    if(! $dver) {
-        push @notes, 'Needs to be finished';
-        $dest = \@wip;
-        $todo{repo} = 1;
-    }
-    if(! $archver) {
-        push @notes, 'Never uploaded';
-        $dest ||= \@for_upload;
-        $todo{archive} = 1;
-    }
-    if(deb_compare($archver, $dver) > 0) {
-        push @notes, "Ancient version in SVN";
-        $dest ||= \@weird;
-        $todo{repo} = 1;
-    }
-    # Use only mangled versions
-    if(deb_compare($m_dver, $u_uver) < 0) {
-        push @notes, "$m_dver needs upgrading to newer upstream";
-        $dest ||= \@for_upgrade;
-        $todo{repo} = 1;
-    }
-    if(deb_compare($archver, $dver) != 0) {
-        push @notes, "Needs uploading to the archive";
-        $dest ||= \@for_upload;
-        $todo{archive} = 1;
-    }
-    if($werr and $werr eq "Native") {
-        push @notes, "Native package";
-    }
-    if($dwerr or (not $m_dver and not $undver) or not $u_uver or not $uver or $werr) {
-        push @notes, "Watchfile problem";
-        $dest ||= \@wip;
-        $todo{upstream} = 1;
-    }
-    if(deb_compare($m_dver, $u_uver) > 0) {
-        push @notes, "Ancient version in upstream?";
-        $dest ||= \@weird;
-        $todo{upstream} = 1;
-    }
-    $dest ||= \@with_bugs if(@bugs);
+    my $status = $data->{status};   # to save some typing
 
-    do{
-        $dest ||= \@waiting;
-        $todo{archive} = 1;
-    } if($archsuit =~ /new|incoming/);
+    $dest ||= \@for_upgrade if $status->{needs_upgrade};
+    $dest ||= \@wip if $status->{not_finished} or $status->{invalid_svn_version};
+    $dest ||= \@for_upload if $status->{needs_upload} or $status->{never_uploaded};
+    $dest ||= \@weird if $status->{repo_ancient} or $status->{svn_ancient};
+    $dest ||= \@wip if $status->{watch_error};
+    $dest ||= \@with_bugs if $status->{has_bugs};
+    $dest ||= \@waiting if $status->{archive_waiting};
 
-    if( %todo or @bugs )
-    {
-        push @$dest, \%info;
-        push @all, \%info;
-    }
+    push @$dest, \%info;
+    push @all, \%info;
 }
 
 if( $ENV{GATEWAY_INTERFACE} )
@@ -170,7 +118,7 @@
 $tt->process(
     $template,
     {
-        data        => $data,
+        data        => $cls,
         group_name  => $CFG{qareport_cgi}{group_name},
         group_url   => $CFG{qareport_cgi}{group_url},
         wsvn_url    => $CFG{qareport_cgi}{wsvn_url},

Modified: scripts/qa/templates/by_category
URL: http://svn.debian.org/wsvn/scripts/qa/templates/by_category?rev=9653&op=diff
==============================================================================
--- scripts/qa/templates/by_category (original)
+++ scripts/qa/templates/by_category Thu Nov 22 08:46:09 2007
@@ -54,7 +54,7 @@
                     pkg.notes.join(', ')
                     %]</span></span>[% ELSE %]$pkg.name[% END %]</td>
 
-        <td[% IF pkg.todo.repo %] class="todo"[% END %]>
+        <td[% IF pkg.hilight.svn %] class="todo"[% END %]>
             [% chlog_url = BLOCK %][% pkg.name | format("$wsvn_url")
             %]/debian/changelog?op=file&amp;rev=0&amp;sc=0[% END %]
             <span class="popup"><a href="$chlog_url">$svn_ver</a><span
@@ -73,11 +73,11 @@
                         | html %]</a></span></span>[% END #IF %]
         </td>
 
-        <td[% IF pkg.todo.archive %] class="todo"[% END %]>[% IF arch_ver %]<a href="http://packages.qa.debian.org/$pkg.name">$arch_ver</a>[% END #IF %]</td>
+        <td[% IF pkg.hilight.archive %] class="todo"[% END %]>[% IF arch_ver %]<a href="http://packages.qa.debian.org/$pkg.name">$arch_ver</a>[% END #IF %]</td>
 
         <td>[% INCLUDE bts_link pkg=pkg %]</td>
 
-        <td[% IF pkg.todo.upstream %] class="todo"[% END %]><a href="[% IF
+        <td[% IF pkg.hilight.upstream %] class="todo"[% END %]><a href="[% IF
                 pkg.watch.upstream_mangled %][% pkg.watch.upstream_url | html
                 %][% ELSE %][% "${pkg.name}" | format("$wsvn_url")
                 %]/debian/watch?op=file&amp;rev=0&amp;sc=0[% END %]">[%




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