[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#709063: marked as done (developer.php: Show buildd status)



Your message dated Sun, 26 May 2013 15:27:32 +0800
with message-id <CAKTje6HRuQE9mfOJ_rhSQRWGiLLAqPqKyLd5TQCYGUAL0FN2Hg@mail.gmail.com>
and subject line Re: Bug#709063: developer.php: Show buildd status
has caused the Debian Bug report #709063,
regarding developer.php: Show buildd status
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
709063: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=709063
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: qa.debian.org
Severity: wishlist
Tags: patch

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

as discussed on IRC: Support for actually displaying the buildd status
on developer.php.

There are up to two lines, one for unstable and one (possibly) for
experiemntal). If the package is in good shape on all arches (Installed
or Not-For-Us), a summary is displayed, otherwise all arches are shown.

Pabs suggested to sum up the individual states, but I prefer it this
way, as it allows to spot with one glance what arches are affected, and
if one arch is doing particularly bad.

Cronjob script untested, the rest can be seen in action on
http://qa.debian.org/~nomeata/developer.php?login=nomeata

Thanks for review (if wanted) and merging.

Greetings,
Joachim


- -- System Information:
Debian Release: jessie/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (101, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.8-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iEYEARECAAYFAlGaPekACgkQ9ijrk0dDIGzp0gCgyZY9HxNLmebFClMAEj1mr5Ru
+oQAn1C9E2aXP2x67C4Ah/0257mXcRD6
=DXWw
-----END PGP SIGNATURE-----
>From 4334120f72a047496b26f72b669dc0c12a49c5a4 Mon Sep 17 00:00:00 2001
From: Joachim Breitner <mail@joachim-breitner.de>
Date: Mon, 20 May 2013 17:14:00 +0200
Subject: [PATCH 9/9] Show actual buildd state on developer.php

There are up to two lines, one for unstable and one (possibly) for
experiemntal). If the package is in good shape on all arches (Installed
or Not-For-Us), a summary is displayed, otherwise all arches are shown.

Pabs suggested to sum up the individual states, but I prefer it this
way, as it allows to spot with one glance what arches are affected, and
if one arch is doing particularly bad.
---
 data/buildd/buildd.pl | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++
 data/cronjobs/buildd  |  12 +++++
 wml/developer.css     |  47 ++++++++++++++++++
 wml/developer.wml     |  31 +++++++++---
 4 files changed, 217 insertions(+), 7 deletions(-)
 create mode 100755 data/buildd/buildd.pl
 create mode 100755 data/cronjobs/buildd

diff --git a/data/buildd/buildd.pl b/data/buildd/buildd.pl
new file mode 100755
index 0000000..1345923
--- /dev/null
+++ b/data/buildd/buildd.pl
@@ -0,0 +1,134 @@
+#!/usr/bin/perl -w
+
+# buildd.pl - extract buildd data from UDD for use in developers.php
+
+# Copyright (c) 2013 Joachim Breitner <nomeata@debian.org>
+
+
+# This script puts formatted html code in the berkely db. This reduces the load
+# on the webserver when generating the pages, and makes it easier to get a
+# consistent layout on different pages (e.g. developer.php and PTS).
+
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+use strict;
+use warnings;
+
+use DBI;
+use DB_File;
+
+my $dbh = DBI->connect( "dbi:Pg:service=udd" ) or die;
+
+my $db_filename = "/srv/qa.debian.org/data/buildd/buildd-new";
+$db_filename = "/home/nomeata/buildd";
+
+my %db;
+my $db_file = tie %db, "DB_File", "$db_filename.new.db", O_RDWR|O_CREAT|O_TRUNC, 0666, $DB_BTREE
+        or die "Can't open database $db_filename.new.db : $!";
+
+my @suites = ('sid', 'experimental');
+my %goodstate = (
+        'Successful' => 1,
+        'Installed' => 1,
+);
+my %okstate = (
+        'Successful' => 1,
+        'Installed' => 1,
+        'Not-For-Us' => 1,
+        'Auto-Not-For-Us' => 1,
+);
+my %wbstate = (
+        'BD-Uninstallable' => '∉',
+        'Build-Attempted' => '∿',
+        'Building' => '⚒',
+        'Maybe-Failed' => '✘', # originally '(✘)'
+        'Successful' => '✔', #originally '(✔)'
+        'Built' => '☺',
+        'Failed' => '✘',
+        'Failed-Removed' => '✘',
+        'Dep-Wait' => '⌚',
+        'Installed' => '✔',
+        'Needs-Build' => '⌂',
+        'Uploaded' => '♐',
+        'Not-For-Us' => '⎇',
+        'Auto-Not-For-Us' => '⎇', # originally  ' '
+);
+
+my $query = "SELECT
+               source,
+               distribution,
+               architecture,
+               state,
+               state_change
+             FROM
+               wannabuild
+             WHERE
+               distribution = ?
+             ORDER BY
+               source,
+               architecture";
+
+
+for my $suite ('sid','experimental') {
+    my $in = '';
+    if ($suite ne 'sid') { $in = sprintf " in %s", $suite };
+
+    my $sth = $dbh->prepare( $query );
+    $sth->execute($suite) or die;
+
+    my $source;
+    my $string = '';
+
+    my $count = 0;
+    my $bad = 0;
+    my $good = 0;
+
+    # I guess I am a functional programmer by heart
+    my $write_out = sub {
+        if ($bad) {
+            $db{"$source:$suite"} = $string;
+        } else {
+            $db{"$source:$suite"} = sprintf
+                '<span class="buildd-summary-state" title="Package in good shape on %d architecture%s %s">%d×<span class="buildd-state buildd-state-Installed">✓</span></span>',
+                $good,
+                $good == 1 ? '' : 's',
+                $in,
+                $good;
+        }
+        $source = undef;
+        $string = '';
+        $count = $bad = $good = 0;
+    };
+
+    while( my $row = $sth->fetchrow_hashref ) {
+        $write_out->() if (defined $source and $source ne $row->{source});
+
+        $count++;
+        $good++ if $goodstate{$row->{state}};
+        $bad++ unless $okstate{$row->{state}};
+        $source = $row->{source};
+        # strip seconds
+        my ($date) = $row->{state_change} =~ m/^(\d{4}-\d{2}-\d{2} \d{2}:\d{2})/;
+        $string .= sprintf '<span class="buildd-state buildd-state-%s" title="%s on %s%s since %s">%s</span>', $row->{state}, $row->{state}, $row->{architecture}, $in, $date, $wbstate{$row->{state}};
+    }
+    $write_out->() if (defined $source);
+}
+
+
+rename "$db_filename.new.db", "$db_filename.db";
+
+
+# vim: ts=4:expandtab:shiftwidth=4:
diff --git a/data/cronjobs/buildd b/data/cronjobs/buildd
new file mode 100755
index 0000000..24963b9
--- /dev/null
+++ b/data/cronjobs/buildd
@@ -0,0 +1,12 @@
+#!/bin/bash
+# The wanna build database is mirrored to UDD at 11 */3. Try to mirror shortly after that.
+# CRON=21 */3 * * *
+
+ROOT=/srv/qa.debian.org/data/buildd
+
+set -e
+set -o pipefail
+
+cd $ROOT
+
+./buildd.pl
diff --git a/wml/developer.css b/wml/developer.css
index 8ff0eb5..2abbbb3 100644
--- a/wml/developer.css
+++ b/wml/developer.css
@@ -51,3 +51,50 @@ h3 { margin-bottom: 0.5em; }
 table.settings td {
 	white-space: nowrap;
 }
+
+a.buildd-state span {
+    border-radius: .5ex;
+}
+
+a.buildd-state:link {
+    color: inherit;
+    text-decoration: none;
+}
+
+a.buildd-state:visited {
+    color: inherit;
+    text-decoration: none;
+}
+
+.buildd-state-Installed,
+.buildd-state-Uploaded {
+    // Original buildd style: background-color: #7fffd4;
+    color: #00aa00
+}
+
+.buildd-state-Building,
+.buildd-state-Not-For-Us,
+.buildd-state-Auto-Not-For-Us,
+.buildd-state-Dep-Wait,
+.buildd-state-Needs-Build,
+.buildd-state-BD-Uninstallable {
+    color: olive;
+}
+
+.buildd-state-Needs-Build {
+    background-color: #eeeedd;
+}
+
+.buildd-state-Failed,
+.buildd-state-Failed-Removed,
+.buildd-state-Build-Attempted,
+.buildd-state-Maybe-Failed {
+    background-color: #ffc0cb;
+}
+
+.buildd-state-Maybe-Successful,
+.buildd-state-Built {
+    color: green;
+}
+
+
diff --git a/wml/developer.wml b/wml/developer.wml
index 5507fbd..63b1152 100644
--- a/wml/developer.wml
+++ b/wml/developer.wml
@@ -966,15 +966,20 @@ function print_package_entry($package, $uploader, $back_tr_color, $skip_seen)
 
     if(isdisplayed('buildd'))
     {
-        if ($arch_all) {
-            $buildd_display = html_td("-");
+        $buildd_display = "";
+        $buildd_sid = dba_fetch("$package:sid", buildd_db());
+        if ($buildd_sid) {
+            $buildd_display .=
+                html_a($buildd_sid,"https://buildd.debian.org/status/package.php?p=$urlpackage","buildd-state";);
         } else {
-            $buildd_display = html_td(
-                html_a("Buildd", "https://buildd.debian.org/status/package.php?p=$urlpackage";) . html_br() .
-                html_a("Logs", "https://buildd.debian.org/status/logs.php?pkg=$urlpackage";)
-            );
+            $buildd_display .= "-";
+        }
+        $buildd_exp = dba_fetch("$package:experimental", buildd_db());
+        if ($buildd_exp) {
+            $buildd_display .= html_br() .
+                html_a($buildd_sid,"https://buildd.debian.org/status/package.php?p=$urlpackage&amp;suite=experimental","buildd-state";);
         }
-        $line .= $buildd_display;
+        $line .= html_td($buildd_display);
     }
 
     if(isdisplayed('problems')) {
@@ -1202,6 +1207,18 @@ function subscribe_db()
     return $subscribe_db;
 }
 
+function buildd_db()
+{
+    global $prefix;
+    static $buildd_db;
+
+    if( ! $buildd_db )
+        //$buildd_db = dba_open("/srv/qa.debian.org/data/buildd/buildd.db", 'r', 'db4');
+        $buildd_db = dba_open("/home/nomeata/buildd.db", 'r', 'db4');
+
+    return $buildd_db;
+}
+
 function wnpp_db()
 {
     global $prefix;
-- 
1.8.3.rc2


--- End Message ---
--- Begin Message ---
On Sat, May 25, 2013 at 11:47 PM, Joachim Breitner wrote:

> as suggested by pabs, I made the new look non-default and optional,
> amended patch attached.

Patch applied and made live.

-- 
bye,
pabs

http://wiki.debian.org/PaulWise

--- End Message ---

Reply to: