[Collab-qa-commits] r1193 - in buildstat/trunk/buildstat-server: lib/SvnBuildStat/Controller root/src root/src/packages

goneri at alioth.debian.org goneri at alioth.debian.org
Mon Sep 1 22:04:06 UTC 2008


Author: goneri
Date: 2008-09-01 22:04:05 +0000 (Mon, 01 Sep 2008)
New Revision: 1193

Modified:
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
   buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Packages.pm
   buildstat/trunk/buildstat-server/root/src/packages/info.tt2
   buildstat/trunk/buildstat-server/root/src/packages/list.tt2
   buildstat/trunk/buildstat-server/root/src/ttsite.css
Log:
fixes regarding the presentation

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm	2008-09-01 20:58:18 UTC (rev 1192)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Controls.pm	2008-09-01 22:04:05 UTC (rev 1193)
@@ -84,7 +84,7 @@
 
     my $changelogentry_id = $tobuild->[0][1];
     my $vcs_name = $tobuild->[0][0];
-    return if $vcs_name eq 'apt';
+    die if $vcs_name eq 'apt';
 
     die "Can't find a package to build" unless $changelogentry_id;
     my $changelogentry = $c->model('SvnBuildStat::Model::DB::Changelogentry')->search ({id => $changelogentry_id})->first;

Modified: buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Packages.pm
===================================================================
--- buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Packages.pm	2008-09-01 20:58:18 UTC (rev 1192)
+++ buildstat/trunk/buildstat-server/lib/SvnBuildStat/Controller/Packages.pm	2008-09-01 22:04:05 UTC (rev 1193)
@@ -48,9 +48,9 @@
 
     my $dbh = $c->model('DB')->storage->dbh;
 
-    my $package_hashref  = $dbh->selectall_hashref("
+    my $sth = $dbh->prepare("
 SELECT
-  sourcepackage.name AS sourcepackage_name, maintainer.email, maintainer.name, sourcepackage.id AS sourcepackage_id, changelogentry.id AS changelogentry_id, changelogentry.dscuri, changelogentry.isnative, changelogentry.isindebian, count(buildall.id) AS buildallcount, count(buildok.isbuildok) AS buildokcount, repositoryentry.issyncedwithupstream, repositoryentry.iswatchfilebroken
+  vcs.name AS vcs_name, repository.name AS repository_name, sourcepackage.name AS sourcepackage_name, maintainer.email, maintainer.name, sourcepackage.id AS sourcepackage_id, changelogentry.id AS changelogentry_id, changelogentry.dscuri, changelogentry.isnative, changelogentry.isindebian, count(buildall.id) AS buildallcount, count(buildok.isbuildok) AS buildokcount, repositoryentry.issyncedwithupstream, repositoryentry.iswatchfilebroken
 FROM
   sourcepackage, repositoryentry_maintainer, maintainer, changelogentry, repositoryentry
  LEFT OUTER JOIN build AS buildall
@@ -59,6 +59,14 @@
  LEFT OUTER JOIN build AS buildok
  ON
   repositoryentry.changelogentry_id=buildok.changelogentry_id AND buildok.isbuildok=true
+
+ LEFT OUTER JOIN repository
+ ON
+  repository.id=repositoryentry.repository_id
+ LEFT OUTER JOIN vcs 
+ ON
+  vcs.id=repository.vcs_id
+
 WHERE
   repositoryentry.id=repositoryentry_maintainer.repositoryentry_id
  AND
@@ -68,16 +76,18 @@
  AND
   repositoryentry.sourcepackage_id=sourcepackage.id
  AND maintainer.email='$email'
- GROUP BY sourcepackage.name, sourcepackage.id, changelogentry.id, changelogentry.dscuri, changelogentry.isnative, changelogentry.isindebian, repositoryentry.issyncedwithupstream, repositoryentry.iswatchfilebroken, maintainer.email, maintainer.name
- ORDER BY sourcepackage.name 
-        
-        ", 1);
+ GROUP BY vcs.name, repository.name, sourcepackage.name, sourcepackage.id, changelogentry.id, changelogentry.dscuri, changelogentry.isnative, changelogentry.isindebian, repositoryentry.issyncedwithupstream, repositoryentry.iswatchfilebroken, maintainer.email, maintainer.name
+ ORDER BY vcs.name, sourcepackage.name ");
 
+my $package_arrayref = $dbh->selectall_arrayref($sth, { Slice => {} });
+
+
+
     $c->stash->{maintainer}->{email} = $email;
     my $name_arrayref = $dbh->selectall_arrayref("SELECT name FROM maintainer WHERE email='$email'");
     $c->stash->{maintainer}->{name} = $name_arrayref->[0][0];
 
-    $c->stash->{packages} = preparePackages($dbh, $package_hashref);
+    ($c->stash->{packages}, $c->stash->{vcses}) = preparePackages($dbh, $package_arrayref);
 
     $c->stash->{template} = 'packages/list.tt2';
 
@@ -85,35 +95,42 @@
 
 
 sub preparePackages : Private {
-    my ($dbh, $package_hashref) = @_;
+    my ($dbh, $package_arrayref) = @_;
 
 
+    my $vcses_cache = {};
     my $packages = [];
-    foreach (keys %$package_hashref) {
+    my $vcses = [];
+    foreach (@$package_arrayref) {
 
+        # is used to create the repostiries menu
+        if (!$vcses_cache->{$_->{vcs_name}}) {
+            push @$vcses, { vcs_name => $_->{vcs_name}, repository_name => $_->{repository_name} };
+            $vcses_cache->{$_->{vcs_name}} = 1;
+        }
+
         # TODO prepare() the SQL request first to speed up the process
-        my $bug_hashref  = $dbh->selectall_hashref("select bug.id, bugstate.name AS state, bug.name AS desc, bugseverity.name AS severity from bug,bugstate, bugseverity where sourcepackage_id = ".$package_hashref->{$_}->{sourcepackage_id}." and bug.bugstate_id=bugstate.id and bug.bugseverity_id=bugseverity.id and bugstate.name <> 'done'", 1);
+        my $bug_hashref  = $dbh->selectall_hashref("select bug.id, bugstate.name AS state, bug.name AS desc, bugseverity.name AS severity from bug,bugstate, bugseverity where sourcepackage_id = ".$_->{sourcepackage_id}." and bug.bugstate_id=bugstate.id and bug.bugseverity_id=bugseverity.id and bugstate.name <> 'done'", 1);
        
-        $package_hashref->{$_}->{bugs} = [];
+        $_->{bugs} = [];
         foreach my $bug_id (keys %$bug_hashref) {
-            push @{$package_hashref->{$_}->{bugs}}, $bug_hashref->{$bug_id};
+            push @{$_->{bugs}}, $bug_hashref->{$bug_id};
         }
 
 
-        my $lintian_hashref  = $dbh->selectall_hashref("select qaresultentry.id AS qaresultentry_id, qaseverity.letter, qatag.name AS tag, qaresultentry.text from qaseverity, qaresultentry, qatool, qajob, qatag where qajob.changelogentry_id=".$package_hashref->{$_}->{changelogentry_id}." and qaresultentry.qajob_id=qajob.id and qajob.qatool_id=qatool.id and qaresultentry.qatag_id=qatag.id and qatool.name='lintian' and qaresultentry.qaseverity_id=qaseverity.id", 1);
+        my $lintian_hashref  = $dbh->selectall_hashref("select qaresultentry.id AS qaresultentry_id, qaseverity.letter, qatag.name AS tag, qaresultentry.text from qaseverity, qaresultentry, qatool, qajob, qatag where qajob.changelogentry_id=".$_->{changelogentry_id}." and qaresultentry.qajob_id=qajob.id and qajob.qatool_id=qatool.id and qaresultentry.qatag_id=qatag.id and qatool.name='lintian' and qaresultentry.qaseverity_id=qaseverity.id", 1);
        
-        $package_hashref->{$_}->{lintians} = [];
+        $_->{lintians} = [];
         foreach my $qaresultentry_id (keys %$lintian_hashref) {
-            push @{$package_hashref->{$_}->{lintians}}, $lintian_hashref->{$qaresultentry_id};
+            push @{$_->{lintians}}, $lintian_hashref->{$qaresultentry_id};
         }
 
 
-        push @$packages, $package_hashref->{$_};
+        push @$packages,$_;
 
     }
-    # TODO provide the team name to the View.
 
-    return $packages;
+    return ($packages, $vcses);
 
 
 
@@ -191,19 +208,6 @@
         $c->stash->{$_} = $packageinfo->{$vcs}->{$_};
     }
 
-
-
-#    $c->stash->{isindebian} = $package->isindebian;
-#    $c->stash->{tarballuri} = $package->tarballuri;
-#    $c->stash->{svndebrelease} = $package->svndebrelease;
-#    $c->stash->{iswatchfilebroken} = $package->iswatchfilebroken;
-#    $c->stash->{uri} = $package->uri;
-#    $c->stash->{weburi} = $package->uri;
-#    $c->stash->{weburi} =~ s!svn://svn.debian.org/svn!http://svn.debian.org/wsvn!;
-#    $c->stash->{isuptodate} = $package->isuptodate;
-#    $c->stash->{upstreamrelease} = $package->upstreamrelease;
-#    $c->stash->{currentchangelogentry} = \@currentchangelogentry;
-#    $c->stash->{todo} = \@todo;
     ############ Maintainers list
     my $maintainer_rs = $c->model('SvnBuildStat::Model::DB::RepositoryentryMaintainer')->search({repositoryentry_id => $packageinfo->{$vcs}->{'repositoryentry_id'}});
     $c->stash->{maintainers} = [ $maintainer_rs->search_related("maintainer_id")->all ];
@@ -229,7 +233,7 @@
 }
 
 
-    my $changelogsinfo  = $dbh->selectall_hashref("
+    my $changelogs  = $dbh->selectall_arrayref("
 SELECT
   changelogentry.id AS changelogentry_id,
   rev,
@@ -248,20 +252,19 @@
  AND
   repositoryentry_id=".$packageinfo->{$vcs}->{'repositoryentry_id'}."
 ORDER BY
-  date DESC", 1);
+  date DESC", { Slice => {} });
 
-    $c->stash->{"changelogs"} = [];
-    foreach my $changelogentry_id (keys %$changelogsinfo) {
-        my %h;
-        foreach (keys %{$changelogsinfo->{$changelogentry_id}}) {
-            $h{$_} = $changelogsinfo->{$changelogentry_id}->{$_};
-        }
+    foreach my $changelogentry (@$changelogs) {
+#        my %h;
+#        foreach (keys %{$changelogsinfo->{$changelogentry->{changelogentry_id}}) {
+#            $h{$_} = $changelogsinfo->{$changelogentry>{changelogentry_id}->{$_};
+#        }
 
         # Fetch the builds 
         my %t;
-        my $buildsinfo  = $dbh->selectall_hashref("select build.id AS build_id, isbuildok, duration, time, arch.name AS arch_name from arch, build where build.arch_id=arch.id AND changelogentry_id=".$changelogentry_id." ORDER BY time DESC", 1);
+        my $buildsinfo  = $dbh->selectall_hashref("select build.id AS build_id, isbuildok, duration, time, arch.name AS arch_name from arch, build where build.arch_id=arch.id AND changelogentry_id=".$changelogentry->{changelogentry_id}." ORDER BY time LIMIT 5", 1);
         foreach my $build_id (keys %{$buildsinfo}) {
-            $buildsinfo->{$build_id}->{qaresultentrys} = [];
+#            $buildsinfo->{$build_id}->{qaresultentrys} = [];
             my $qaresultentrysinfo  = $dbh->selectall_hashref("
 SELECT
   qaresultentry.id AS qaresultentry_id,
@@ -288,53 +291,16 @@
             foreach my $qaresultentry_id (keys %{$qaresultentrysinfo}) {
                 push @{$buildsinfo->{$build_id}->{qaresultentrys}}, $qaresultentrysinfo->{$qaresultentry_id};
             }
-            if ($buildsinfo->{$build_id} and !exists($h{builds})) {
-            $h{builds} = [];
+#            if ($buildsinfo->{$build_id} and !exists($buildsinfo->{$build_id})) {
+#            $changelogentry->{builds} = [];
 
-            }
-            push @{$h{builds}}, $buildsinfo->{$build_id};
+            #           }
+            push @{$changelogentry->{builds}}, $buildsinfo->{$build_id};
         }
 
-        push @{$c->stash->{changelogs}}, \%h;
     }
+    $c->stash->{changelogs} = $changelogs;
 
-##########
-#my $build = $c->model('SvnBuildStat::Model::DB::Build')->search({package_id => $package->id},{order_by => "id DESC"})->first;
-#if ($build) {
-#    foreach (split $/, $build->lintian_log) {
-#        my $error;
-#        $error = 1 if /^E/;    
-#        push @{$c->stash->{lintians}}, { text => $_, error => $error };
-#}
-#
-#foreach (split $/, $build->linda_log) {
-#    my $error;
-#    $error = 1 if /^E/;    
-#    push @{$c->stash->{lindas}}, { text => $_, error => $error } ;
-#}
-#
-#$c->stash->{piupartsisok}  = $build->piupartsisok;
-#}
-###############
-#
-#my $build_rs = $c->model('SvnBuildStat::Model::DB::Build')->search({package_id => $package->id},{order_by => "id DESC"});
-#my $cpt;
-#while (($cpt++ < 10) && (my $build = $build_rs->next)) {
-#    my $failedstep;
-#    if (!$build->buildisok) {
-#        $failedstep = "build";
-#    }
-#
-#    push @{$c->stash->{builds}}, {
-#    id => $build->id,
-#    buildisok => $build->buildisok,
-#    rev => $build->rev,
-#    duration => $build->duration,
-#    arch => $build->arch_id->name,
-#    failedstep =>  $failedstep,
-#    time => $build->time, 
-#}
-#}
 }
 
 =head1 AUTHOR

Modified: buildstat/trunk/buildstat-server/root/src/packages/info.tt2
===================================================================
--- buildstat/trunk/buildstat-server/root/src/packages/info.tt2	2008-09-01 20:58:18 UTC (rev 1192)
+++ buildstat/trunk/buildstat-server/root/src/packages/info.tt2	2008-09-01 22:04:05 UTC (rev 1193)
@@ -27,7 +27,7 @@
 <h2>URI</h2>
 <table>
 <tr>
-  <td>Repository location: <a href="[% uri %][% subdir %]">raw</a><!-- <a href="[%  %]">HTTP</a>--!></td>
+  <td>Repository location: <a href="[% uri %][% subdir %]">raw</a><!-- <a href="[%  %]">HTTP</a>--></td>
 </tr>
 <tr>
 <td [% IF iswatchfilebroken %]class="error"[% END %]>
@@ -49,7 +49,7 @@
   [% todo | html_line_break %]
   </blockquote>
 </div>
-[% END -%]
+[% END -%] <!-- [ IF todo ] -->
 
 
 [% IF bugs %]
@@ -57,7 +57,6 @@
 <div id="bugs">
 <img src="[% bugpic %]" alt="bug graph"/>
 <table>
-  [% # Display each book in a table row %]
   [% FOREACH bug IN bugs -%]
   <tr [% IF bug.error %] class="error"[% ELSE %][% IF bug.warning %] class="warning"[% END %][% END %]>
     <td>
@@ -67,26 +66,26 @@
       [% bug.severity %]
     </td>
   </tr>
-  [% END -%]
+  [% END -%] <!-- [ FOREACH bug IN bugs ] -->
 </table>
 </div>
-[% END -%]
+[% END -%] <!-- [ IF bugs ] -->
 
 [% IF changelogs %]
   <h2><a href="#" onclick="showhide('changelog'); return(false);">Changelog</a></h2>
   <div id="changelog">
   [% FOREACH changelog IN changelogs -%]
+  [% cpt=cpt+1 %]
         <div class="changelogentry">
-  <a href="#" onclick="showhide('changelog-[[% changelog.changelogentry_id %]]'); return(false);">rev:[% changelog.rev %] by [% changelog.userlogin_name %]</a>
-          <div id="changelog-[[% changelog.changelogentry_id %]]" >
+  <a href="#" onclick="showhide('changelog-[% changelog.changelogentry_id %]'); return(false);">rev:[% changelog.rev %] by [% changelog.userlogin_name %]</a>
+          <div id="changelog-[% changelog.changelogentry_id %]"  [% IF cpt != 1  %]style="display: none"[% END %]>
           <div class="changelogtext" >
             [% changelog.text %]
-          </div>
+          </div> <!-- div class="changelogtext" -->
         [% IF changelog.epoch %][% changelog.epoch %]:[% END %][% changelog.version %][% IF changelog.isnative %][% changelog.debrevision %][% END %][% changelog.date %]
           [% IF changelog.builds %]
         <table>
             <tr><th>Status</th><th>Arch</th><th>Svn Rev.</th><th>Date</th><th>Build duration</th></tr>
-            [% # Display each book in a table row %]
             [% FOREACH build IN changelog.builds -%]
             <tr [% IF ! build.isbuildok %]class="error"[% ELSE %]class="ok"[% END %]>
               <td>
@@ -98,8 +97,8 @@
                 [% ELSE %] 
                 failed during the "[% build.failedstep %]"
           
-                [% END %]
-            [% END %]
+                [% END %] <!-- [ IF build.failedstep == "build" ] -->
+            [% END %] <!-- [ IF build.isbuildok ] -->
           
               </td>
               <td>
@@ -114,30 +113,33 @@
               <td>
                 [% IF build.duration %][% build.duration %]s[% END %]
               </td>
+            [% IF build.qaresultentrys %]
             </tr>
-            <tr>
+            <tr [% IF ! build.isbuildok %]class="error"[% ELSE %]class="ok"[% END %]>
+            <td colspan="5">
               <table>
               <tr><th>tools</th><th>tags</th><th>messages</th></tr>
               [% FOREACH qaresultentry IN build.qaresultentrys -%]
-              <tr
-                [% IF qaresultentry.letter == 'E' %]"class='error'"[% END %]: "class='warning'" %]
-                [% IF qaresultentry.letter == 'W' %]"class='warning'"[% END %]: "class='warning'" %]
-                [% IF qaresultentry.letter == 'I' %]"class='info'"[% END %]: "class='info'" %]
-                                                                                                   >
+              <tr [% IF qaresultentry.letter == 'E' %]class='error'[% END %]
+                [% IF qaresultentry.letter == 'W' %]class='warning'[% END %]
+                [% IF qaresultentry.letter == 'I' %]class='info'[% END %]>
                 <td>[% qaresultentry.qatool_name %]</td>
                 <td>[% qaresultentry.qatag_name %]</td>
                 <td>[% qaresultentry.text %]</td>
               </tr>
-              [% END -%]    
+              [% END -%]
               </table>
+              </td>
+              </tr>
+              [% END -%] <!-- [ IF build.qaresultentrys ] -->
+            [% END -%] <!-- [ FOREACH build IN changelog.builds ] -->
             </tr>
-            [% END -%]
 
         </table>
-            </div>
-          [% END %]
-        </div>
-  [% END -%]
-  </div>
-[% END %]
+          [% END %] <!-- [ IF changelog.builds ] -->
+        </div> <!-- id="changelog-[ changelog.changelogentry_id ]" -->
+  </div> <!-- div class="changelogentry" -->
+  [% END -%] <!-- [ FOREACH changelog IN changelogs ] -->
+  </div> <!-- <div id="changelog"> -->
+[% END %] <!-- [ IF changelogs ] -->
 

Modified: buildstat/trunk/buildstat-server/root/src/packages/list.tt2
===================================================================
--- buildstat/trunk/buildstat-server/root/src/packages/list.tt2	2008-09-01 20:58:18 UTC (rev 1192)
+++ buildstat/trunk/buildstat-server/root/src/packages/list.tt2	2008-09-01 22:04:05 UTC (rev 1193)
@@ -25,10 +25,39 @@
 [% END %]
 </h1>
 
-<table>
-<tr><th>Packages</th><th>Status</th><th>Lintian</th><th>Bugs</th><!--<th>Piuparts--></th><th>Synced<br />with<br />Debian</th><th>Synced<br />with<br />Upstream</th></tr>
+
+<div id="repositoriesmenu">
+
+
+[% FOREACH vcs IN vcses -%]
+  <a href="#" onclick="[% FOREACH vcs2 IN vcses -%]showhide('list[% vcs2.vcs_name %]');[% END %]return(false);">
+  [ [% vcs.repository_name _ ' ( ' _ vcs.vcs_name _ ' )' %] ] </a>
+
+[% END %]
+</div>
+
+
 [% # Display each book in a table row %]
 [% FOREACH package IN packages -%]
+
+
+[% IF current_vcs_name != package.vcs_name %]
+</table>
+</div>
+[% END %]
+
+[% IF current_vcs_name != package.vcs_name %]
+<div class="lists" id="list[% package.vcs_name %]" [% IF current_vcs_name != 'apt' %]style="display: none"[% END %] >
+<h1>[% package.repository_name _ ' ( ' _ package.vcs_name _ ' )' %]</h1>
+[% current_vcs_name = package.vcs_name %]
+<table>
+<tr><th>Packages</th><th>Status</th><th>Lintian</th><th>Bugs</th><!--<th>Piuparts--></th>[% IF current_vcs_name != 'apt' %]<th>Synced<br />with<br />Debian</th>[% END %]<th>Synced<br />with<br />Upstream</th></tr>
+[% END %]
+
+
+
+
+
       [% IF ! package.dscuri %]
         [% buildstatus = 'no-src-pkg' %] 
       [% ELSE %]
@@ -97,6 +126,8 @@
         [% IF ! package.needbuild && package.isbuildok %][% IF package.piupartsisok %]Succeed[% ELSE %]Failed[% END %][% END %]
       </a>
     </td>-->
+
+[% IF current_vcs_name != 'apt' %]
     <td [% IF package.isindebian %]class="ok"[% ELSE %]class="warning"[% END %]>
         [% IF ! package.isindebian %]Not uploaded yet<br />
 [% FOREACH bug IN package.currentpendingbug.split(',') %]
@@ -115,6 +146,7 @@
 
 
     </td>
+    [% END %]
     <td [% IF package.iswatchfilebroken || package.issyncedwithupstream == 0 %]class="error"[% ELSE %][% IF package.issyncedwithupstream == 1 || package.isnative == 1 %]class="ok"[% ELSE %]class="warning"[% END %][% END %]>
     <a href="[% Catalyst.uri_for('info/') _ package.name %]">
         [% IF package.isnative == 1 %]
@@ -132,3 +164,4 @@
   </tr>
 [% END -%]
 </table>
+</div>

Modified: buildstat/trunk/buildstat-server/root/src/ttsite.css
===================================================================
--- buildstat/trunk/buildstat-server/root/src/ttsite.css	2008-09-01 20:58:18 UTC (rev 1192)
+++ buildstat/trunk/buildstat-server/root/src/ttsite.css	2008-09-01 22:04:05 UTC (rev 1193)
@@ -266,6 +266,9 @@
 {
 
     max-width:800px;
+    background: #eee;
+    padding: 0.1em 1em 0.1em 0.1em;
+    margin-bottom: 1em;
 }
 
 .changelogtext




More information about the Collab-qa-commits mailing list