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

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