use of com.synopsys.integration.detectable.detectables.bitbake.model.BitbakeNode in project synopsys-detect by blackducksoftware.
the class BitbakeDependencyGraphTransformer method buildGraph.
@NotNull
private DependencyGraph buildGraph(BitbakeGraph bitbakeGraph, Map<String, Dependency> namesToExternalIds) {
DependencyGraph dependencyGraph = new BasicDependencyGraph();
for (BitbakeNode bitbakeNode : bitbakeGraph.getNodes()) {
String name = bitbakeNode.getName();
if (namesToExternalIds.containsKey(name)) {
Dependency dependency = namesToExternalIds.get(bitbakeNode.getName());
dependencyGraph.addChildToRoot(dependency);
for (String child : bitbakeNode.getChildren()) {
if (namesToExternalIds.containsKey(child)) {
Dependency childDependency = namesToExternalIds.get(child);
dependencyGraph.addParentWithChild(dependency, childDependency);
}
}
}
}
return dependencyGraph;
}
use of com.synopsys.integration.detectable.detectables.bitbake.model.BitbakeNode in project synopsys-detect by blackducksoftware.
the class BitbakeDependencyGraphTransformer method generateExternalIds.
@NotNull
private Map<String, Dependency> generateExternalIds(BitbakeGraph bitbakeGraph, Map<String, List<String>> recipeLayerMap, Map<String, String> imageRecipes) {
Map<String, Dependency> namesToExternalIds = new HashMap<>();
for (BitbakeNode bitbakeNode : bitbakeGraph.getNodes()) {
String name = bitbakeNode.getName();
if (bitbakeNode.getVersion().isPresent()) {
String version = bitbakeNode.getVersion().get();
Optional<String> actualLayer = bitbakeNode.getLayer();
if (dependencyTypeFilter.shouldInclude(BitbakeDependencyType.BUILD) || !isBuildDependency(imageRecipes, name, version)) {
Optional<Dependency> dependency = generateExternalId(name, version, actualLayer.orElse(null), recipeLayerMap).map(Dependency::new);
dependency.ifPresent(value -> namesToExternalIds.put(bitbakeNode.getName(), value));
} else {
logger.debug("Excluding BUILD dependency: {}:{}", name, version);
}
} else if (name.startsWith(VIRTUAL_PREFIX)) {
logger.debug("Virtual component '{}' found. Excluding from graph.", name);
} else {
logger.debug("No version found for component '{}'. It is likely not a real component.", name);
}
}
return namesToExternalIds;
}
Aggregations