From 7e7b805a2b5d6b48580e058a6eacbf58b8fead20 Mon Sep 17 00:00:00 2001 From: Gun Kim Date: Wed, 4 Sep 2013 14:01:42 +0900 Subject: [PATCH] [Title] modified on-demand install. The RPM package is installed even if the old package is installed. [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: Icb4a5c38b0a6978abbedd2220a7dcc0bc356a5df --- .../connection/debugtools/OnDemandInstall.java | 34 +++++++++------------- .../src/org/tizen/common/util/SdbCommandUtil.java | 9 +++--- 2 files changed, 19 insertions(+), 24 deletions(-) diff --git a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/OnDemandInstall.java b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/OnDemandInstall.java index 18248d6..d342c3d 100644 --- a/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/OnDemandInstall.java +++ b/org.tizen.common.connection/src/org/tizen/common/connection/debugtools/OnDemandInstall.java @@ -74,7 +74,10 @@ public class OnDemandInstall { private static final String REMOVE_TOOL_COMMAND = "rm -f %s"; private static final String TAR_INSTALL_COMMAND = MOVE_WORKING_DIR_COMMAND + " && tar -xf %s" + " && " + REMOVE_TOOL_COMMAND; - private static final String RPM_INSTALL_COMMAND = MOVE_WORKING_DIR_COMMAND + " && rpm -i %s --force" + " && " + REMOVE_TOOL_COMMAND; + // The -U option installs the new package. + // The option installs the new package after removes the installed old package, + // if the old package is installed and its version is lower than new package. + private static final String RPM_INSTALL_COMMAND = MOVE_WORKING_DIR_COMMAND + " && rpm -U %s" + " && " + REMOVE_TOOL_COMMAND; private IDevice device = null; private static IProgressMonitor nullMonitor = new OnDemandNullProgressMonitor(); @@ -150,31 +153,23 @@ public class OnDemandInstall { } private boolean isInstalled(DebugTool dt) { - String result = ""; - String cmd = ""; - + + // In case of rpm package, the IDE always install the rpm package to target. + // Because, the rpm command provides Upgrade options. if (RPM_PACKAGE_TYPE.equals(dt.getPackagetype())) { - cmd = String.format(RPM_QUERY_COMMAND, dt.getPackagename()); + return false; } else { - cmd = "ls " + TizenPlatformConstants.TOOLS_TARGET_PATH + "/" + dt.getPackagename() + TizenPlatformConstants.CMD_RESULT_CHECK; - } - - try { - result = getResult(cmd); - if (RPM_PACKAGE_TYPE.equals(dt.getPackagetype())) { - // In case of rpm package, the result 0 means the package is not installed. - if (CMD_RESULT_SUCCESS.equals(result) == false) { - return true; - } - } else { + String cmd = "ls " + TizenPlatformConstants.TOOLS_TARGET_PATH + "/" + dt.getPackagename() + TizenPlatformConstants.CMD_RESULT_CHECK; + try { + String result = getResult(cmd); if (CMD_RESULT_SUCCESS.equals(result)) { return true; } + } catch (Exception e) { + logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_CHECK_INSTALLED, dt.getPackagename()), e); } - } catch (Exception e) { - logger.error(NLS.bind(OnDemandInstallMessages.CANNOT_CHECK_INSTALLED, dt.getPackagename()), e); + return false; } - return false; } /** @@ -250,7 +245,6 @@ public class OnDemandInstall { if ( !failedFileList.isEmpty() ) { openErrorDialog(failedFileList); } - monitor.done(); } diff --git a/org.tizen.common/src/org/tizen/common/util/SdbCommandUtil.java b/org.tizen.common/src/org/tizen/common/util/SdbCommandUtil.java index 4d5c34b..b3442ee 100644 --- a/org.tizen.common/src/org/tizen/common/util/SdbCommandUtil.java +++ b/org.tizen.common/src/org/tizen/common/util/SdbCommandUtil.java @@ -96,12 +96,13 @@ public class SdbCommandUtil { command = String.format(command_format, device.getSerialNumber(), isRoot == true ? "on" : "off"); - if (OSChecker.isUnix() ) { - command += " 1>/dev/null"; - } - else if (OSChecker.isWindows() ) { + if (OSChecker.isWindows() ) { command += " 1>NUL"; } + else { + command += " 1>/dev/null"; + } + String command_result = HostUtil.returnExecute(command); if ( "".equals(command_result)) { -- 2.7.4