Search in sources :

Example 11 with MetadataLoader

use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.

the class LicensePresenter method isLicenseRemote.

boolean isLicenseRemote(String licenseId) {
    MetadataLoader ldr = licensesToAccept.get(licenseId).get(0);
    String licPath = ldr.getLicensePath();
    // NOI18N
    return SystemUtils.isRemotePath(licPath);
}
Also used : MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader)

Example 12 with MetadataLoader

use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.

the class InstallCommand method processComponents.

protected void processComponents(Iterable<ComponentParam> toProcess) throws IOException {
    for (Iterator<ComponentParam> it = toProcess.iterator(); it.hasNext(); ) {
        appendParameterText();
        ComponentParam p = it.next();
        feedback.output(p.isComplete() ? "INSTALL_VerboseProcessingArchive" : "INSTALL_VerboseProcessingComponent", p.getDisplayName());
        current = p.getSpecification();
        MetadataLoader ldr = validateDownload ? p.createFileLoader() : p.createMetaLoader();
        Installer inst = createInstaller(p, ldr);
        if (!verifyInstaller(inst)) {
            continue;
        }
        if (registerComponent(inst, p)) {
            addLicenseToAccept(inst, ldr);
            if (p.isComplete()) {
                // null realInstaller will be handled in completeInstallers() later.
                realInstallers.put(p, inst);
            } else {
                realInstallers.put(p, null);
            }
        }
        current = null;
        URL remote = ldr.getComponentInfo().getRemoteURL();
        if (remote == null || remote.getProtocol().equalsIgnoreCase("file")) {
            wasFile = true;
        }
    }
}
Also used : ComponentInstaller(org.graalvm.component.installer.ComponentInstaller) ComponentParam(org.graalvm.component.installer.ComponentParam) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) URL(java.net.URL)

Example 13 with MetadataLoader

use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.

the class InfoCommand method processComponentParam.

void processComponentParam(ComponentParam cp) throws IOException {
    MetadataLoader ldr = cp.createMetaLoader();
    components.add(cp);
    loadComponentDetails(cp, ldr);
    // registerFile(f, ldr.getComponentInfo(), ldr);
    addComponent(cp, ldr.getComponentInfo());
}
Also used : MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader)

Example 14 with MetadataLoader

use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.

the class UpgradeTest method testUpgradeWithDependencies.

/**
 * Upgrade an installation with "ruby" to a newer one, where "ruby" has a dependency on an
 * additional component. The other component should be auto-installed.
 */
@Test
public void testUpgradeWithDependencies() throws Exception {
    initVersion("1.0.0.0", "../repo/catalog-19.3.properties");
    ComponentInfo ci = new ComponentInfo("org.graalvm.r", "Installed R", "1.0.0.0");
    storage.installed.add(ci);
    UpgradeCommand cmd = new UpgradeCommand();
    cmd.init(this, this);
    textParams.add("r");
    ComponentInfo graalInfo = cmd.configureProcess();
    assertNotNull(graalInfo);
    assertEquals(Version.fromString("19.3.0.0"), graalInfo.getVersion());
    boolean installed = cmd.getProcess().installGraalCore(graalInfo);
    assertTrue(installed);
    factory = new CatalogFactory() {

        @Override
        public ComponentCatalog createComponentCatalog(CommandInput in) {
            RemoteCatalogDownloader dnl = new RemoteCatalogDownloader(in, UpgradeTest.this, downloader.getOverrideCatalogSpec());
            // carry over the override spec
            return new CatalogContents(UpgradeTest.this, dnl.getStorage(), in.getLocalRegistry());
        }

        @Override
        public List<GraalEdition> listEditions(ComponentRegistry targetGraalVM) {
            return Collections.emptyList();
        }
    };
    InstallTrampoline targetInstall = new InstallTrampoline();
    cmd.getProcess().configureInstallCommand(targetInstall);
    targetInstall.executionInit();
    targetInstall.prepareInstallation();
    assertTrue(targetInstall.getUnresolvedDependencies().isEmpty());
    List<ComponentParam> deps = targetInstall.getDependencies();
    assertEquals(1, deps.size());
    MetadataLoader ldr = deps.iterator().next().createFileLoader();
    assertEquals("org.graalvm.llvm-toolchain", ldr.getComponentInfo().getId());
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) ComponentParam(org.graalvm.component.installer.ComponentParam) MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) CommandInput(org.graalvm.component.installer.CommandInput) ComponentRegistry(org.graalvm.component.installer.model.ComponentRegistry) CatalogContents(org.graalvm.component.installer.model.CatalogContents) RemoteCatalogDownloader(org.graalvm.component.installer.remote.RemoteCatalogDownloader) List(java.util.List) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 15 with MetadataLoader

use of org.graalvm.component.installer.persist.MetadataLoader in project graal by oracle.

the class CatalogIterableTest method testCreateMetaLoader.

@Test
public void testCreateMetaLoader() throws Exception {
    initRemoteComponent("persist/data/truffleruby3.jar", "test://graalvm.io/download/truffleruby.zip", "testComponent", "test");
    MetadataLoader ldr = param.createMetaLoader();
    ldr.setNoVerifySymlinks(false);
    ldr.loadPaths();
    ldr.loadPermissions();
    ldr.loadSymlinks();
    ComponentInfo meta = ldr.getComponentInfo();
    assertEquals("ruby", meta.getId());
    assertNull(meta.getInfoPath());
    assertNull(meta.getLicensePath());
    assertTrue(meta.getPaths().isEmpty());
    assertEquals("TruffleRuby 0.33-dev", meta.getName());
    assertEquals("0.33-dev", meta.getVersionString());
    assertFalse(Handler.isVisited(url));
}
Also used : MetadataLoader(org.graalvm.component.installer.persist.MetadataLoader) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Aggregations

MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)15 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)9 ComponentParam (org.graalvm.component.installer.ComponentParam)5 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)2 ComponentInstaller (org.graalvm.component.installer.ComponentInstaller)2 IOException (java.io.IOException)1 URL (java.net.URL)1 Path (java.nio.file.Path)1 Date (java.util.Date)1 List (java.util.List)1 Archive (org.graalvm.component.installer.Archive)1 CommandInput (org.graalvm.component.installer.CommandInput)1 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)1 DependencyException (org.graalvm.component.installer.DependencyException)1 InstallerStopException (org.graalvm.component.installer.InstallerStopException)1 UserAbortException (org.graalvm.component.installer.UserAbortException)1 Version (org.graalvm.component.installer.Version)1 JarArchive (org.graalvm.component.installer.jar.JarArchive)1 CatalogContents (org.graalvm.component.installer.model.CatalogContents)1