# # Copyright (c) 2002-2004 Eric Wallengren # This file is part of the Continuous Automated Build and Integration # Environment (CABIE) # # CABIE is distributed under the terms of the GNU General Public # License version 2 or any later version. See the file COPYING for copying # permission or http://www.gnu.org. # # THIS MATERIAL IS PROVIDED AS IS, WITH ABSOLUTELY NO WARRANTY EXPRESSED OR # IMPLIED, without even the implied warranty of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. ANY USE IS AT YOUR OWN RISK. # # Permission to modify the code and to distribute modified code is granted, # provided the above notices are retained, and a notice that the code was # modified is included with the above copyright notice. # package Bldsvr; BEGIN{push @LIB, "lib";} our ($VERSION); $VERSION = "1.0"; use Exporter; use Sys::Hostname; my $hostname = hostname(); require "$hostname.pm"; my $config = new $hostname; my $null = $config->NULL; @ISA = qw/ Exporter AutoLoader /; @EXPORT = qw/ exec_it cmd_array /; sub exec_it { my $command = shift; my $output = shift; my @myout; open (I,"$command 2>$null|") || die "open: $command $!"; @myout = ; close(I); # || die "close: $command $!"; open (O, ">$output") || die "open: $output $!"; foreach $item (@myout) { print O "$item"; } close(O) # || die "close: $output $!"; } sub cmd_array { open (DIRFD, "$_[0]|"); my @psarray = ; close (DIRFD); unshift(@psarray, "\n"); return @psarray; } sub get_job_list { my %JobTable; my $configfile = shift; if (! -f $configfile) { return %JobTable; } open (F, "<$configfile") || die "open: $configfile $!"; while () { chomp; # remove newline $x = index($_, "#"); if ($x != 0) { @BldArray = split(/;/); $JobTable{"$BldArray[0]"} = ""; } } close(F); } 1;