Hi, as suggested by pabs, I made the new look non-default and optional, amended patch attached.
Greetings, Joachim -- Joachim "nomeata" Breitner Debian Developer nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata
From 8c82c53e360fcc01e5a7007af95c1b9968954402 Mon Sep 17 00:00:00 2001 From: Joachim Breitner <m...@joachim-breitner.de> Date: Mon, 20 May 2013 17:14:00 +0200 Subject: [PATCH] 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. This view is optional and configurable. --- data/buildd/buildd.pl | 134 ++++++++++++++++++++++++++++++++++++++++++++++++++ data/cronjobs/buildd | 12 +++++ wml/common-html.php | 4 ++ wml/developer.css | 47 ++++++++++++++++++ wml/developer.wml | 31 +++++++++++- 5 files changed, 227 insertions(+), 1 deletion(-) 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 <nome...@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/common-html.php b/wml/common-html.php index b0477d3..6d16135 100644 --- a/wml/common-html.php +++ b/wml/common-html.php @@ -434,6 +434,10 @@ function checkbox($value) $data = html_input_radio($value,"yes",!strcmp($arg_cookie[$value],"yes"),"yes\n") . html_br(); $data .= html_input_radio($value,"no",!strcmp($arg_cookie[$value],"no"),"no\n") . html_br(); $data .= html_input_radio($value,"only",!strcmp($arg_cookie[$value],"only"),"only\n") . html_br(); + } elseif ($value == 'buildd') { + $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"Show (1)\n") . html_br(); + $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"Hide (0)\n") . html_br(); + $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"Detail (2)\n") . html_br(); } $data = html_color($data,"green"); return $data; 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 096a04c..8f8a6c3 100644 --- a/wml/developer.wml +++ b/wml/developer.wml @@ -964,7 +964,7 @@ function print_package_entry($package, $uploader, $back_tr_color, $skip_seen) $line .= html_td($bin_display ? $bin_display : "-"); } - if(isdisplayed('buildd')) + if(isdisplayed('buildd') == 1) { if ($arch_all) { $buildd_display = html_td("-"); @@ -976,6 +976,23 @@ function print_package_entry($package, $uploader, $back_tr_color, $skip_seen) } $line .= $buildd_display; } + if(isdisplayed('buildd') == 2) + { + $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 .= "-"; + } + $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&suite=experimental","buildd-state"); + } + $line .= html_td($buildd_display); + } if(isdisplayed('problems')) { if(strcmp($version['stable'], "-") == 0 || !debcheckavailable('stable', $package)) @@ -1202,6 +1219,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.rc3
signature.asc
Description: This is a digitally signed message part