diff options
author | Torbjörn Svensson | 2021-04-24 13:28:05 +0000 |
---|---|---|
committer | Mickael Istria | 2021-06-28 15:29:27 +0000 |
commit | 3415227e9f015647b1dedf2407dd62510e7ac1c4 (patch) | |
tree | 378b13a1bfe602d70270ae5d18c4264d8b3351c3 | |
parent | b3de3dad4aa1bfe90eaa8cdc5081c80a1bbea9d9 (diff) | |
download | rt.equinox.p2-I20210629-0210.tar.gz rt.equinox.p2-I20210629-0210.tar.xz rt.equinox.p2-I20210629-0210.zip |
Bug 573131: Make bundlepool installations relocatableY20210629-0800I20210629-0210I20210628-1800
Contributed by STMicroelectronics
Change-Id: I399899441fd926ad4bf89eb64360bd3f213a7320
Signed-off-by: Torbjörn Svensson <torbjorn.svensson@st.com>
Reviewed-on: https://git.eclipse.org/r/c/equinox/rt.equinox.p2/+/179791
Reviewed-by: Mickael Istria <mistria@redhat.com>
Tested-by: Equinox Bot <equinox-bot@eclipse.org>
4 files changed, 14 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF index 4a87a87e3..655b1355f 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.equinox.frameworkadmin.equinox;singleton:=true -Bundle-Version: 1.2.0.qualifier +Bundle-Version: 1.2.100.qualifier Bundle-Vendor: %providerName Bundle-Localization: plugin Import-Package: org.eclipse.equinox.frameworkadmin;version="[2.0.0,3.0.0)", diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml b/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml index b271efaa0..bb863c49b 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/pom.xml @@ -9,6 +9,6 @@ </parent> <groupId>org.eclipse.equinox</groupId> <artifactId>org.eclipse.equinox.frameworkadmin.equinox</artifactId> - <version>1.2.0-SNAPSHOT</version> + <version>1.2.100-SNAPSHOT</version> <packaging>eclipse-plugin</packaging> </project> diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java index 1dd81817b..829753a25 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EclipseLauncherParser.java @@ -34,7 +34,7 @@ public class EclipseLauncherParser { //this figures out the location of the data area on partial data read from the <eclipse>.ini private URI getOSGiInstallArea(List<String> lines, URI base, LauncherData launcherData) { //does the eclipse.ini say anything for osgi.install.area? - File osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, base); + File osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, launcherData.getLauncher(), base); if (osgiInstallArea == null) { //otherwise use the launcherData to figure it out osgiInstallArea = ParserUtils.getOSGiInstallArea(lines, null, launcherData); @@ -49,12 +49,13 @@ public class EclipseLauncherParser { ParserUtils.removeArgument(EquinoxConstants.OPTION_INSTALL, lines); return; } + File folder = ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()); if (Constants.OS_MACOSX.equals(launcherData.getOS())) { - if (!new File(ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()), "../MacOS").equals(launcherFolder)) { - ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); - } - } else if (!ParserUtils.fromOSGiJarToOSGiInstallArea(launcherData.getFwJar().getAbsolutePath()).equals(launcherFolder)) { - ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, launcherFolder.getAbsolutePath().replace('\\', '/'), lines); + folder = new File(folder, "../MacOS"); + } + if (!folder.equals(launcherFolder)) { + // Launcher will replace "@launcher.dir" with actual path. See bug 572890. + ParserUtils.setValueForArgument(EquinoxConstants.OPTION_INSTALL, "@launcher.dir/", lines); } } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java index e9a245a1c..cbe533aa9 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/ParserUtils.java @@ -28,6 +28,7 @@ import org.osgi.service.log.LogService; public class ParserUtils { private static final String FILE_PROTOCOL = "file:"; //$NON-NLS-1$ + private static final String LAUNCHER_DIR = "@launcher.dir"; //$NON-NLS-1$ public static File getOSGiInstallArea(List<String> programArgs, Properties properties, LauncherData launcherData) { if (launcherData == null) @@ -38,7 +39,7 @@ public class ParserUtils { base = launcherData.getLauncher().getParentFile().toURI(); else if (launcherData.getHome() != null) base = launcherData.getHome().toURI(); - File result = getOSGiInstallArea(programArgs, properties, base); + File result = getOSGiInstallArea(programArgs, properties, launcherData.getLauncher(), base); if (result != null) return result; @@ -84,7 +85,7 @@ public class ParserUtils { } //This method should only be used to determine the osgi install area when reading the eclipse.ini - public static File getOSGiInstallArea(List<String> args, Properties properties, URI base) { + public static File getOSGiInstallArea(List<String> args, Properties properties, File launcherFile, URI base) { if (args == null) return null; String install = getValueForArgument(EquinoxConstants.OPTION_INSTALL, args); @@ -94,6 +95,8 @@ public class ParserUtils { if (install != null) { if (install.startsWith(FILE_PROTOCOL)) install = install.substring(FILE_PROTOCOL.length() + 1); + if (install.startsWith(LAUNCHER_DIR)) + install = install.replaceAll(LAUNCHER_DIR, launcherFile.getParent().toString()); File installFile = new File(install); if (installFile.isAbsolute()) return installFile; |