#!/usr/bonsaitools/bin/perl # -*- Mode: perl; indent-tabs-mode: nil -*- # # The contents of this file are subject to the Netscape 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/NPL/ # # 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 Bonsai CVS tool. # # 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. require 'CGI.pl'; print "Content-type: text/html\nRefresh: 300\n\n"; PutsHeader("Bonsai -- the art of effectively controlling trees", "Bonsai", "CVS Tree Control"); print ""; Lock(); LoadCheckins(); LoadMOTD(); LoadWhiteboard(); LoadTreeConfig(); Unlock(); if ($::TreeOpen) { $openword = 'OPEN'; } else { $openword = 'CLOSED'; } print "

\n"; if (Param('readonly')) { print "

Be aware that you are looking at an old hook!

\n"; } print "" . time2str("%D %T %Z", time()) . ": The tree is currently $openword
\n"; unless ($::TreeOpen) { print "The tree has been closed since " . MyFmtClock($::CloseTimeStamp) . ".
\n"; } print "The last known good tree had a timestamp of "; print time2str("%D %T %Z", $::LastGoodTimeStamp) . ".
"; print "
$::MOTD

"; print "
"; $bid_part = BatchIdPart('?'); print " Free-for-all whiteboard:
" . html_quote($::WhiteBoard) . "

\n"; foreach $checkin (@::CheckInList) { my $info = eval("\\\%$checkin"); my $addr = EmailFromUsername($$info{'person'}); $username{$addr} = $$info{'person'}; $people{$addr} .= " " if $people{$addr}; $people{$addr} .= "$checkin"; $closedcheckin{$addr} .= " $checkin" unless $$info{'treeopen'}; } $ldaperror = 0; if (%people) { my (@peoplelist, @list, $p, $i, $end, $checkins); my $ldapserver = Param('ldapserver'); my $ldapport = Param('ldapport'); print " The following people are on \"the hook\", since they have made checkins to the tree since it last opened:

\n"; @peoplelist = sort(keys %people); @list = @peoplelist; while (1) { last if ($#list < 0); $end = 19; $end = $#list if ($end >= $#list); GetInfoForPeople(splice(@list, 0, $end + 1)); } print " Can't contact the directory server at $ldapserver:$ldapport -- $errvar \n" if ($ldaperror); print " \n"; print "\n" if $ldapserver; foreach $p (@peoplelist) { my ($uname, $namepart, $extra) = ('', '', ''); if (exists($closedcheckin{$p})) { my $n = split(/\s+/, $closedcheckin{$p}); $extra = " ($n while tree closed!)"; } $uname = $username{$p}; ($namepart = $p) =~ s/\@.*//; $checkins = split(/\s+/, $people{$p}); print "\n"; print "\n"; print "\n"; print "\n"; print "\n\n"; } print "
WhoWhatHow to contact
$fullname{$p}" . GenerateUserLookUp($uname, $namepart, $p) . " $checkins "; print Pluralize('change', $checkins) . "$extra$curcontact{$p}\n" if $ldapserver; print "
\n\n"; $checkins = @::CheckInList; print Pluralize("$checkins checkin", $checkins) . ".

\n"; $mailaddr = join(',', @peoplelist) . "?subject=Hook%3a%20Build%20Problem"; $mailaddr .= "&cc=$::TreeInfo{$::TreeID}{cchookmail}" if (exists($::TreeInfo{$::TreeID}{cchookmail})); print " Show all checkins.
Send mail to \"the hook\".
\n"; } else { print "Nobody seems to have made any changes since the tree opened."; } $cvsqueryurl = "cvsqueryform.cgi?" . "cvsroot=$::TreeInfo{$::TreeID}{repository}" . "&module=$::TreeID"; $cvsqueryurl.= "&branch=$::TreeInfo{$::TreeID}{branch}" if ($::TreeInfo{$::TreeID}{branch}); $bip = BatchIdPart('?'); $tinderboxbase = Param('tinderboxbase'); $tinderboxlink = ''; $tinderboxlink = "Tinderbox continuous builds
" if ($tinderboxbase); $otherrefs = Param('other_ref_urls'); print "


Useful links Help and Documentation
CVS Query Tool
Switch to look at a different tree or branch
$tinderboxlink Time warp -- view a different day's hook.
See some stupid statistics about recent checkins.
Administration menu.
$otherrefs
" ; exit 0; sub GetInfoForPeople { my (@peoplelist) = @_; my ($p, $query, $isempty); my $ldapserver = Param('ldapserver'); my $ldapport = Param('ldapport'); my $ldapcmd; $query = "(| "; $isempty = 1; foreach $p (@peoplelist) { $query .= "(mail=$p) "; $fullname{$p} = ""; $curcontact{$p} = ""; } $query .= ")"; return if ($ldaperror || ($ldapserver eq '')); $ldapcmd = "./data/ldapsearch -b \"dc=netscape,dc=com\" " . "-h $ldapserver -p $ldapport -s sub " . "-S mail \"$query\" mail cn nscpcurcontactinfo"; unless (open(LDAP, "$ldapcmd |")) { $ldaperror = 1; } else { my $doingcontactinfo = 0; my $curperson; while () { chop; if ($doingcontactinfo) { if (/^ (.*)$/) { $curcontact{$curperson} .= "$1\n"; next; } $doingcontactinfo = 0; } if (/^mail: (.*\@.*)$/) { $curperson = $1; } elsif (/^cn: (.*)$/) { $fullname{$curperson} = $1; } elsif (/^nscpcurcontactinfo: (.*)$/) { $curcontact{$curperson} = "$1\n"; $doingcontactinfo = 1; } } close(LDAP); } }