use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UpgradeProcess method migrateLicenses.
/*
* public void identifyMigratedCompoents(ComponentInfo target) { if
* (!satisfiedAddedComponents(target)) { throw
* feedback.failure("UPGRADE_NoVersionSatisfiesComponents", null); } this.targetInfo = target;
* this.addComponents.addAll(findInstallables(target)); }
*/
public void migrateLicenses() {
if (!SystemUtils.isLicenseTrackingEnabled()) {
return;
}
feedback.output("UPGRADE_MigratingLicenses", input.getLocalRegistry().getGraalVersion().displayString(), targetInfo.getVersion().displayString());
for (Map.Entry<String, Collection<String>> e : input.getLocalRegistry().getAcceptedLicenses().entrySet()) {
String licId = e.getKey();
for (String compId : e.getValue()) {
try {
String t = input.getLocalRegistry().licenseText(licId);
ComponentInfo info = input.getLocalRegistry().findComponent(compId);
Date d = input.getLocalRegistry().isLicenseAccepted(info, licId);
newGraalRegistry.acceptLicense(info, licId, t, d);
} catch (FailedOperationException ex) {
feedback.error("UPGRADE_CannotMigrateLicense", ex, compId, licId);
}
}
}
// dirty way how to migrate GDS settings:
Path gdsSettings = SystemUtils.resolveRelative(input.getGraalHomePath(), CommonConstants.PATH_COMPONENT_STORAGE + "/gds");
if (Files.isDirectory(gdsSettings)) {
Path targetGdsSettings = SystemUtils.resolveRelative(newInstallPath.resolve(SystemUtils.getGraalVMJDKRoot(newGraalRegistry)), CommonConstants.PATH_COMPONENT_STORAGE + "/gds");
try {
SystemUtils.copySubtree(gdsSettings, targetGdsSettings);
} catch (IOException ex) {
feedback.error("UPGRADE_CannotMigrateGDS", ex, ex.getLocalizedMessage());
}
}
}
use of org.graalvm.component.installer.model.ComponentInfo 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.model.ComponentInfo in project graal by oracle.
the class UpgradeProcess method resetExistingComponents.
final void resetExistingComponents() {
existingComponents.clear();
existingComponents.addAll(input.getLocalRegistry().getComponentIDs().stream().filter((id) -> {
ComponentInfo info = input.getLocalRegistry().findComponent(id);
// only auto-include the 'leaf' components
return info != null && input.getLocalRegistry().findDependentComponents(info, false).isEmpty();
}).collect(Collectors.toList()));
existingComponents.remove(BundleConstants.GRAAL_COMPONENT_ID);
}
use of org.graalvm.component.installer.model.ComponentInfo 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.model.ComponentInfo in project graal by oracle.
the class ComponentPackageLoader method createBaseComponentInfo.
protected ComponentInfo createBaseComponentInfo() {
parse(() -> id = parseHeader(BundleConstants.BUNDLE_ID).parseSymbolicName(), () -> name = parseHeader(BundleConstants.BUNDLE_NAME).getContents(id), () -> version = parseHeader(BundleConstants.BUNDLE_VERSION).version(), () -> {
info = new ComponentInfo(id, name, version, findComponentTag());
info.addRequiredValues(parseHeader(BundleConstants.BUNDLE_REQUIRED).parseRequiredCapabilities());
info.addProvidedValues(parseHeader(BundleConstants.BUNDLE_PROVIDED, "").parseProvidedCapabilities());
info.setDependencies(parseHeader(BundleConstants.BUNDLE_DEPENDENCY, "").parseDependencies());
info.setStability(// to "".
parseHeader(BundleConstants.BUNDLE_STABILITY2, value(BundleConstants.BUNDLE_STABILITY)).parseStability());
});
supplyComponentTag();
return info;
}
Aggregations