31 private $NotRunning = FALSE;
32 private $Running = TRUE;
33 private $schedulerPid = -1;
51 if (empty($srcPath)) {
53 $this->srcPath =
'/home/fosstester/fossology';
57 $scrPath = rtrim($srcPath,
'/');
58 $this->srcPath = $srcPath .
"/fossology";
74 $fatalPat =
'/FATAL/';
77 $fMatches = preg_grep($fatalPat, file(
'fop.out'));
78 $eMatches = preg_grep($errPat, file(
'fop.out'));
79 if(empty($fMatches) && empty($eMatches))
81 print
"DEBUG: returning false, matched arrays are:\n";
82 print_r($fMatches) .
"\n";
83 print_r($eMatches) .
"\n";
100 $Tot =
'svn co https://fossology.svn.sourceforge.net/svnroot/fossology/trunk/fossology';
103 $home = rtrim($this->srcPath,
'/fossology');
106 $last = exec($Tot, $output, $rtn);
110 print
"ERROR! Could not check out FOSSology sources at\n$Tot\n";
111 print
"Error was: $output\n";
116 print
"ERROR! could not cd to $home\n";
130 $pLast = exec(
'ps -ef | grep scheduler | grep -v grep', $results, $rtn);
133 return ($this->NotRunning);
136 return ($this->Running);
139 private function getSchedPid() {
143 $cmd =
'ps -ef | grep fossology-scheduler | grep -v grep';
144 $psLast = exec($cmd, $results, $rtn);
150 $parts = split(
' ', $psLast);
154 public function foPostinstall() {
156 if (!chdir($this->srcPath)) {
157 print
"Error can't cd to $this->srcPath\n";
159 $foLast = exec(
'sudo /usr/local/lib/fossology/fo-postinstall > fop.out 2>&1', $results, $rtn);
167 else {$cmd =
'ps -ef | grep fossology-scheduler | grep -v grep';
171 public function makeInstall() {
172 if (!chdir($this->srcPath)) {
173 print
"Error can't cd to $this->srcPath\n";
175 $miLast = exec(
'sudo make install > make-install.out 2>&1', $results, $rtn);
177 if (array_search(
'Error', $results)) {
190 public function makeSrcs() {
192 if (!chdir($this->srcPath)) {
193 print
"Error can't cd to $this->srcPath\n";
195 $mcLast = exec(
'make clean > make-clean.out 2>&1', $results, $rtn);
197 $makeLast = exec(
'make > make.out 2>&1', $results, $rtn);
201 if (array_search(
'Error', $results)) {
215 public function schedulerTest() {
216 $StLast = exec(
'sudo /usr/local/lib/fossology/fossology-scheduler -t -L stdout > ST.out 2>&1', $results, $rtn);
218 if (array_search(
'FATAL', $results)) {
225 public function setSrcPath($path) {
236 return ($this->Running);
239 $stdStart = exec(
"sudo /etc/init.d/fossology start > /dev/null 2>&1 &", $results, $rtn);
242 return ($this->Running);
245 return ($this->NotRunning);
263 $stdStop = exec(
'sudo /etc/init.d/fossology stop 2>&1', $results, $rtn);
267 $this->schedulerPid = $this->getSchedPid();
269 if($this->schdulerPid === NULL)
273 $killLast = exec(
"sudo kill -9 $this->schedulerPid 2>&1", $results, $rtn);
285 if (!chdir($this->srcPath)) {
286 print
"Error can't cd to $this->srcPath\n";
288 $svnLast = exec(
'svn update', $results, $rtn);
checkOutTot()
check out the top of trunk fossology sources. Uses attribute set by the constructor.
checkFop()
checks the output file from a fo-postinstall for the strings FATAL, error and Error. Assumes fop.out file is in the cwd.
__construct($srcPath=NULL)