20 private $NotRunning = FALSE;
21 private $Running = TRUE;
22 private $schedulerPid = -1;
40 if (empty($srcPath)) {
42 $this->srcPath =
'/home/fosstester/fossology';
46 $scrPath = rtrim($srcPath,
'/');
47 $this->srcPath = $srcPath .
"/fossology";
63 $fatalPat =
'/FATAL/';
66 $fMatches = preg_grep($fatalPat, file(
'fop.out'));
67 $eMatches = preg_grep($errPat, file(
'fop.out'));
68 if(empty($fMatches) && empty($eMatches))
70 print
"DEBUG: returning false, matched arrays are:\n";
71 print_r($fMatches) .
"\n";
72 print_r($eMatches) .
"\n";
89 $Tot =
'svn co https://fossology.svn.sourceforge.net/svnroot/fossology/trunk/fossology';
92 $home = rtrim($this->srcPath,
'/fossology');
95 $last = exec($Tot, $output, $rtn);
99 print
"ERROR! Could not check out FOSSology sources at\n$Tot\n";
100 print
"Error was: $output\n";
105 print
"ERROR! could not cd to $home\n";
119 $pLast = exec(
'ps -ef | grep scheduler | grep -v grep', $results, $rtn);
122 return ($this->NotRunning);
125 return ($this->Running);
128 private function getSchedPid() {
132 $cmd =
'ps -ef | grep fossology-scheduler | grep -v grep';
133 $psLast = exec($cmd, $results, $rtn);
139 $parts = explode(
' ', $psLast);
143 public function foPostinstall() {
145 if (!chdir($this->srcPath)) {
146 print
"Error can't cd to $this->srcPath\n";
148 $foLast = exec(
'sudo /usr/local/lib/fossology/fo-postinstall > fop.out 2>&1', $results, $rtn);
156 else {$cmd =
'ps -ef | grep fossology-scheduler | grep -v grep';
160 public function makeInstall() {
161 if (!chdir($this->srcPath)) {
162 print
"Error can't cd to $this->srcPath\n";
164 $miLast = exec(
'sudo make install > make-install.out 2>&1', $results, $rtn);
166 if (array_search(
'Error', $results)) {
179 public function makeSrcs() {
181 if (!chdir($this->srcPath)) {
182 print
"Error can't cd to $this->srcPath\n";
184 $mcLast = exec(
'make clean > make-clean.out 2>&1', $results, $rtn);
186 $makeLast = exec(
'make > make.out 2>&1', $results, $rtn);
190 if (array_search(
'Error', $results)) {
205 $StLast = exec(
'sudo /usr/local/lib/fossology/fossology-scheduler -t -L stdout > ST.out 2>&1', $results, $rtn);
207 if (array_search(
'FATAL', $results)) {
214 public function setSrcPath($path) {
225 return ($this->Running);
228 $stdStart = exec(
"sudo /etc/init.d/fossology start > /dev/null 2>&1 &", $results, $rtn);
231 return ($this->Running);
234 return ($this->NotRunning);
252 $stdStop = exec(
'sudo /etc/init.d/fossology stop 2>&1', $results, $rtn);
256 $this->schedulerPid = $this->getSchedPid();
258 if($this->schdulerPid === NULL)
262 $killLast = exec(
"sudo kill -9 $this->schedulerPid 2>&1", $results, $rtn);
274 if (!chdir($this->srcPath)) {
275 print
"Error can't cd to $this->srcPath\n";
277 $svnLast = exec(
'svn update', $results, $rtn);
__construct($srcPath=NULL)
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....