use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class UpgradeProcess method createGraalVMInstaller.
/**
* Completes the component info, loads symlinks, permissions. Same as
* {@link InstallCommand#createInstaller}.
*/
GraalVMInstaller createGraalVMInstaller(ComponentInfo info) throws IOException {
ComponentParam p = createGraalComponentParam(info);
MetadataLoader ldr = p.createFileLoader();
ldr.loadPaths();
if (p.isComplete()) {
Archive a;
a = ldr.getArchive();
a.verifyIntegrity(input);
}
ComponentInfo completeInfo = ldr.getComponentInfo();
targetInfo = completeInfo;
metaLoader = ldr;
GraalVMInstaller gvmInstaller = new GraalVMInstaller(feedback, input.getFileOperations(), input.getLocalRegistry(), completeInfo, catalog, metaLoader.getArchive());
// do not create symlinks if disabled, or target directory is given.
boolean disableSymlink = input.hasOption(Commands.OPTION_NO_SYMLINK) || input.hasOption(Commands.OPTION_TARGET_DIRECTORY);
gvmInstaller.setDisableSymlinks(disableSymlink);
// will make registrations for bundled components, too.
gvmInstaller.setAllowFilesInComponentDir(true);
gvmInstaller.setCurrentInstallPath(input.getGraalHomePath());
gvmInstaller.setInstallPath(newInstallPath);
gvmInstaller.setPermissions(ldr.loadPermissions());
gvmInstaller.setSymlinks(ldr.loadSymlinks());
newGraalHomePath = gvmInstaller.getInstalledPath();
return gvmInstaller;
}
use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class UpgradeProcess method satisfiedAddedComponents.
/**
* Checks if the candidate GraalVM satisfies all dependencies of added components. Added
* components are those specified on the commandline;
*
* @param candidate candidate GraalVM component
* @return broken components
*/
Collection<ComponentInfo> satisfiedAddedComponents(ComponentInfo candidate) throws IOException {
List<ComponentInfo> broken = new ArrayList<>();
Version gv = candidate.getVersion();
Version.Match satisfies = gv.match(Version.Match.Type.COMPATIBLE);
for (ComponentParam param : addComponents) {
ComponentInfo in = param.createMetaLoader().getComponentInfo();
String vs = in.getRequiredGraalValues().get(BundleConstants.GRAAL_VERSION);
Version cv = Version.fromString(vs);
if (!satisfies.test(cv)) {
broken.add(in);
if (minVersion.compareTo(cv) < 0) {
minVersion = cv;
}
}
}
return broken;
}
use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class QueryCommandBase method printComponents.
protected void printComponents() {
printHeader();
Iterator<ComponentParam> itpar = componentParams.iterator();
for (ComponentInfo info : components) {
printDetails(itpar.next(), info);
printFileList(info);
printSeparator(info);
}
}
use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class UpgradeCommand method configureProcess.
ComponentInfo configureProcess() throws IOException {
input.existingFiles().setVerifyJars(verifyJars);
Version min = input.getLocalRegistry().getGraalVersion();
String s = input.peekParameter();
Version v = min;
Version.Match filter = min.match(allowDistUpgrades() ? Version.Match.Type.MOSTRECENT : Version.Match.Type.COMPATIBLE);
if (s != null) {
try {
Version.Match.Type mt = Version.Match.Type.COMPATIBLE;
if (s.startsWith("=")) {
mt = Version.Match.Type.EXACT;
s = s.substring(1);
} else if (s.startsWith("+")) {
mt = Version.Match.Type.INSTALLABLE;
s = s.substring(1);
}
v = Version.fromUserString(s);
// cannot just compare user vs. graal, must match the user to the list of Graals to
// resolve the
// uncertaint parts (-x and possible suffix)
filter = v.match(mt);
if (min.compareTo(v) > 0) {
throw feedback.failure("UPGRADE_CannotDowngrade", null, v.displayString());
}
input.nextParameter();
input.existingFiles().matchVersion(filter);
} catch (IllegalArgumentException ex) {
// not a version, continue with component upgrade
}
}
// allow dist upgrade when searching for components
for (ComponentParam p : input.existingFiles()) {
helper.addComponent(p);
}
ComponentInfo info = helper.findGraalVersion(filter);
return info;
}
use of org.graalvm.component.installer.ComponentParam in project graal by oracle.
the class InstallCommand method execute.
@Override
public int execute() throws IOException {
executionInit();
if (input.optValue(Commands.OPTION_HELP) != null) {
feedback.output("INSTALL_Help");
return 0;
}
if (!input.hasParameter()) {
feedback.output("INSTALL_ParametersMissing");
return 1;
}
if (input.optValue(Commands.OPTION_LOCAL_DEPENDENCIES) != null && input.optValue(Commands.OPTION_FILES) == null) {
feedback.error("INSTALL_WarnLocalDependencies", null);
}
try {
executeStep(this::prepareInstallation, false);
if (validateBeforeInstall) {
return 0;
}
executeStep(this::acceptLicenses, false);
executeStep(this::completeInstallers, false);
executeStep(this::acceptLicenses, false);
executeStep(this::doInstallation, false);
// execute the post-install steps for all processed installers
executeStep(this::printMessages, true);
/*
* if (rebuildPolyglot && WARN_REBUILD_IMAGES) { Path p =
* SystemUtils.fromCommonString(CommonConstants.PATH_JRE_BIN);
* feedback.output("INSTALL_RebuildPolyglotNeeded", File.separator,
* input.getGraalHomePath().resolve(p).normalize()); }
*/
} finally {
for (Map.Entry<ComponentParam, Installer> e : realInstallers.entrySet()) {
ComponentParam p = e.getKey();
Installer i = e.getValue();
p.close();
if (i != null) {
i.close();
}
}
}
return 0;
}
Aggregations