Search in sources :

Example 16 with ComponentParam

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

the class InstallCommand method printRequiredComponents.

void printRequiredComponents() throws IOException {
    if (dependencies.isEmpty()) {
        return;
    }
    feedback.output("INSTALL_RequiredDependencies");
    for (ComponentParam p : dependencies) {
        ComponentInfo ci = p.createMetaLoader().getComponentInfo();
        feedback.output("INSTALL_RequiredDependencyLine", p.getDisplayName(), ci.getId(), ci.getVersion().displayString(), printComponentList(dependencyMap.get(ci.getId())));
    }
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo)

Example 17 with ComponentParam

use of org.graalvm.component.installer.ComponentParam 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 18 with ComponentParam

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

the class InfoCommand method filePath.

protected String filePath(ComponentInfo info) {
    ComponentParam p = files.get(info);
    if (fullPath) {
        return p.getFullPath();
    } else {
        String s = p.getShortName();
        int idx = s.lastIndexOf('.');
        return idx == -1 ? s : s.substring(0, idx);
    }
}
Also used : ComponentParam(org.graalvm.component.installer.ComponentParam)

Example 19 with ComponentParam

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

the class RemoteCatalogDownloaderTest method testSingleNonMatchingCatalogIgnored.

/**
 * Checks that if a single catalog does not correspond to graalvm version, other catalogs will
 * be read.
 *
 * @throws Exception
 */
@Test
public void testSingleNonMatchingCatalogIgnored() throws Exception {
    setupJoinedCatalog("catalogMultiPart1.properties");
    ComponentCatalog col = openCatalog(rcd);
    // need to incorporate requirements, too... they are tested in CatalogIterable
    CatalogIterable catIt = new CatalogIterable(this, this);
    catIt.setRemoteRegistry(col);
    textParams.add("r");
    textParams.add("ruby");
    textParams.add("python");
    Iterator<ComponentParam> iter = catIt.iterator();
    ComponentParam p = iter.next();
    ComponentInfo info;
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    p = iter.next();
    assertNotNull(p);
    info = p.createMetaLoader().getComponentInfo();
    assertEquals("1.0.0.0", info.getVersion().toString());
    // python cannot be found, an exception expected
    assertTrue(iter.hasNext());
    try {
        p = iter.next();
        fail("No python for 1.0.0");
    } catch (FailedOperationException ex) {
    }
}
Also used : ComponentCatalog(org.graalvm.component.installer.ComponentCatalog) FailedOperationException(org.graalvm.component.installer.FailedOperationException) ComponentParam(org.graalvm.component.installer.ComponentParam) ComponentInfo(org.graalvm.component.installer.model.ComponentInfo) Test(org.junit.Test)

Example 20 with ComponentParam

use of org.graalvm.component.installer.ComponentParam 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)

Aggregations

ComponentParam (org.graalvm.component.installer.ComponentParam)24 ComponentInfo (org.graalvm.component.installer.model.ComponentInfo)19 Test (org.junit.Test)11 MetadataLoader (org.graalvm.component.installer.persist.MetadataLoader)6 CatalogIterable (org.graalvm.component.installer.remote.CatalogIterable)5 ComponentInstaller (org.graalvm.component.installer.ComponentInstaller)4 Version (org.graalvm.component.installer.Version)4 ArrayList (java.util.ArrayList)3 IOException (java.io.IOException)2 URL (java.net.URL)2 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 List (java.util.List)2 Map (java.util.Map)2 Archive (org.graalvm.component.installer.Archive)2 CommandInput (org.graalvm.component.installer.CommandInput)2 ComponentCatalog (org.graalvm.component.installer.ComponentCatalog)2 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 Path (java.nio.file.Path)1