1998-10-17 05:54:40 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
|
|
|
# The contents of this file are subject to the Mozilla Public License
|
|
|
|
# Version 1.0 (the "License"); you may not use this file except in
|
|
|
|
# compliance with the License. You may obtain a copy of the License at
|
|
|
|
# http://www.mozilla.org/MPL/
|
|
|
|
#
|
|
|
|
# Software distributed under the License is distributed on an "AS IS"
|
|
|
|
# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
|
|
|
|
# License for the specific language governing rights and limitations
|
|
|
|
# under the License.
|
|
|
|
#
|
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
|
|
|
# Corporation. Portions created by Netscape are Copyright (C) 1998
|
|
|
|
# Netscape Communications Corporation. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s): Harrison Page <harrison@netscape.com>
|
|
|
|
# Terry Weissman <terry@mozilla.org>
|
|
|
|
|
|
|
|
# harrison@netscape.com
|
|
|
|
#
|
|
|
|
# 1.0 10/16/98
|
|
|
|
|
|
|
|
package Tinderbox;
|
|
|
|
|
|
|
|
require Exporter;
|
|
|
|
|
|
|
|
use strict 'vars';
|
|
|
|
use vars qw (@ISA @EXPORT $VERSION);
|
|
|
|
use LWP::Simple;
|
|
|
|
# use HTML::Parse;
|
|
|
|
use Carp;
|
|
|
|
|
|
|
|
@ISA = qw (Exporter);
|
1998-10-22 06:45:27 +04:00
|
|
|
@EXPORT = qw (status statuz);
|
1998-10-17 05:54:40 +04:00
|
|
|
|
|
|
|
my $VERSION = "1.0";
|
|
|
|
|
|
|
|
# status wants a reference to a list of tinderbox trees
|
|
|
|
# and a url ending with tree=, default to mozilla.org's
|
|
|
|
# server if not provided. status returns two references
|
|
|
|
# to hashes. the first contains tree names as key,
|
1998-10-22 06:45:27 +04:00
|
|
|
# tree status as value. second hash contains trees to
|
|
|
|
# whether or tree is open or closed.
|
1998-10-17 05:54:40 +04:00
|
|
|
#
|
|
|
|
# tree status can be horked or success.
|
|
|
|
#
|
1998-10-22 06:45:27 +04:00
|
|
|
# barf.
|
1998-10-17 05:54:40 +04:00
|
|
|
|
|
|
|
sub status
|
|
|
|
{
|
|
|
|
my $trees = shift;
|
|
|
|
my $url = shift;
|
1998-10-22 06:45:27 +04:00
|
|
|
my %info; my %tree_state;
|
|
|
|
|
1998-10-17 05:54:40 +04:00
|
|
|
# maybe this is too helpful
|
|
|
|
|
1998-10-22 06:45:27 +04:00
|
|
|
if (ref ($trees) ne "ARRAY")
|
1998-10-17 05:54:40 +04:00
|
|
|
{
|
1998-10-22 06:45:27 +04:00
|
|
|
carp "status method wants a reference to a list, not a " . ref ($trees);
|
|
|
|
return;
|
1998-10-17 05:54:40 +04:00
|
|
|
}
|
|
|
|
|
1998-10-22 06:45:27 +04:00
|
|
|
$url = $url || "http://cvs-mirror.mozilla.org/webtools/tinderbox/" .
|
|
|
|
"showbuilds.cgi?quickparse=1&tree=";
|
|
|
|
|
|
|
|
my $output = get $url . join ',', @$trees;
|
|
|
|
return if (! $output);
|
|
|
|
|
|
|
|
my @qp = split /\n/, $output;
|
|
|
|
|
|
|
|
# loop through quickparse output
|
|
|
|
|
|
|
|
foreach my $op (@qp)
|
|
|
|
{
|
|
|
|
my ($type, $tree, $build, $state) = split /\|/, $op;
|
|
|
|
|
|
|
|
if ($type eq "State")
|
|
|
|
{
|
|
|
|
$tree_state{$tree} = $state;
|
|
|
|
}
|
|
|
|
elsif ($type eq "Build")
|
|
|
|
{
|
1998-10-23 10:11:07 +04:00
|
|
|
if ($state =~ /success/i) {
|
|
|
|
$state = "Success";
|
1999-06-12 03:08:47 +04:00
|
|
|
} elsif ($state =~ /testfailed/i) {
|
|
|
|
$state = "Test Failed";
|
|
|
|
} else {
|
1998-10-23 10:11:07 +04:00
|
|
|
$state = "Horked";
|
|
|
|
}
|
|
|
|
$info{$tree}{$build} = $state;
|
1998-10-22 06:45:27 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return (\%info, \%tree_state);
|
|
|
|
}
|
1998-10-17 05:54:40 +04:00
|
|
|
|
|
|
|
1;
|