use of org.graalvm.component.installer.Archive in project graal by oracle.
the class InstallVersionsTest method overrideCreateInstaller.
@SuppressWarnings("unused")
protected Installer overrideCreateInstaller(ComponentParam p, MetadataLoader ldr) throws IOException {
ComponentInfo partialInfo;
partialInfo = ldr.getComponentInfo();
ldr.loadPaths();
Archive a = null;
Installer inst = new Installer(this, getFileOperations(), partialInfo, getLocalRegistry(), getRegistry(), a);
inst.setPermissions(ldr.loadPermissions());
inst.setSymlinks(ldr.loadSymlinks());
return inst;
}
use of org.graalvm.component.installer.Archive 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.Archive 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.Archive in project graal by oracle.
the class LicensePresenter method loadFileLicenseText.
String loadFileLicenseText(MetadataLoader ldr) throws IOException {
// may require a download of the archive
try (Archive a = ldr.getArchive()) {
String licensePath = ldr.getLicensePath();
Archive.FileEntry licenseEntry = null;
for (Archive.FileEntry e : a) {
String n = e.getName();
if (n.startsWith("/")) {
n = n.substring(1);
} else if (n.startsWith("./")) {
n = n.substring(2);
}
if (n.equals(licensePath)) {
licenseEntry = e;
break;
}
}
if (licenseEntry == null) {
throw new IOException(feedback.l10n("INSTALL_LicenseNotFound", licensePath));
}
try (InputStream es = a.getInputStream(licenseEntry);
InputStreamReader esr = new InputStreamReader(es, "UTF-8");
BufferedReader buf = new BufferedReader(esr)) {
// NOI18N
return buf.lines().collect(Collectors.joining("\n"));
}
}
}
Aggregations