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

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