use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class LicensePresenter method filterAcceptedLicenses.
public void filterAcceptedLicenses() {
for (String licId : new ArrayList<>(licensesToAccept.keySet())) {
Collection<MetadataLoader> loaders = licensesToAccept.get(licId);
for (MetadataLoader ldr : new ArrayList<>(loaders)) {
ComponentInfo ci = ldr.getComponentInfo();
// query the metadata loader (possibly delegates to original software channel
// provider).
Date accepted = ldr.isLicenseAccepted(ci, licId);
if (accepted == null) {
accepted = localRegistry.isLicenseAccepted(ci, licId);
}
if (accepted != null) {
feedback.verboseOutput("INSTALL_LicenseAcceptedAt", ldr.getLicenseType(), accepted, ci.getId(), ci.getName());
loaders.remove(ldr);
}
}
if (loaders.isEmpty()) {
licensesToAccept.remove(licId);
}
}
multiLicenses = licensesToAccept.size() > 1;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class PreRemoveCommand method execute.
@Override
public int execute() throws IOException {
String compId;
PreRemoveProcess pp = new PreRemoveProcess(input.getGraalHomePath(), input.getFileOperations(), feedback);
while ((compId = input.nextParameter()) != null) {
ComponentInfo info = input.getLocalRegistry().loadSingleComponent(compId.toLowerCase(), true);
if (info != null) {
pp.addComponentInfo(info);
}
}
pp.run();
return 0;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InstallCommand method completeInstallers0.
void completeInstallers0(List<ComponentParam> in) throws IOException {
// now fileName real installers for parameters which were omitted
for (ComponentParam p : in) {
Installer i = realInstallers.get(p);
if (i == null) {
MetadataLoader floader = p.createFileLoader();
ComponentInfo initialInfo = parameterInfos.get(p);
ComponentInfo finfo = floader.getComponentInfo();
if (initialInfo != null && (!initialInfo.getId().equals(finfo.getId()) || !initialInfo.getVersion().equals(finfo.getVersion()))) {
String msg = String.format(feedback.l10n("@INSTALL_Error_ComponentDiffers_Report"), initialInfo.getId(), finfo.getId(), initialInfo.getVersionString(), finfo.getVersionString());
feedback.verbatimPart(msg, true, false);
throw feedback.failure("INSTALL_Error_ComponentDiffers", null);
}
i = createInstaller(p, floader);
if (!verifyInstaller(i)) {
continue;
}
addLicenseToAccept(i, floader);
registerComponent(i, p);
if (validateBeforeInstall) {
current = i.getComponentInfo().getName();
i.validateAll();
} else {
if (!force) {
i.validateRequirements();
}
}
realInstallers.put(p, i);
}
}
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class InstallCommand method createInstaller.
Installer createInstaller(ComponentParam p, MetadataLoader ldr) throws IOException {
ComponentInfo partialInfo;
partialInfo = ldr.getComponentInfo();
parameterInfos.putIfAbsent(p, partialInfo);
feedback.verboseOutput("INSTALL_PrepareToInstall", p.getDisplayName(), partialInfo.getId(), partialInfo.getVersionString(), partialInfo.getName());
ldr.loadPaths();
Archive a = null;
if (p.isComplete()) {
a = ldr.getArchive();
a.verifyIntegrity(input);
}
Installer inst = new Installer(feedback, input.getFileOperations(), partialInfo, input.getLocalRegistry(), input.getRegistry(), a);
inst.setPermissions(ldr.loadPermissions());
inst.setSymlinks(ldr.loadSymlinks());
configureInstaller(inst);
return inst;
}
use of org.graalvm.component.installer.model.ComponentInfo in project graal by oracle.
the class UninstallCommand method prepareUninstall.
void prepareUninstall() {
String compId;
while ((compId = input.nextParameter()) != null) {
if (toUninstall.containsKey(compId)) {
continue;
}
ComponentInfo info = input.getLocalRegistry().loadSingleComponent(compId.toLowerCase(), true);
if (info == null) {
throw feedback.failure("UNINSTALL_UnknownComponentId", null, compId);
}
if (info.getId().equals(BundleConstants.GRAAL_COMPONENT_ID)) {
throw feedback.failure("UNINSTALL_CoreComponent", null, compId);
}
if (info.isNativeComponent()) {
throw feedback.failure("UNINSTALL_NativeComponent", null, info.getId(), info.getName());
}
if (info.getDistributionType() != DistributionType.OPTIONAL) {
throw feedback.failure("UNINSTALL_BundledComponent", null, info.getId(), info.getName());
}
toUninstall.put(compId, info);
}
if (input.hasOption(Commands.OPTION_NO_DEPENDENCIES)) {
return;
}
for (ComponentInfo u : toUninstall.values()) {
Set<ComponentInfo> br = registry.findDependentComponents(u, true);
if (!br.isEmpty()) {
brokenDependencies.put(u, br);
}
}
}
Aggregations