49 public function __construct($sourcePath, $logPath=NULL)
51 if(empty($sourcePath))
53 $this->srcPath = getcwd();
57 $this->srcPath = $sourcePath;
61 $this->logPath = getcwd() .
"/fo_integration.log";
62 echo
"DB: logpath is:$this->logPath\n";
66 $this->logPath = $logPath;
67 echo
"DB: logpath is:$this->logPath\n";
70 $this->LOGFD = fopen($this->logPath,
'a+');
71 if($this->LOGFD === FALSE)
73 $error =
"Error! cannot open $this->logPath" .
" File: " . __FILE__ .
74 " on line: " . __LINE__;
75 throw new exception($error);
90 protected function log($message)
92 if(fwrite($this->LOGFD, $message) === FALSE)
95 echo
"WARNING! cannot write to log file, there may be no log messages\n";
136 parent::__construct($srcPath,$logPath);
137 if (!chdir($this->srcPath))
139 throw new exception(
"FATAL! can't cd to $this->srcPath\n");
141 $this->
log(
"Executing Make Clean\n");
142 $mcLast = exec(
'make clean > make-clean.out 2>&1', $results, $rtn);
144 $this->
log(
"Executing Make all\n");
145 $makeLast = exec(
'make > make.out 2>&1', $results, $rtn);
150 if (array_search(
'Error', $results))
154 throw new exception(
"Errors in make, inspect make.out for details\n");
159 throw new exception(
"Errors in make, inspect make.out for details\n");
make fossology, check for warnings and errors
log($message)
log a message in a file
base class for fossology integration.
__construct($srcPath, $logPath=NULL)
make fossology