use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeTest method testUpgradeToCompatibleVersionCommandline.
/**
* Tests "gu upgrade 1.0.1" on 1.0.1 installation. 1.0.1 core should be installed with ruby
* 1.0.1.1
*/
@Test
public void testUpgradeToCompatibleVersionCommandline() throws Exception {
initVersion("1.0.0.0");
textParams.add("1.0.1");
ComponentInfo ci = new ComponentInfo("org.graalvm.ruby", "Installed Ruby", "1.0.0.0");
storage.installed.add(ci);
UpgradeCommand cmd = new UpgradeCommand();
cmd.init(this, this);
assertEquals(0, cmd.execute());
ComponentRegistry newReg = cmd.getProcess().getNewGraalRegistry();
ComponentInfo ruby = newReg.findComponent("ruby");
assertEquals("1.0.1.1", ruby.getVersion().toString());
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class ComponentInstaller method completeEnvironment.
protected Environment completeEnvironment() {
if (env.getGraalHomePath() != null) {
return env;
}
findGraalHome();
env.setGraalHome(graalHomePath);
// Use our own GraalVM's trust store contents; also bypasses embedded trust store
// when running AOT.
Path trustStorePath = SystemUtils.resolveRelative(SystemUtils.getRuntimeBaseDir(env.getGraalHomePath()), // NOI18N
"lib/security/cacerts");
// NOI18N
System.setProperty("javax.net.ssl.trustStore", trustStorePath.normalize().toString());
DirectoryStorage storage = new DirectoryStorage(env, storagePath, graalHomePath);
storage.setConfig(env);
storage.setJavaVersion("" + SystemUtils.getJavaMajorVersion(env));
env.setLocalRegistry(new ComponentRegistry(env, storage));
FileOperations fops = FileOperations.createPlatformInstance(env, env.getGraalHomePath());
env.setFileOperations(fops);
// also sets up input and feedback.
forSoftwareChannels(true, (ch) -> {
ch.init(input, feedback);
});
return env;
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class RemoteStorageTest method loadCatalog.
private void loadCatalog(String s) throws IOException {
catalogProps.clear();
localRegistry = new ComponentRegistry(this, storage);
try (InputStream is = getClass().getResourceAsStream(s)) {
catalogProps.load(is);
}
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeProcess method createRegistryFor.
private ComponentRegistry createRegistryFor(Path home) {
DirectoryStorage dst = new DirectoryStorage(feedback.withBundle(ComponentInstaller.class), home.resolve(SystemUtils.fromCommonRelative(CommonConstants.PATH_COMPONENT_STORAGE)), home);
dst.setJavaVersion(input.getLocalRegistry().getJavaVersion());
return new ComponentRegistry(feedback, dst);
}
use of org.graalvm.component.installer.model.ComponentRegistry in project graal by oracle.
the class UpgradeProcess method failIfDirectotyExistsNotEmpty.
void failIfDirectotyExistsNotEmpty(Path target) throws IOException {
if (!Files.exists(target)) {
return;
}
if (!Files.isDirectory(target)) {
throw feedback.failure("UPGRADE_TargetExistsNotDirectory", null, target);
}
Path ghome = target.resolve(SystemUtils.getGraalVMJDKRoot(input.getLocalRegistry()));
Path relFile = ghome.resolve("release");
if (Files.isReadable(relFile)) {
Version targetVersion = null;
try {
ComponentRegistry reg = createRegistryFor(ghome);
targetVersion = reg.getGraalVersion();
} catch (FailedOperationException ex) {
// ignore
}
if (targetVersion != null) {
throw feedback.failure("UPGRADE_TargetExistsContainsGraalVM", null, target, targetVersion.displayString());
}
}
if (Files.list(target).findFirst().isPresent()) {
throw feedback.failure("UPGRADE_TargetExistsNotEmpty", null, target);
}
}
Aggregations