6605390 - Installer:Linux:Portal rpms gets installed in /opt inspite of giving
non-default install directory
1) Modify RPMPackageUtils.installPkg() to accept a map containing user input
values. If it finds BASEDIR, it will use that to relocate RPMs. If BASEDIR is
not found, it will look for INSTALL_HOME.
2) Updated all calls to RPMPackageUtils.installPkg() with the new parameter.
3) Updated javadoc.
4) Fixed build problem with `ant all`.
--
Paul Ho
paul.ho_at_sun.com
408/276-4658
diff -r 470a69e50a5d src/org/openinstaller/pkg/RPMPackageUtils.java
--- a/src/org/openinstaller/pkg/RPMPackageUtils.java Mon Feb 25 10:10:16 2008 -0800
+++ b/src/org/openinstaller/pkg/RPMPackageUtils.java Sat Mar 01 19:46:13 2008 -0800
@@ -85,13 +85,15 @@ public final class RPMPackageUtils {
* @param aDomain Domain in which RPM is to be installed.
* @param aFinalAltRoot Final alternate root pre-calculated from aAltRoot and aDomain. Needed to maintain some old
* abstractions.
+ * @param aResponseMap parameters and their resolved values associated with installation.
* @param aDryRun If true, RPM is not actually installed, only tested using --test.
* @throws PackageException if the installation fails.
*
*/
public static void installPkg(final URL aSrcPath, final String aProdName,
- final String aAltRoot, final String aDomain, final File aFinalAltRoot, final boolean aDryRun) throws PackageException {
+ final String aAltRoot, final String aDomain, final File aFinalAltRoot,
+ final Map<String, String> aResponseMap, final boolean aDryRun) throws PackageException {
final String theRPMName = aSrcPath.getFile();
final ArrayList <String> theInstallCommand = new ArrayList <String>();
boolean theAltToolFlag = false;
@@ -100,6 +102,17 @@ public final class RPMPackageUtils {
* Retreive the rpm command.
*/
theInstallCommand.add(RPM_COMMAND);
+
+ if (aResponseMap != null && (!aResponseMap.isEmpty())) {
+ String theInstallDir = aResponseMap.get("BASEDIR");
+ if (theInstallDir.equals("")) {
+ theInstallDir = aResponseMap.get("PREFIX");
+ }
+ if (!theInstallDir.equals("")) {
+ theInstallCommand.add("--prefix " + theInstallDir);
+ }
+ }
+
/*
* Look for alternate versions of rpm.
*/
diff -r 470a69e50a5d src/org/openinstaller/pkg/SVR4PackageUtils.java
--- a/src/org/openinstaller/pkg/SVR4PackageUtils.java Mon Feb 25 10:10:16 2008 -0800
+++ b/src/org/openinstaller/pkg/SVR4PackageUtils.java Sat Mar 01 19:46:13 2008 -0800
@@ -179,6 +179,7 @@ public final class SVR4PackageUtils {
* @param aSrcPath directory in which package can be found.
* @param aPkgName name of package.
* @param aDomain domain into which package should be installed.
+ * @param aResponseMap parameters and their resolved values associated with installation.
* @param aAltRoot root directory into which package should be installed.
* @param aCurrZoneOnly if true, package is installed using -G option to pkgadd.
*
diff -r 470a69e50a5d src/org/openinstaller/provider/task/InstallTask.java
--- a/src/org/openinstaller/provider/task/InstallTask.java Mon Feb 25 10:10:16 2008 -0800
+++ b/src/org/openinstaller/provider/task/InstallTask.java Sat Mar 01 19:46:13 2008 -0800
@@ -227,7 +227,7 @@ public final class InstallTask extends T
* need to send the RPM name again as a parameter.
*/
RPMPackageUtils.installPkg(theSrcURL, gProdName, theAltRootPath, theDomain,
- SimsUtils.getFinalAltRoot(theAltRootPath, theDomain), isDryRun());
+ SimsUtils.getFinalAltRoot(theAltRootPath, theDomain), gParams, isDryRun());
} catch (final PackageException thePEx) {
thePEx.addContext("CANT_PERFORM_INSTALL_TASK", "package=" + thePkgName);
LOGGER.log(Level.SEVERE, "CANT_INSTALL_PACKAGE", thePEx);
diff -r 470a69e50a5d test/org/openinstaller/pkg/RPMPackageUtilsTest.java
--- a/test/org/openinstaller/pkg/RPMPackageUtilsTest.java Mon Feb 25 10:10:16 2008 -0800
+++ b/test/org/openinstaller/pkg/RPMPackageUtilsTest.java Sat Mar 01 19:46:13 2008 -0800
@@ -261,7 +261,7 @@ public class RPMPackageUtilsTest extends
public void testInstallPkg() throws Exception {
URL theRPMSrcPath;
theRPMSrcPath = new URL(gTmpDir.toURI().toURL(), "RPMS" + SP + SMPL_PREFIX + "-" + SMPL_VERSION + ".rpm");
- RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null), false);
+ RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null), null, false);
/**
* There is no output from the installPkg command. So query the RPM database to verify the package
* was actually installed.
@@ -281,7 +281,7 @@ public class RPMPackageUtilsTest extends
public void testDryRunInstall () throws Exception {
URL theRPMSrcPath;
theRPMSrcPath = new URL(gTmpDir.toURI().toURL(), "RPMS" + SP + SMPL_PREFIX + "-" + SMPL_VERSION + ".rpm");
- RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null),false);
+ RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null), null, false);
/**
* If its test only the msg will be similar to what we would
* see after an uninstall.
@@ -301,7 +301,7 @@ public class RPMPackageUtilsTest extends
BufferedReader theBr;
String theOutput;
theRPMSrcPath = new URL(gTmpDir.toURI().toURL(), "RPMS" + SP + SMPL_PREFIX + "-" + SMPL_VERSION + ".rpm");
- RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null),false);
+ RPMPackageUtils.installPkg(theRPMSrcPath, null, null, null, SimsUtils.getFinalAltRoot(null, null), null, false);
assertTrue("Install Successful", verify("install"));
@@ -320,7 +320,7 @@ public class RPMPackageUtilsTest extends
String theRPMPkg = SMPL_PREFIX + "-" + SMPL_VERSION ;
URL theRPMSrcPath = new URL(gTmpDir.toURI().toURL(), "RPMS" + SP + theRPMPkg + ".rpm");
- RPMPackageUtils.installPkg(theRPMSrcPath, null, theAltRoot, null, SimsUtils.getFinalAltRoot(theAltRoot, null),false);
+ RPMPackageUtils.installPkg(theRPMSrcPath, null, theAltRoot, null, SimsUtils.getFinalAltRoot(theAltRoot, null), null, false);
/**
* Clear all the options and send in the alt root info.
* theOptions.clear();
diff -r 470a69e50a5d tools/build.xml
--- a/tools/build.xml Mon Feb 25 10:10:16 2008 -0800
+++ b/tools/build.xml Sat Mar 01 19:46:13 2008 -0800
@@ -91,7 +91,7 @@ Test Product release : ${TEST_PRODUCT_R
</target>
<target name="clean" depends="-init" description="Cleans build directory">
- <delete includeEmptyDirs="true">
+ <delete includeEmptyDirs="true" quiet="true">
<fileset dir="${build.dir}" includes="**/*" excludes="build.log"/>
</delete>
</target>