use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class MergeStorage method loadComponentMetadata.
@Override
public Set<ComponentInfo> loadComponentMetadata(String id) throws IOException {
Set<ComponentInfo> cis = new HashSet<>();
for (SoftwareChannel swch : channels) {
Set<ComponentInfo> newInfos = swch.getStorage().loadComponentMetadata(id);
if (newInfos == null || newInfos.isEmpty()) {
continue;
}
if (!acceptAllSources) {
newInfos.removeAll(cis);
}
for (ComponentInfo ci : newInfos) {
ci.setPriority(getChannelPriority(swch));
channelMap.put(ci, swch);
}
cis.addAll(newInfos);
if (!acceptAllSources) {
break;
}
}
return cis;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class RemotePropertiesStorage method loadComponentMetadata.
@Override
public Set<ComponentInfo> loadComponentMetadata(String id) throws IOException {
Properties compProps = filterPropertiesForVersions(id);
if (compProps == null) {
return null;
}
Map<String, ComponentInfo> infos = new HashMap<>();
Set<String> processedPrefixes = new HashSet<>();
for (String s : compProps.stringPropertyNames()) {
int slashPos = s.indexOf('/');
int anotherSlashPos = s.indexOf('/', slashPos + 1);
String vS = s.substring(0, slashPos);
String identity = anotherSlashPos == -1 ? vS : s.substring(0, anotherSlashPos);
if (!processedPrefixes.add(identity)) {
continue;
}
try {
Version.fromString(vS);
} catch (IllegalArgumentException ex) {
feedback.verboseOutput("REMOTE_BadComponentVersion", s);
continue;
}
ComponentInfo ci = createVersionedComponent(identity + "/", compProps, id, anotherSlashPos == -1 ? "" : s.substring(slashPos + 1, anotherSlashPos));
// just in case the catalog info is broken
if (ci != null) {
infos.put(identity, ci);
}
}
return new HashSet<>(infos.values());
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class RemotePropertiesStorage method createVersionedComponent.
private ComponentInfo createVersionedComponent(String versoPrefix, Properties filtered, String id, String tag) throws IOException {
URL downloadURL;
String s = filtered.getProperty(versoPrefix + id.toLowerCase());
if (s == null) {
return null;
}
// try {
downloadURL = new URL(baseURL, s);
// NOI18N
String prefix = versoPrefix + id.toLowerCase() + "-";
String hashS = filtered.getProperty(prefix + PROPERTY_HASH);
byte[] hash = hashS == null ? null : toHashBytes(id, hashS);
ComponentPackageLoader ldr = new ComponentPackageLoader(tag, new PrefixedPropertyReader(prefix, filtered), feedback);
ComponentInfo info = ldr.createComponentInfo();
info.setRemoteURL(downloadURL);
info.setShaDigest(hash);
info.setOrigin(baseURL.toString());
return configureComponentInfo(info);
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class DirectoryStorage method getCoreInfo.
private ComponentInfo getCoreInfo() {
if (graalCore != null) {
return graalCore;
}
ComponentInfo ci = null;
try {
Path cmpFile = registryPath.resolve(SystemUtils.fileName(BundleConstants.GRAAL_COMPONENT_ID + COMPONENT_FILE_SUFFIX));
if (Files.isReadable(cmpFile)) {
ci = doLoadComponentMetadata(cmpFile, false);
if (ci != null && !BundleConstants.GRAAL_COMPONENT_ID.equals(ci.getId())) {
// invalid definition
ci = null;
}
}
} catch (IOException ex) {
// ignore
}
if (ci == null) {
Version v = getGraalVMVersion();
ci = new ComponentInfo(BundleConstants.GRAAL_COMPONENT_ID, feedback.l10n("NAME_GraalCoreComponent"), v.originalString());
// set defaults: bundled, supported.
ci.setStability(StabilityLevel.Supported);
}
Path cmpFile = registryPath.resolve(SystemUtils.fileName(BundleConstants.GRAAL_COMPONENT_ID + NATIVE_COMPONENT_FILE_SUFFIX));
if (Files.exists(cmpFile)) {
ci.setNativeComponent(true);
}
ci.setDistributionType(DistributionType.BUNDLED);
graalCore = ci;
return graalCore;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class CatalogInstallTest method testInstallDepsOnCommandLineCommon.
private void testInstallDepsOnCommandLineCommon() throws Exception {
paramIterable = new CatalogIterable(this, this);
textParams.add("r");
textParams.add("llvm-toolchain");
InstallCommand cmd = new InstallCommand();
cmd.init(this, withBundle(InstallCommand.class));
cmd.executionInit();
cmd.executeStep(cmd::prepareInstallation, false);
cmd.executeStep(cmd::completeInstallers, false);
List<Installer> instSequence = cmd.getInstallers();
assertEquals(2, instSequence.size());
ComponentInfo ci = instSequence.get(0).getComponentInfo();
assertEquals("org.graalvm.llvm-toolchain", ci.getId());
ci = instSequence.get(1).getComponentInfo();
assertEquals("org.graalvm.r", ci.getId());
}
Aggregations