From d4b8989b08a3dcbf0dc5be8cc296b55302217236 Mon Sep 17 00:00:00 2001 From: Gun Kim Date: Wed, 6 Feb 2013 14:27:18 +0900 Subject: [PATCH] [Title] In the case of RDS, the partial directories's permision was changed to "app:app". [Type] [Module] [Priority] [Jira#] [Redmine#] [Problem] [Cause] [Solution] [TestCase] Change-Id: I2cb5bb61d4dfca30b346c06cb7d85167b14a8ef2 --- .../org/tizen/common/TizenPlatformConstants.java | 4 +++ .../src/org/tizen/common/rds/RdsDeployer.java | 32 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/org.tizen.common/src/org/tizen/common/TizenPlatformConstants.java b/org.tizen.common/src/org/tizen/common/TizenPlatformConstants.java index 1959269..ea0ad13 100644 --- a/org.tizen.common/src/org/tizen/common/TizenPlatformConstants.java +++ b/org.tizen.common/src/org/tizen/common/TizenPlatformConstants.java @@ -72,6 +72,10 @@ public class TizenPlatformConstants { public static final String PKG_TOOL_RUNNING_CHECK_COMMAND = PKG_TOOL + " -C -t %s -n %s"; public static final String PKG_TOOL_TERMINATE_COMMAND = PKG_TOOL + " -k -t %s -n %s"; public static final String PKG_TOOL_INSTALL_PATH_COMMAND = PKG_TOOL + " -a"; + + // Definitions for RDS + public static final String RDS_PUSH_DIRECTORY_COMMAND = "mkdir -p -m 755 \"%s\""+ TizenPlatformConstants.CMD_SUFFIX; + public static final String RDS_CHANGE_OWNER_COMMAND = "chown -R app:app \"%s\"" + TizenPlatformConstants.CMD_SUFFIX; // Definitions for launching public static final String LAUNCH_CMD = "launch_app %s"; diff --git a/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java b/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java index 53e8058..3a4974f 100644 --- a/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java +++ b/org.tizen.common/src/org/tizen/common/rds/RdsDeployer.java @@ -30,7 +30,9 @@ import java.io.Closeable; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; +import java.util.Set; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.CoreException; @@ -62,7 +64,8 @@ public abstract class RdsDeployer implements Closeable{ protected ISdbCommandHelper tizenCommand; protected List interestList = new ArrayList(); private SyncService syncService; - + private final static String[] needAppOwnerArray = new String[] {"/data", "/shared/data", "/shared/trusted", "/setting"}; + /** * Prints progress information. * @@ -91,6 +94,7 @@ public abstract class RdsDeployer implements Closeable{ this.pkgType = pkgType; this.strAppInstallPath = getAppInstallPath(); deltaDetector = new RdsDeltaDetector(device, project, strAppInstallPath); + } public void setInterestList( List list) { @@ -103,6 +107,8 @@ public abstract class RdsDeployer implements Closeable{ String strRemotePath = null; String command = null; boolean isInteresting = false; + Set needAppOwnerSet = new HashSet(); + for ( DeltaResourceInfo node : deltaInfoList ) { isInteresting = false; for ( DeltaResourceInfo interest : interestList ) { @@ -114,6 +120,7 @@ public abstract class RdsDeployer implements Closeable{ else { strRemotePath = strAppInstallPath + node.getFullPath().replaceFirst(strProjectPath + interest.getFullPath(), interest.getRemotePath()); } + if ( DeltaResourceInfo.TYPE_INSTALL.equals(interest.getType()) ) { isNeededInstall = true; } @@ -127,7 +134,7 @@ public abstract class RdsDeployer implements Closeable{ try { command = RdsDeployer.makeRdsLog(NLS.bind(RdsMessages.RDS_PUSH_LOG, node.getFullPath(), strRemotePath)); if ( new File(node.getFullPath()).isDirectory() ) { - tizenCommand.runCommand( "mkdir -p -m 755 " + strRemotePath + TizenPlatformConstants.CMD_SUFFIX , true, null); + tizenCommand.runCommand( String.format(TizenPlatformConstants.RDS_PUSH_DIRECTORY_COMMAND, strRemotePath), true, TizenPlatformConstants.CMD_SUCCESS); } else { SyncResult result = getSyncService().pushFile(node.getFullPath(), strRemotePath, SyncService.getNullProgressMonitor()); @@ -135,8 +142,16 @@ public abstract class RdsDeployer implements Closeable{ throw new IOException(command); } } - printInfo( command ); + + // TODO: The code is removed, if 'pkgcmd' is used to change owner. + for ( String needAppOwnerPath : needAppOwnerArray) { + String needAppOwnerFullPath = strAppInstallPath + needAppOwnerPath; + if ( strRemotePath.startsWith( needAppOwnerFullPath ) ) { + needAppOwnerSet.add(needAppOwnerFullPath); + break; + } + } } catch (Exception e) { newCoreException(RdsDeployer.makeRdsLog(RdsMessages.RDS_PUSH_ERROR), e); } @@ -151,11 +166,20 @@ public abstract class RdsDeployer implements Closeable{ } } + // TODO: It should be replaced to 'pkgcmd' + for ( String needAppOwnerPath : needAppOwnerSet ) { + try { + tizenCommand.runCommand( String.format(TizenPlatformConstants.RDS_CHANGE_OWNER_COMMAND, needAppOwnerPath) , true, TizenPlatformConstants.CMD_SUCCESS); + } catch (Exception e) { + newCoreException(RdsDeployer.makeRdsLog(RdsMessages.RDS_PUSH_ERROR), e); + } + } + if ( isNeededInstall ) { postInstall(); } } - + protected List getDelta() { return deltaDetector.getDelta(null, null); } -- 2.7.4