CWS-TOOLING: integrate CWS native235_DEV300

2009-03-13 15:30:12 +0100 is  r269487 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:41:03 +0100 is  r269471 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:38:38 +0100 is  r269470 : #i100131# major upgrade for Java GUI Installer
2009-03-13 12:37:59 +0100 is  r269469 : #i100131# major upgrade for Java GUI Installer
2009-03-12 18:47:26 +0100 is  r269437 : #i100131# major upgrade for Java GUI Installer
2009-03-12 18:46:52 +0100 is  r269436 : #i100131# major upgrade for Java GUI Installer
2009-03-11 17:17:37 +0100 is  r269345 : #i100131# Major Ugrade for Java GUI Installer
2009-03-11 17:11:38 +0100 is  r269344 : #i100131# Major Ugrade for Java GUI Installer
2009-03-11 17:10:59 +0100 is  r269343 : #i100131# Major Ugrade for Java GUI Installer
This commit is contained in:
Hans-Joachim Lankenau
2009-03-23 13:20:22 +00:00
parent 4140aa38e4
commit ddab0ce7a2
14 changed files with 439 additions and 31 deletions

View File

@@ -85,6 +85,14 @@ public class InstallationOngoingCtrl extends PanelController {
PackageCollector.sortPackages(installPackages, sortedPackages, "install"); PackageCollector.sortPackages(installPackages, sortedPackages, "install");
installData.setInstallPackages(sortedPackages); installData.setInstallPackages(sortedPackages);
if ( installData.isMajorUpgrade() ) {
// PackageCollector.findOldPackages(installData);
// Sorting for correct order of uninstallation
Vector sortedUninstallPackages = new Vector();
PackageCollector.sortPackages(installData.getOldPackages(), sortedUninstallPackages, "uninstall");
installData.setOldPackages(sortedUninstallPackages);
}
Installer installer = InstallerFactory.getInstance(); Installer installer = InstallerFactory.getInstance();
installer.preInstallationOngoing(); installer.preInstallationOngoing();
} }
@@ -96,6 +104,7 @@ public class InstallationOngoingCtrl extends PanelController {
InstallData installData = InstallData.getInstance(); InstallData installData = InstallData.getInstance();
InstallationOngoing panel = (InstallationOngoing)getPanel(); InstallationOngoing panel = (InstallationOngoing)getPanel();
Vector installPackages = installData.getInstallPackages(); Vector installPackages = installData.getInstallPackages();
Vector removePackages = installData.getOldPackages();
private Vector installedPackages = new Vector(); private Vector installedPackages = new Vector();
public void run() { public void run() {
@@ -110,6 +119,18 @@ public class InstallationOngoingCtrl extends PanelController {
panel.setProgressValue(progress); panel.setProgressValue(progress);
panel.setProgressText(packageData.getPackageName()); panel.setProgressText(packageData.getPackageName());
// Creating an upgrade process for Solaris packages
if ( installData.getOSType().equalsIgnoreCase("SunOS") ) {
if ( installer.isPackageInstalled(packageData, installData) ) {
if ( installer.isInstalledPackageOlder(packageData, installData) ) {
packageData.setIgnoreDependsForUninstall(true);
installer.uninstallPackage(packageData);
} else {
continue; // no downgrading
}
}
}
installer.installPackage(packageData); installer.installPackage(packageData);
installedPackages.add(packageData); installedPackages.add(packageData);
@@ -118,6 +139,13 @@ public class InstallationOngoingCtrl extends PanelController {
} }
} }
if ( installData.isMajorUpgrade() ) {
for (int i = 0; i < removePackages.size(); i++) {
PackageDescription packageData = (PackageDescription) removePackages.get(i);
installer.uninstallPackage(packageData);
}
}
if ( installData.isAbortedInstallation() ) { if ( installData.isAbortedInstallation() ) {
// undoing the installation // undoing the installation
LogManager.setCommandsHeaderLine("Installation aborted!"); LogManager.setCommandsHeaderLine("Installation aborted!");

View File

@@ -95,7 +95,9 @@ public class UninstallationPrologueCtrl extends PanelController {
// adding information to installData // adding information to installData
data.setPackagePath((String)map.get("PackagePath")); data.setPackagePath((String)map.get("PackagePath"));
data.setAdminFileNameReloc((String)map.get("AdminFileReloc")); data.setAdminFileNameReloc((String)map.get("AdminFileReloc"));
data.setAdminFileNameRelocNoDepends((String)map.get("AdminFileRelocNoDepends"));
data.setAdminFileNameNoReloc((String)map.get("AdminFileNoReloc")); data.setAdminFileNameNoReloc((String)map.get("AdminFileNoReloc"));
data.setAdminFileNameNoRelocNoDepends((String)map.get("AdminFileNoRelocNoDepends"));
data.setDatabasePath((String)map.get("DatabasePath")); data.setDatabasePath((String)map.get("DatabasePath"));
data.setInstallDir((String)map.get("InstallationDir")); data.setInstallDir((String)map.get("InstallationDir"));
data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges")); data.setStoredInstallationPrivileges((String)map.get("InstallationPrivileges"));

View File

@@ -71,11 +71,13 @@ public class InstallData
static private boolean olderVersionExists = false; static private boolean olderVersionExists = false;
static private boolean sameVersionExists = false; static private boolean sameVersionExists = false;
static private boolean newerVersionExists = false; static private boolean newerVersionExists = false;
static private boolean majorUpgrade = false;
static private boolean isMultiLingual = false; static private boolean isMultiLingual = false;
static private boolean dontUpdate = false; static private boolean dontUpdate = false;
static private boolean hideEula = false; static private boolean hideEula = false;
static private boolean databaseQueried = false; static private boolean databaseQueried = false;
static private boolean useRtl = false; static private boolean useRtl = false;
static private boolean installedProductMinorSet = false;
static private String installType; /* custom or typical installation */ static private String installType; /* custom or typical installation */
static private String osType; /* Linux, SunOS, ... */ static private String osType; /* Linux, SunOS, ... */
static private String installDir = null; static private String installDir = null;
@@ -87,7 +89,9 @@ public class InstallData
static private String packagePath = null; static private String packagePath = null;
static private String packageSubdir = "packages"; static private String packageSubdir = "packages";
static private String adminFileNameReloc = null; static private String adminFileNameReloc = null;
static private String adminFileNameRelocNoDepends = null;
static private String adminFileNameNoReloc = null; static private String adminFileNameNoReloc = null;
static private String adminFileNameNoRelocNoDepends = null;
static private String databasePath = null; static private String databasePath = null;
static private String getUidPath = null; static private String getUidPath = null;
static private String installationPrivileges = null; static private String installationPrivileges = null;
@@ -97,6 +101,8 @@ public class InstallData
static private String uninstallDirName = "uninstalldata"; static private String uninstallDirName = "uninstalldata";
static private int availableDiscSpace = 0; static private int availableDiscSpace = 0;
static private int preselectedLanguages = 0; static private int preselectedLanguages = 0;
static private int productMinor = 0;
static private int installedProductMinor = 0;
static private File jarFilePath = null; static private File jarFilePath = null;
static private File resourceRoot; static private File resourceRoot;
static private File infoRoot; static private File infoRoot;
@@ -105,6 +111,7 @@ public class InstallData
static private PackageDescription updatePackage = null; static private PackageDescription updatePackage = null;
static private Vector removeFiles = new Vector(); /* Files to remove, if installation is aborted */ static private Vector removeFiles = new Vector(); /* Files to remove, if installation is aborted */
static private Vector installPackages = new Vector(); static private Vector installPackages = new Vector();
static private Vector oldPackages = new Vector();
static private Vector systemLanguages = new Vector(); static private Vector systemLanguages = new Vector();
public static InstallData getInstance() public static InstallData getInstance()
@@ -290,6 +297,22 @@ public class InstallData
productDir = dir; productDir = dir;
} }
public int getProductMinor() {
return productMinor;
}
public void setProductMinor(int minor) {
productMinor = minor;
}
public int getInstalledProductMinor() {
return installedProductMinor;
}
public void setInstalledProductMinor(int minor) {
installedProductMinor = minor;
}
public String getInstallDirName() { public String getInstallDirName() {
return installDirName; return installDirName;
} }
@@ -389,6 +412,14 @@ public class InstallData
adminFileNameReloc = fileName; adminFileNameReloc = fileName;
} }
public String getAdminFileNameRelocNoDepends() {
return adminFileNameRelocNoDepends;
}
public void setAdminFileNameRelocNoDepends(String fileName) {
adminFileNameRelocNoDepends = fileName;
}
public String getAdminFileNameNoReloc() { public String getAdminFileNameNoReloc() {
return adminFileNameNoReloc; return adminFileNameNoReloc;
} }
@@ -397,6 +428,14 @@ public class InstallData
adminFileNameNoReloc = fileName; adminFileNameNoReloc = fileName;
} }
public String getAdminFileNameNoRelocNoDepends() {
return adminFileNameNoRelocNoDepends;
}
public void setAdminFileNameNoRelocNoDepends(String fileName) {
adminFileNameNoRelocNoDepends = fileName;
}
public String getGetUidPath() { public String getGetUidPath() {
return getUidPath; return getUidPath;
} }
@@ -565,6 +604,14 @@ public class InstallData
olderVersionExists = exists; olderVersionExists = exists;
} }
public boolean isMajorUpgrade() {
return majorUpgrade;
}
public void setMajorUpgrade(boolean upgrade) {
majorUpgrade = upgrade;
}
public boolean sameVersionExists() { public boolean sameVersionExists() {
return sameVersionExists; return sameVersionExists;
} }
@@ -597,6 +644,14 @@ public class InstallData
hideEula = value; hideEula = value;
} }
public boolean installedProductMinorSet() {
return installedProductMinorSet;
}
public void setInstalledProductMinorSet(boolean value) {
installedProductMinorSet = value;
}
public boolean databaseQueried() { public boolean databaseQueried() {
return databaseQueried; return databaseQueried;
} }
@@ -637,6 +692,14 @@ public class InstallData
installPackages = packages; installPackages = packages;
} }
public Vector getOldPackages() {
return oldPackages;
}
public void setOldPackages(Vector packages) {
oldPackages = packages;
}
public Vector getSystemLanguages() { public Vector getSystemLanguages() {
return systemLanguages; return systemLanguages;
} }

View File

@@ -409,12 +409,17 @@ public class LinuxInstaller extends Installer {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>"; log = rpmCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
LogManager.addCommandsLogfileComment(log); LogManager.addCommandsLogfileComment(log);
} else { // an error occured during installation } else { // an error occured during installation
log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; if ( packageData.uninstallCanFail() ) {
LogManager.addCommandsLogfileComment(log); log = rpmCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
for (int i = 0; i < returnErrorVector.size(); i++) { LogManager.addCommandsLogfileComment(log);
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); } else {
log = rpmCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
LogManager.addCommandsLogfileComment(log);
for (int i = 0; i < returnErrorVector.size(); i++) {
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
}
data.setIsErrorInstallation(true);
} }
data.setIsErrorInstallation(true);
} }
} }
} }
@@ -538,7 +543,8 @@ public class LinuxInstaller extends Installer {
String onePackage = (String)returnVector.get(i); String onePackage = (String)returnVector.get(i);
int pos1 = onePackage.lastIndexOf("-"); int pos1 = onePackage.lastIndexOf("-");
int pos2 = onePackage.substring(0, pos1).lastIndexOf("-"); int pos2 = onePackage.substring(0, pos1).lastIndexOf("-");
map.put(onePackage.substring(0, pos2), value); String key = onePackage.substring(0, pos2);
map.put(key, value);
} }
} }
@@ -667,6 +673,12 @@ public class LinuxInstaller extends Installer {
log = rpmCommand + "<br><b>Returns: " + version + "</b><br>"; log = rpmCommand + "<br><b>Returns: " + version + "</b><br>";
LogManager.addCommandsLogfileComment(log); LogManager.addCommandsLogfileComment(log);
if ( ! installData.installedProductMinorSet() ) {
int productMinor = helper.getInstalledMinor(version);
installData.setInstalledProductMinor(productMinor);
installData.setInstalledProductMinorSet(true);
}
if (useLocalDatabase) { if (useLocalDatabase) {
rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{RELEASE}\\n " + packageName; rpmCommand = "rpm" + " " + databaseString + " " + databasePath + " -q --queryformat %{RELEASE}\\n " + packageName;
rpmCommandArray[5] = "%{RELEASE}\\n"; rpmCommandArray[5] = "%{RELEASE}\\n";

View File

@@ -81,8 +81,11 @@ public class SolarisInstaller extends Installer {
if ( data.isInstallationMode()) { if ( data.isInstallationMode()) {
boolean makeRelocatableAdminFile = true; boolean makeRelocatableAdminFile = true;
helper.createAdminFile(makeRelocatableAdminFile); boolean removeDepends = true;
helper.createAdminFile(! makeRelocatableAdminFile); helper.createAdminFile(makeRelocatableAdminFile, removeDepends);
helper.createAdminFile(makeRelocatableAdminFile, ! removeDepends);
helper.createAdminFile(! makeRelocatableAdminFile, removeDepends);
helper.createAdminFile(! makeRelocatableAdminFile, ! removeDepends);
} }
if ( data.isUserInstallation() ) { if ( data.isUserInstallation() ) {
@@ -259,9 +262,17 @@ public class SolarisInstaller extends Installer {
// is package relocatable or not? // is package relocatable or not?
if ( packageData.isRelocatable() ) { if ( packageData.isRelocatable() ) {
adminFileName = data.getAdminFileNameReloc(); if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
adminFileName = data.getAdminFileNameRelocNoDepends();
} else {
adminFileName = data.getAdminFileNameReloc();
}
} else { } else {
adminFileName = data.getAdminFileNameNoReloc(); if ( packageData.ignoreDependsForUninstall() ) { // Force removal of older packages during installation
adminFileName = data.getAdminFileNameNoRelocNoDepends();
} else {
adminFileName = data.getAdminFileNameNoReloc();
}
} }
String pkgCommand = ""; String pkgCommand = "";
@@ -300,16 +311,20 @@ public class SolarisInstaller extends Installer {
log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>"; log = pkgCommand + "<br><b>Returns: " + returnValue + " Successful uninstallation</b><br>";
LogManager.addCommandsLogfileComment(log); LogManager.addCommandsLogfileComment(log);
} else { // an error occured during installation } else { // an error occured during installation
log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>"; if ( packageData.uninstallCanFail() ) {
LogManager.addCommandsLogfileComment(log); log = pkgCommand + "<br><b>Returns: " + returnValue + " Problem during uninstallation. Can be ignored.</b><br>";
System.err.println("Error during uninstallation:"); LogManager.addCommandsLogfileComment(log);
for (int i = 0; i < returnErrorVector.size(); i++) { } else {
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i)); log = pkgCommand + "<br><b>Returns: " + returnValue + " Error during uninstallation</b><br>";
System.err.println(returnErrorVector.get(i)); LogManager.addCommandsLogfileComment(log);
System.err.println("Error during uninstallation:");
for (int i = 0; i < returnErrorVector.size(); i++) {
LogManager.addCommandsLogfileComment((String)returnErrorVector.get(i));
System.err.println(returnErrorVector.get(i));
}
data.setIsErrorInstallation(true);
} }
data.setIsErrorInstallation(true);
} }
} }
public boolean isPackageNameInstalledClassic(String packageName, InstallData installData) { public boolean isPackageNameInstalledClassic(String packageName, InstallData installData) {
@@ -402,7 +417,8 @@ public class SolarisInstaller extends Installer {
for (int i = 0; i < returnVector.size(); i++) { for (int i = 0; i < returnVector.size(); i++) {
String onePackage = (String)returnVector.get(i); String onePackage = (String)returnVector.get(i);
int pos1 = onePackage.indexOf(" "); int pos1 = onePackage.indexOf(" ");
map.put(onePackage.substring(0, pos1), value); String key = onePackage.substring(0, pos1);
map.put(key, value);
} }
} }
@@ -522,6 +538,12 @@ public class SolarisInstaller extends Installer {
String installedPackageVersion = helper.getVersionString(returnVector); String installedPackageVersion = helper.getVersionString(returnVector);
String newPackageVersion = packageData.getPkgVersion(); String newPackageVersion = packageData.getPkgVersion();
if ( ! installData.installedProductMinorSet() ) {
int productMinor = helper.getInstalledMinor(installedPackageVersion);
installData.setInstalledProductMinor(productMinor);
installData.setInstalledProductMinorSet(true);
}
if (( installedPackageVersion != null ) && ( newPackageVersion != null )) { if (( installedPackageVersion != null ) && ( newPackageVersion != null )) {
if ( checkIfInstalledIsOlder ) { if ( checkIfInstalledIsOlder ) {
firstPackageIsOlder = helper.comparePackageVersions(installedPackageVersion, newPackageVersion); firstPackageIsOlder = helper.comparePackageVersions(installedPackageVersion, newPackageVersion);

View File

@@ -241,6 +241,23 @@ import java.util.Vector;public class LinuxHelper {
return hashRpm; return hashRpm;
} }
public int getInstalledMinor(String version) {
int minor = 0;
int pos = version.indexOf(".");
if ( pos > -1 ) {
String reduced = version.substring(pos + 1, version.length());
pos = reduced.indexOf(".");
if ( pos > -1 ) {
reduced = reduced.substring(0, pos);
minor = Integer.parseInt(reduced);
}
}
return minor;
}
private boolean compareTwoRpms(HashMap hash1, HashMap hash2) { private boolean compareTwoRpms(HashMap hash1, HashMap hash2) {
boolean hash1IsOlder = false; boolean hash1IsOlder = false;

View File

@@ -108,7 +108,7 @@ public class SolarisHelper {
} }
} }
private Vector getAdminFileContent(boolean relocatable) { private Vector getAdminFileContent(boolean relocatable, boolean rdepends) {
Vector adminFile = new Vector(); Vector adminFile = new Vector();
InstallData data = InstallData.getInstance(); InstallData data = InstallData.getInstance();
@@ -151,6 +151,7 @@ public class SolarisHelper {
// String rdependLine = "rdepend=nocheck"; // String rdependLine = "rdepend=nocheck";
String rdependLine = "rdepend=quit"; String rdependLine = "rdepend=quit";
if ( ! rdepends ) { rdependLine = "rdepend=nocheck"; }
if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; } if ( data.isUserInstallation() ) { rdependLine = "rdepend=nocheck"; }
adminFile.add(rdependLine); adminFile.add(rdependLine);
@@ -268,25 +269,41 @@ public class SolarisHelper {
return databasePath; return databasePath;
} }
public void createAdminFile(boolean relocatable) { public void createAdminFile(boolean relocatable, boolean rdepends) {
InstallData data = InstallData.getInstance(); InstallData data = InstallData.getInstance();
Vector removeFiles = data.getRemoveFiles(); Vector removeFiles = data.getRemoveFiles();
String adminFileName = ""; String adminFileName = "";
if ( relocatable ) { if ( relocatable ) {
adminFileName = "adminFileReloc"; if ( rdepends ) {
adminFileName = "adminFileReloc";
} else {
adminFileName = "adminFileRelocNoDepends";
}
} else { } else {
adminFileName = "adminFileNoReloc"; if ( rdepends ) {
adminFileName = "adminFileNoReloc";
} else {
adminFileName = "adminFileNoRelocNoDepends";
}
} }
Vector fileContent = getAdminFileContent(relocatable); Vector fileContent = getAdminFileContent(relocatable, rdepends);
File adminFile = new File(data.getInstallDir(), adminFileName); File adminFile = new File(data.getInstallDir(), adminFileName);
String completeAdminFileName = adminFile.getPath(); String completeAdminFileName = adminFile.getPath();
if ( relocatable ) { if ( relocatable ) {
data.setAdminFileNameReloc(completeAdminFileName); if ( rdepends ) {
data.setAdminFileNameReloc(completeAdminFileName);
} else {
data.setAdminFileNameRelocNoDepends(completeAdminFileName);
}
} else { } else {
data.setAdminFileNameNoReloc(completeAdminFileName); if ( rdepends ) {
data.setAdminFileNameNoReloc(completeAdminFileName);
} else {
data.setAdminFileNameNoRelocNoDepends(completeAdminFileName);
}
} }
if ( ! adminFile.exists() ) { if ( ! adminFile.exists() ) {
@@ -331,6 +348,24 @@ public class SolarisHelper {
return versionString; return versionString;
} }
public int getInstalledMinor(String version) {
int minor = 0;
int pos = version.indexOf(".");
if ( pos > -1 ) {
String reduced = version.substring(pos + 1, version.length());
pos = reduced.indexOf(".");
if ( pos > -1 ) {
reduced = reduced.substring(0, pos);
minor = Integer.parseInt(reduced);
}
}
return minor;
}
public boolean comparePackageVersions(String firstPackageVersion, String secondPackageVersion) { public boolean comparePackageVersions(String firstPackageVersion, String secondPackageVersion) {
// Analyzing strings: version, 2.0.0,REV=106.2005.05.26 // Analyzing strings: version, 2.0.0,REV=106.2005.05.26

View File

@@ -103,9 +103,12 @@ public class PackageDescription implements TreeNode {
private boolean isApplicationPackage = false; private boolean isApplicationPackage = false;
private boolean isJavaPackage = false; private boolean isJavaPackage = false;
private boolean installCanFail = false; private boolean installCanFail = false;
private boolean uninstallCanFail = false;
private boolean forceIntoUpdate = false;
private boolean useForce = false; private boolean useForce = false;
private boolean isNewInstalled = false; private boolean isNewInstalled = false;
private boolean wasAlreadyInstalled = false; private boolean wasAlreadyInstalled = false;
private boolean ignoreDependsForUninstall = false;
/* Saving the default selection state. This is necessary, if the user chooses /* Saving the default selection state. This is necessary, if the user chooses
* the custom installation type, makes changes, and then changes into * the custom installation type, makes changes, and then changes into
@@ -118,6 +121,8 @@ public class PackageDescription implements TreeNode {
private int customSelectionState = DONT_KNOW; // Saving settings for custom installation private int customSelectionState = DONT_KNOW; // Saving settings for custom installation
private int startSelectionState = DONT_KNOW; // Saving settings at start of installation private int startSelectionState = DONT_KNOW; // Saving settings at start of installation
public PackageDescription() {}
/** /**
* construct only with package information to wrap * construct only with package information to wrap
*/ */
@@ -143,6 +148,10 @@ public class PackageDescription implements TreeNode {
return dpyName; return dpyName;
} }
public void setName(String name) {
dpyName = name;
}
public String getDescription() { public String getDescription() {
return dpyDescription; return dpyDescription;
} }
@@ -163,6 +172,10 @@ public class PackageDescription implements TreeNode {
return pkgOrder; return pkgOrder;
} }
public void setOrder(int order) {
pkgOrder = order;
}
// public int getAccumulatedSize() { // public int getAccumulatedSize() {
// int size = getSize(); // int size = getSize();
// //
@@ -215,6 +228,18 @@ public class PackageDescription implements TreeNode {
return installCanFail; return installCanFail;
} }
public boolean uninstallCanFail() {
return uninstallCanFail;
}
public void setUninstallCanFail(boolean canFail) {
uninstallCanFail = canFail;
}
public boolean forceIntoUpdate() {
return forceIntoUpdate;
}
public boolean useForce() { public boolean useForce() {
return useForce; return useForce;
} }
@@ -235,6 +260,14 @@ public class PackageDescription implements TreeNode {
return wasAlreadyInstalled; return wasAlreadyInstalled;
} }
public void setIgnoreDependsForUninstall(boolean ignore) {
ignoreDependsForUninstall = ignore;
}
public boolean ignoreDependsForUninstall() {
return ignoreDependsForUninstall;
}
public boolean isDefault() { public boolean isDefault() {
return isDefault; return isDefault;
} }
@@ -247,10 +280,19 @@ public class PackageDescription implements TreeNode {
return isRelocatable; return isRelocatable;
} }
public void setIsRelocatable(boolean relocatable) {
isRelocatable = relocatable;
}
public String getPackageName() { public String getPackageName() {
return pkgFileName; return pkgFileName;
} }
public void setPackageName(String name) {
pkgFileName = name;
}
public String getFullPackageName() { public String getFullPackageName() {
return pkgFullName; return pkgFullName;
} }
@@ -468,6 +510,12 @@ public class PackageDescription implements TreeNode {
installCanFail = Parser.parseBoolean(installCanFailValue); installCanFail = Parser.parseBoolean(installCanFailValue);
} }
subSection = section.getElement("forceintoupdate");
if (subSection != null) {
String forceIntoUpdateValue = subSection.getValue();
forceIntoUpdate = Parser.parseBoolean(forceIntoUpdateValue);
}
subSection = section.getElement("useforce"); subSection = section.getElement("useforce");
if (subSection != null) { if (subSection != null) {
String useForceValue = subSection.getValue(); String useForceValue = subSection.getValue();

View File

@@ -239,7 +239,17 @@ public class ProductDescription {
installData.setDontUpdate(dontupdate); installData.setDontUpdate(dontupdate);
} }
section = data.getElement("hideeula"); /* check for the Product Minor of this installation set */
section = data.getElement("productminor");
if (section != null) {
String value = section.getValue();
if (value != null) {
int intValue = Integer.parseInt(value);
installData.setProductMinor(intValue);
}
}
section = data.getElement("hideeula");
if (section != null) { if (section != null) {
String value = section.getValue(); String value = section.getValue();
if ((value != null) && (! value.equals(""))) { if ((value != null) && (! value.equals(""))) {

View File

@@ -179,7 +179,9 @@ public class Dumper {
InstallData data = InstallData.getInstance(); InstallData data = InstallData.getInstance();
System.err.println("PackagePath: " + data.getPackagePath()); System.err.println("PackagePath: " + data.getPackagePath());
System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc()); System.err.println("AdminFileReloc: " + data.getAdminFileNameReloc());
System.err.println("AdminFileRelocNoDepends: " + data.getAdminFileNameRelocNoDepends());
System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc()); System.err.println("AdminFileNoReloc: " + data.getAdminFileNameNoReloc());
System.err.println("AdminFileNoRelocNoDepends: " + data.getAdminFileNameNoRelocNoDepends());
System.err.println("DatabasePath: " + data.getDatabasePath()); System.err.println("DatabasePath: " + data.getDatabasePath());
System.err.println("InstallDir: " + data.getInstallDir()); System.err.println("InstallDir: " + data.getInstallDir());
System.err.println("Original privileges: " + data.getStoredInstallationPrivileges()); System.err.println("Original privileges: " + data.getStoredInstallationPrivileges());

View File

@@ -158,6 +158,15 @@ public class InfoDir {
sourceFile.delete(); sourceFile.delete();
} }
if ( data.getAdminFileNameRelocNoDepends() != null ) {
File sourceFile = new File(data.getAdminFileNameRelocNoDepends());
String fileName = sourceFile.getName();
File destFile = new File(dir, fileName);
boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
data.setAdminFileNameRelocNoDepends(destFile.getPath());
sourceFile.delete();
}
if ( data.getAdminFileNameNoReloc() != null ) { if ( data.getAdminFileNameNoReloc() != null ) {
File sourceFile = new File(data.getAdminFileNameNoReloc()); File sourceFile = new File(data.getAdminFileNameNoReloc());
String fileName = sourceFile.getName(); String fileName = sourceFile.getName();
@@ -167,6 +176,14 @@ public class InfoDir {
sourceFile.delete(); sourceFile.delete();
} }
if ( data.getAdminFileNameNoRelocNoDepends() != null ) {
File sourceFile = new File(data.getAdminFileNameNoRelocNoDepends());
String fileName = sourceFile.getName();
File destFile = new File(dir, fileName);
boolean success = SystemManager.copy(sourceFile.getPath(), destFile.getPath());
data.setAdminFileNameNoRelocNoDepends(destFile.getPath());
sourceFile.delete();
}
} }
static private void createInfoFile(File dir) { static private void createInfoFile(File dir) {
@@ -180,8 +197,12 @@ public class InfoDir {
fileContent.add(line); fileContent.add(line);
line = "AdminFileReloc=" + data.getAdminFileNameReloc(); line = "AdminFileReloc=" + data.getAdminFileNameReloc();
fileContent.add(line); fileContent.add(line);
line = "AdminFileRelocNoDepends=" + data.getAdminFileNameRelocNoDepends();
fileContent.add(line);
line = "AdminFileNoReloc=" + data.getAdminFileNameNoReloc(); line = "AdminFileNoReloc=" + data.getAdminFileNameNoReloc();
fileContent.add(line); fileContent.add(line);
line = "AdminFileNoRelocNoDepends=" + data.getAdminFileNameNoRelocNoDepends();
fileContent.add(line);
line = "InstallationDir=" + data.getInstallDir(); line = "InstallationDir=" + data.getInstallDir();
fileContent.add(line); fileContent.add(line);
line = "DatabasePath=" + data.getDatabasePath(); line = "DatabasePath=" + data.getDatabasePath();
@@ -207,10 +228,18 @@ public class InfoDir {
SystemManager.deleteFile(new File(data.getAdminFileNameReloc())); SystemManager.deleteFile(new File(data.getAdminFileNameReloc()));
} }
if ( ! data.getAdminFileNameRelocNoDepends().equals("null") ) {
SystemManager.deleteFile(new File(data.getAdminFileNameRelocNoDepends()));
}
if ( ! data.getAdminFileNameNoReloc().equals("null") ) { if ( ! data.getAdminFileNameNoReloc().equals("null") ) {
SystemManager.deleteFile(new File(data.getAdminFileNameNoReloc())); SystemManager.deleteFile(new File(data.getAdminFileNameNoReloc()));
} }
if ( ! data.getAdminFileNameNoRelocNoDepends().equals("null") ) {
SystemManager.deleteFile(new File(data.getAdminFileNameNoRelocNoDepends()));
}
if ( ! data.getGetUidPath().equals("null") ) { if ( ! data.getGetUidPath().equals("null") ) {
SystemManager.deleteFile(new File(data.getGetUidPath())); SystemManager.deleteFile(new File(data.getGetUidPath()));
} }

View File

@@ -98,6 +98,13 @@ public class InstallChangeCtrl {
data.setOlderVersionExists(true); data.setOlderVersionExists(true);
// All installed packages will be updated -> determining which packages are installed // All installed packages will be updated -> determining which packages are installed
System.err.println("An older product is installed"); System.err.println("An older product is installed");
// But if this is a kind of Major Upgrade with different Minor and therefore different package names,
// it is necessary to remove the old product.
if ( data.getProductMinor() > data.getInstalledProductMinor() )
{
data.setMajorUpgrade(true);
System.err.println("Major Upgrade");
}
} else if ( installer.isInstallSetPackageOlder(data.getUpdatePackage(), data) ) { } else if ( installer.isInstallSetPackageOlder(data.getUpdatePackage(), data) ) {
data.setNewerVersionExists(true); data.setNewerVersionExists(true);
System.err.println("A newer product is installed"); System.err.println("A newer product is installed");

View File

@@ -180,10 +180,16 @@ public class ModuleCtrl {
// System.err.println("Setting allChildrenHidden for module " + packageData.getName() ); // System.err.println("Setting allChildrenHidden for module " + packageData.getName() );
} }
// System.err.println("Setting " + packageData.getName() + " to " + packageData.getSelectionState() ); // If older version exist, only modules without packages shall be updated,
packageData.setSelectionState(state); // because all packages are already determined by querying the database.
if ( installdata.olderVersionExists() ) {
if ( packageData.getPackageName().equals("") ) {
packageData.setSelectionState(state);
}
} else {
packageData.setSelectionState(state);
}
} }
} }
static public void setHiddenModuleSettingsInstall(PackageDescription packageData) { static public void setHiddenModuleSettingsInstall(PackageDescription packageData) {
@@ -409,6 +415,18 @@ public class ModuleCtrl {
} }
} }
static public void setForcedUpdateProductSettings(PackageDescription packageData) {
if ( packageData.forceIntoUpdate() ) {
packageData.setSelectionState(PackageDescription.INSTALL);
}
for (Enumeration e = packageData.children(); e.hasMoreElements(); ) {
PackageDescription child = (PackageDescription) e.nextElement();
setForcedUpdateProductSettings(child);
}
}
static public void setShowInUserInstallOnlyFlags(PackageDescription packageData) { static public void setShowInUserInstallOnlyFlags(PackageDescription packageData) {
// This function is not needed during deinstallation, because a // This function is not needed during deinstallation, because a
@@ -721,6 +739,50 @@ public class ModuleCtrl {
} }
} else { } else {
packageData.setSelectionState(PackageDescription.DONT_INSTALL); packageData.setSelectionState(PackageDescription.DONT_INSTALL);
// Special handling for Major Upgrade
if ( data.isMajorUpgrade() ) {
String basis = "ooobasis3";
if ( data.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
String search = basis + data.getProductMinor();
String replacestring = basis + data.getInstalledProductMinor();
int pos = packageData.getPackageName().indexOf(search);
if ( pos > -1 ) {
// Check if this package is installed with a lower product minor
// Creating new package for removal, very simple PackageDescription
PackageDescription localPackage = new PackageDescription();
localPackage.setUninstallCanFail(true);
localPackage.setIsRelocatable(packageData.isRelocatable());
String localName = packageData.getPackageName();
localName = localName.replace(search, replacestring);
localPackage.setPackageName(localName);
if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
localName = packageData.getPkgRealName();
localName = localName.replace(search, replacestring);
localPackage.setPkgRealName(localName);
}
if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
localName = packageData.getName();
localName = localName.replace(search, replacestring);
localPackage.setName(localName);
}
// saving also the order, needed for order of uninstallation
localPackage.setOrder(packageData.getOrder());
// If the old package is installed, the new package can be installed, too,
// and the old package can be marked for removal (with dependency check).
if ( installer.isPackageInstalled(localPackage, data) ) {
packageData.setSelectionState(PackageDescription.INSTALL);
// Collecting all installed older packages for uninstallation
Vector oldPackages = data.getOldPackages();
oldPackages.add(localPackage);
data.setOldPackages(oldPackages);
}
}
}
} }
} }
@@ -841,6 +903,13 @@ public class ModuleCtrl {
Dumper.logModuleStates(packageData, "ChooseDirectory: After setUpdateOlderProductSettings"); Dumper.logModuleStates(packageData, "ChooseDirectory: After setUpdateOlderProductSettings");
} }
// Setting packages that are forced into update, because they did not exist in older version.
ModuleCtrl.setForcedUpdateProductSettings(packageData);
if ( data.logModuleStates() ) {
Dumper.logModuleStates(packageData, "ChooseDirectory: After setForcedUpdateProductSettings");
}
// Setting required root module packages (that are new in the update product). // Setting required root module packages (that are new in the update product).
ModuleCtrl.setRequiredNewCoreModules(packageData, data); ModuleCtrl.setRequiredNewCoreModules(packageData, data);
@@ -871,6 +940,13 @@ public class ModuleCtrl {
} }
} }
// Setting parent module settings. Only required for displaying correct module settings before starting installation.
ModuleCtrl.setParentDefaultModuleSettings(packageData);
if ( data.logModuleStates() ) {
Dumper.logModuleStates(packageData, "ChooseDirectory: After setParentDefaultModuleSettings");
}
// Collecting packages to install // Collecting packages to install
// This has to be done here, because "ChooseInstallationType" and "ChooseComponents" // This has to be done here, because "ChooseInstallationType" and "ChooseComponents"
// are not called. // are not called.
@@ -903,7 +979,7 @@ public class ModuleCtrl {
Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages"); Dumper.logModuleStates(packageData, "ChooseDirectory: After disableNonExistingPackages");
} }
// disable packages, that are not valid in user installation // disable packages, that are not valid in user installation
if ( data.isUserInstallation() ) { if ( data.isUserInstallation() ) {
ModuleCtrl.setShowInUserInstallFlags(packageData); ModuleCtrl.setShowInUserInstallFlags(packageData);

View File

@@ -30,6 +30,7 @@
package org.openoffice.setup.Util; package org.openoffice.setup.Util;
import org.openoffice.setup.InstallData;
import org.openoffice.setup.SetupData.PackageDescription; import org.openoffice.setup.SetupData.PackageDescription;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.Vector; import java.util.Vector;
@@ -82,6 +83,62 @@ public class PackageCollector {
} }
} }
// Special handling for packages, that change their name, and therefore need to be uninstalled
// static public void findOldPackages( InstallData installData ) {
//
// String basis = "ooobasis3";
// if ( installData.getOSType().equalsIgnoreCase("Linux") ) { basis = basis + "."; }
// String search = basis + installData.getProductMinor();
// Vector allPackages = installData.getInstallPackages();
// Vector oldPackages = new Vector();
// for (int i = 0; i < allPackages.size(); i++) {
// PackageDescription packageData = (PackageDescription) allPackages.get(i);
// int pos = packageData.getPackageName().indexOf(search);
// if ( pos > -1 ) {
// String substring = packageData.getPackageName().substring(pos, pos + 1);
// for (int j = 0; j < installData.getProductMinor(); j++) {
// String replace = basis + j;
// // Creating new package for removal, very simple PackageDescription
// PackageDescription localPackage = new PackageDescription();
// localPackage.setUninstallCanFail(true);
// localPackage.setIsRelocatable(packageData.isRelocatable());
// String localName = packageData.getPackageName();
// localName = localName.replace(search, replace);
// localPackage.setPackageName(localName);
// if ( ( packageData.getPkgRealName() != null ) && ( ! packageData.getPkgRealName().equals("") )) {
// localName = packageData.getPkgRealName();
// localName = localName.replace(search, replace);
// localPackage.setPkgRealName(localName);
// }
// if (( packageData.getName() != null ) && ( ! packageData.getName().equals("") )) {
// localName = packageData.getName();
// localName = localName.replace(search, replace);
// localPackage.setName(localName);
// }
// oldPackages.add(localPackage);
// }
// }
// }
// // reverse order for uninstallation
// int number = oldPackages.size();
// for (int i = 0; i < number; i++) {
// if ( i > 0 ) {
// PackageDescription oldPackageData = (PackageDescription) oldPackages.remove(i);
// oldPackages.add(0,oldPackageData);
// }
// }
// installData.setOldPackages(oldPackages);
// }
static public void sortPackages(Vector allPackages, Vector sortedPackages, String mode) { static public void sortPackages(Vector allPackages, Vector sortedPackages, String mode) {
for (int i = 0; i < allPackages.size(); i++) { for (int i = 0; i < allPackages.size(); i++) {
boolean integrated = false; boolean integrated = false;