*/
ProcessExecution listRpmsProcess = new ProcessExecution(rpmExecutable);
listRpmsProcess.setArguments(new String[] { "-qa" });
listRpmsProcess.setCaptureOutput(true);
ProcessExecutionResults executionResults = systemInfo.executeProcess(listRpmsProcess);
String capturedOutput = executionResults.getCapturedOutput();
// Process the resulting output
if (capturedOutput == null) {
return packages;
}
BufferedReader rpmNameReader = new BufferedReader(new StringReader(capturedOutput));
String rpmName;
while ((rpmName = rpmNameReader.readLine()) != null) {
String name = null;
String version = null;
String architectureName = null;
try {
// Execute RPM query for each RPM
ProcessExecution rpmQuery = new ProcessExecution(rpmExecutable);
rpmQuery
.setArguments(new String[] {
"-q",
"--qf",
"%{NAME}\\n%{VERSION}.%{RELEASE}\\n%{ARCH}\\n%{INSTALLTIME}\\n%{FILEMD5S}\\n%{GROUP}\\n%{FILENAMES}\\n%{SIZE}\\n%{LICENSE}\\n%{DESCRIPTION}",
rpmName });
rpmQuery.setCaptureOutput(true);
ProcessExecutionResults rpmDataResults = systemInfo.executeProcess(rpmQuery);
String rpmData = rpmDataResults.getCapturedOutput();
BufferedReader rpmDataReader = new BufferedReader(new StringReader(rpmData));
name = rpmDataReader.readLine();
version = rpmDataReader.readLine();