use of com.synopsys.integration.executable.ExecutableRunnerException in project synopsys-detect by blackducksoftware.
the class ClangPackageManagerRunner method applies.
public boolean applies(ClangPackageManager currentPackageManager, File workingDirectory, DetectableExecutableRunner executor) {
ClangPackageManagerInfo packageManagerInfo = currentPackageManager.getPackageManagerInfo();
try {
ExecutableOutput versionOutput = executor.execute(workingDirectory, packageManagerInfo.getPkgMgrName(), packageManagerInfo.getCheckPresenceCommandArgs());
logger.debug(String.format("packageStatusOutput: %s", versionOutput.getStandardOutput()));
if (versionOutput.getStandardOutput().contains(packageManagerInfo.getCheckPresenceCommandOutputExpectedText())) {
logger.debug(String.format("Found package manager %s", packageManagerInfo.getPkgMgrName()));
return true;
}
logger.debug(String.format("Output of %s %s does not look right; concluding that the %s package manager is not present. The output: %s", packageManagerInfo.getPkgMgrName(), packageManagerInfo.getCheckPresenceCommandArgs(), packageManagerInfo.getPkgMgrName(), versionOutput));
} catch (ExecutableRunnerException e) {
logger.debug(String.format("Error executing %s %s; concluding that the %s package manager is not present. The error: %s", packageManagerInfo.getPkgMgrName(), packageManagerInfo.getCheckPresenceCommandArgs(), packageManagerInfo.getPkgMgrName(), e.getMessage()));
return false;
}
return false;
}
use of com.synopsys.integration.executable.ExecutableRunnerException in project synopsys-detect by blackducksoftware.
the class ClangPackageManagerRunner method getPackages.
public PackageDetailsResult getPackages(ClangPackageManager currentPackageManager, File workingDirectory, DetectableExecutableRunner executableRunner, File dependencyFile) {
ClangPackageManagerInfo packageManagerInfo = currentPackageManager.getPackageManagerInfo();
Set<PackageDetails> dependencyDetails = new HashSet<>();
Set<File> unRecognizedDependencyFiles = new HashSet<>();
try {
List<String> fileSpecificGetOwnerArgs = new ArrayList<>(packageManagerInfo.getPkgMgrGetOwnerCmdArgs());
fileSpecificGetOwnerArgs.add(dependencyFile.getAbsolutePath());
ExecutableOutput queryPackageResult = executableRunner.execute(workingDirectory, packageManagerInfo.getPkgMgrCmdString(), fileSpecificGetOwnerArgs);
String queryPackageOutputToParse;
if (StringUtils.isNotBlank(queryPackageResult.getStandardOutput())) {
queryPackageOutputToParse = queryPackageResult.getStandardOutput();
} else {
queryPackageOutputToParse = queryPackageResult.getErrorOutput();
}
ClangPackageManagerResolver resolver = currentPackageManager.getPackageResolver();
List<PackageDetails> packageDetails = resolver.resolvePackages(currentPackageManager.getPackageManagerInfo(), executableRunner, workingDirectory, queryPackageOutputToParse);
dependencyDetails.addAll(packageDetails);
} catch (NotOwnedByAnyPkgException notOwnedException) {
logger.debug(String.format("%s is not recognized by the linux package manager (%s)", dependencyFile.getAbsolutePath(), notOwnedException.getMessage()));
unRecognizedDependencyFiles.add(dependencyFile);
} catch (ExecutableRunnerException e) {
logger.debug(String.format("Error with dependency file %s when running %s", dependencyFile.getAbsolutePath(), packageManagerInfo.getPkgMgrCmdString()));
logger.error(String.format("Error executing %s: %s", packageManagerInfo.getPkgMgrCmdString(), e.getMessage()));
}
return new PackageDetailsResult(dependencyDetails, unRecognizedDependencyFiles);
}
use of com.synopsys.integration.executable.ExecutableRunnerException in project synopsys-detect by blackducksoftware.
the class DpkgPkgDetailsResolver method resolvePackageDetails.
public Optional<PackageDetails> resolvePackageDetails(ClangPackageManagerInfo currentPackageManager, DetectableExecutableRunner executableRunner, File workingDirectory, NameArchitecture packageNameArchitecture) {
try {
List<String> args = new ArrayList<>(currentPackageManager.getPkgInfoArgs().get());
args.add(constructPackageArg(packageNameArchitecture.getName(), packageNameArchitecture.getArchitecture().orElse(null)));
ExecutableOutput packageInfoOutput = executableRunner.execute(workingDirectory, currentPackageManager.getPkgMgrCmdString(), args);
return parsePackageDetailsFromInfoOutput(packageNameArchitecture.getName(), packageInfoOutput.getStandardOutput());
} catch (ExecutableRunnerException e) {
logger.warn(String.format("Error executing %s to get package info: %s", currentPackageManager.getPkgMgrName(), e.getMessage()));
}
return Optional.empty();
}
use of com.synopsys.integration.executable.ExecutableRunnerException in project synopsys-detect by blackducksoftware.
the class DotNetRuntimeFinder method listAvailableRuntimes.
public List<String> listAvailableRuntimes() throws DetectableException {
try {
ExecutableOutput runtimesOutput = dotnetListRuntimes();
List<String> foundRuntimes = runtimesOutput.getStandardOutputAsList().stream().map(StringUtils::trimToEmpty).filter(StringUtils::isNotBlank).collect(Collectors.toList());
logger.info("Found {} available dotnet runtimes", foundRuntimes.size());
if (foundRuntimes.isEmpty()) {
throw new DetectableException("No available dotnet runtimes");
}
return foundRuntimes;
} catch (ExecutableRunnerException e) {
throw new DetectableException("Could not determine available dotnet runtimes", e);
}
}
Aggregations