Blame SOURCES/force-clean-after-p2-operations.patch

0f5e1f
From d964680827a248e8a312c000c4c2443f96c8c459 Mon Sep 17 00:00:00 2001
0f5e1f
From: Mat Booth <mat.booth@redhat.com>
0f5e1f
Date: Fri, 27 Sep 2019 14:52:54 +0100
0f5e1f
Subject: [PATCH] Force a clean on the restart after p2 operations
0f5e1f
0f5e1f
---
0f5e1f
 .../META-INF/MANIFEST.MF                            |  2 +-
0f5e1f
 .../bundles/org.eclipse.equinox.launcher/pom.xml    |  2 +-
0f5e1f
 .../src/org/eclipse/equinox/launcher/Main.java      | 13 +++++++++++++
0f5e1f
 .../internal/p2/ui/ProvisioningOperationRunner.java |  6 ++++++
0f5e1f
 4 files changed, 21 insertions(+), 2 deletions(-)
0f5e1f
0f5e1f
diff --git a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
0f5e1f
index 497e5d6fa..a118a0e4c 100644
0f5e1f
--- a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
0f5e1f
+++ b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/META-INF/MANIFEST.MF
0f5e1f
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
0f5e1f
 Bundle-ManifestVersion: 2
0f5e1f
 Bundle-Name: %pluginName
0f5e1f
 Bundle-SymbolicName: org.eclipse.equinox.launcher;singleton:=true
0f5e1f
-Bundle-Version: 1.5.700.qualifier
0f5e1f
+Bundle-Version: 1.5.701.qualifier
0f5e1f
 Main-Class: org.eclipse.equinox.launcher.Main
0f5e1f
 Bundle-ClassPath: .
0f5e1f
 Bundle-Vendor: %providerName
0f5e1f
diff --git a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/pom.xml b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/pom.xml
0f5e1f
index 43849b5b8..c5d2cdfea 100644
0f5e1f
--- a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/pom.xml
0f5e1f
+++ b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/pom.xml
0f5e1f
@@ -19,6 +19,6 @@
0f5e1f
   </parent>
0f5e1f
   <groupId>org.eclipse.equinox</groupId>
0f5e1f
   <artifactId>org.eclipse.equinox.launcher</artifactId>
0f5e1f
-  <version>1.5.700-SNAPSHOT</version>
0f5e1f
+  <version>1.5.701-SNAPSHOT</version>
0f5e1f
   <packaging>eclipse-plugin</packaging>
0f5e1f
 </project>
0f5e1f
diff --git a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
0f5e1f
index d013ff7c2..65f4cfd8a 100644
0f5e1f
--- a/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
0f5e1f
+++ b/rt.equinox.framework/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
0f5e1f
@@ -560,6 +560,18 @@
0f5e1f
 		setupVMProperties();
0f5e1f
 		processConfiguration();
0f5e1f
 
0f5e1f
+		File oca = new File(getConfigurationLocation().toURI());
0f5e1f
+		File ocaFile = new File(oca, "clean_on_restart");
0f5e1f
+		if (ocaFile.exists()) {
0f5e1f
+			System.err.println("Clean triggered."); //$NON-NLS-1$
0f5e1f
+			ocaFile.delete();
0f5e1f
+			commands = Arrays.copyOf(args, args.length + 1);
0f5e1f
+			commands[commands.length-1] = CLEAN;
0f5e1f
+			passThruArgs = Arrays.copyOf(passThruArgs, passThruArgs.length + 1);
0f5e1f
+			passThruArgs[passThruArgs.length-1] = CLEAN;
0f5e1f
+			setupVMProperties();
0f5e1f
+		}
0f5e1f
+		
0f5e1f
 		if (protectBase && (System.getProperty(PROP_SHARED_CONFIG_AREA) == null)) {
0f5e1f
 			System.err.println("This application is configured to run in a cascaded mode only."); //$NON-NLS-1$
0f5e1f
 			System.setProperty(PROP_EXITCODE, Integer.toString(14));
0f5e1f
diff --git a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
0f5e1f
index a70b640ba..8a002ebc2 100644
0f5e1f
--- a/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
0f5e1f
+++ b/rt.equinox.p2/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
0f5e1f
@@ -72,6 +72,12 @@ public class ProvisioningOperationRunner {
0f5e1f
 	 * @param restartPolicy
0f5e1f
 	 */
0f5e1f
 	void requestRestart(final int restartPolicy) {
0f5e1f
+		String oca = System.getProperty("osgi.configuration.area");
0f5e1f
+		try {
0f5e1f
+			java.io.File ocaCleanFile = new java.io.File(new java.net.URL(oca).toURI());
0f5e1f
+			new java.io.File(ocaCleanFile, "clean_on_restart").createNewFile();
0f5e1f
+		} catch (Exception e) { /* Eh, we tried... */ }
0f5e1f
+
0f5e1f
 		// Global override of restart (used in test cases).
0f5e1f
 		if (suppressRestart)
0f5e1f
 			return;
0f5e1f
-- 
0f5e1f
2.20.1
0f5e1f