[Title] Change file path which is installmanager performance test result
authoryongsung1.kim <yongsung1.kim@samsung.com>
Tue, 6 Aug 2013 08:12:04 +0000 (17:12 +0900)
committeryongsung1.kim <yongsung1.kim@samsung.com>
Tue, 6 Aug 2013 08:12:04 +0000 (17:12 +0900)
file path from applocal/tizen-sdk-data to c:\tizen-sdk-data by default
on Windows.
[Desc.] If user change tizen-sdk-data path, result file path would be
changed also.
[Issue] redmine #10148

InstallManager_java/src/org/tizen/installmanager/cli/CliInstall.java
InstallManager_java/src/org/tizen/installmanager/core/Config.java
InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java
InstallManager_java/src/org/tizen/installmanager/core/InstallManagerConstants.java
InstallManager_java/src/org/tizen/installmanager/core/Installer.java
InstallManager_java/src/org/tizen/installmanager/core/Performance.java
InstallManager_java/src/org/tizen/installmanager/lib/Registry.java
InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java
InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java

index fd8f55a..1dae39f 100644 (file)
@@ -90,7 +90,7 @@ public class CliInstall {
                PackageManager pm = PackageManager.getInstance();
                        
                String targetDir = getTargetDir();
-               Registry.sdkWorkSpacePath = getSDKDataPath();
+               Registry.sdkDataPath = getSDKDataPath();
                Config.USER_CONFIG_HOME_PATH = getSDKDataPath();
                
                PackageSet skipPackages = pm.getPackagesByNames(Options.skipPackages);
@@ -115,6 +115,8 @@ public class CliInstall {
                        installablePackages = pm.diff(installablePackages, skipPackages);
                }
                
+               Registry.saveSDKInfo(targetDir);
+               
                if (checkAvailableSize(installablePackages, targetDir)) {
                        return installPackages(installablePackages, targetDir);                 
                } else {
index 630a226..a62333d 100644 (file)
@@ -222,6 +222,7 @@ public class Config {
        private ConfigFile mConfigFile = null;
        private ConfigFile currentConfigFile = null;
        private String mTargetDir = "";
+       private String mSdkDataDir = "";
 
        private static Config config = null;
 
@@ -351,6 +352,15 @@ public class Config {
        public void setTargetDir(String targetDir) {
                mTargetDir = targetDir;
        }
+       
+       /**
+        * Set target directory to member variable.
+        * 
+        * @param targetDir
+        */
+       public void setSdkDatatDir(String dataDir) {
+               mSdkDataDir = dataDir;
+       }
 
        /**
         * Get ConfigFile Class instance
@@ -562,6 +572,13 @@ public class Config {
        public String getTargetDir() {
                return mTargetDir;
        }
+       
+       /**
+        * @return path of target directory
+        */
+       public String getSdkDataDir() {
+               return mSdkDataDir;
+       }
 
        /**
         * @return <code>true</code> if proxy server is specified
index 823b9e4..7b02f0e 100644 (file)
@@ -127,6 +127,7 @@ public class InstallManager {
                        if (!Registry.getInstalledPath().isEmpty()) {
                                mConfig.setTargetDir(Registry.getInstalledPath());
                        }
+                       mConfig.setSdkDatatDir(Registry.getSdkDataPath());
                }
        }
        
@@ -441,7 +442,7 @@ public class InstallManager {
         */
        private void setCurrentSDKEnvironment(String targetPath) {
                Log.log("Set new SDK environment from old SDK.");
-               Registry.sdkWorkSpacePath = Config.getConfigHome();
+               Registry.sdkDataPath = Config.getConfigHome();
                
                if (targetPath == null || targetPath.isEmpty()) {
                        Log.err("Install path is invalid: " + targetPath
@@ -721,6 +722,7 @@ public class InstallManager {
                }
                
                mConfig.setTargetDir(targetDir);
+               mConfig.setSdkDatatDir(Registry.sdkDataPath);
                
                Performance.setDownloadStartTime();
                
@@ -1058,6 +1060,7 @@ public class InstallManager {
 
                // Keep target path for later use
                mConfig.setTargetDir(targetDir);
+               mConfig.setSdkDatatDir(Registry.sdkDataPath);
 
                // Make .info directory
                if (!mConfig.makeInfoDirectory()) {
index de99c59..49cf1f8 100644 (file)
@@ -27,7 +27,7 @@ public class InstallManagerConstants {
        
        //sdk configuration file
        final static public String SDK_DATA_DIR_NAME = "tizen-sdk-data";
-       final static public String SDK_DATA_PATH = getSDKDataPath();
+//     final static private String SDK_DATA_PATH = getSDKDataPath();
        final static public String SDK_CONFIGURATION_DIR = ".info";
        final static public String SDK_INFORMATION_FILE_NAME = "sdk.info";
        final static public String SDK_INSTALLED_PACKAGE_LIST_FILE = "installedpackage.list";
@@ -35,7 +35,7 @@ public class InstallManagerConstants {
        
        //test file
        final static public String SDK_TEST_DIR_NAME = "test";
-       final static public String SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH = PathUtil.get(SDK_DATA_PATH, SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
+//     final static public String SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH = PathUtil.get(SDK_DATA_PATH, SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
        
        
        static String getInstallManagerBinaryName() {
@@ -50,13 +50,21 @@ public class InstallManagerConstants {
                }
        }
        
+       static String getInstallManagerTestResultPath() {
+               return PathUtil.get(getSDKDataPath(), SDK_TEST_DIR_NAME, INSTALLMANAGER_DIRECTORY_NAME);
+       }
+       
        static String getSDKDataPath() {
-               if (Platform.isLinux() || Platform.isMacOS()) {
-                       return PathUtil.getFromHome(SDK_DATA_DIR_NAME);
-               } else if (Platform.isWindows()) {
-                       return PathUtil.getFromAppData(SDK_DATA_DIR_NAME);
+               if (Config.getInstance().getSdkDataDir() == "") {
+                       if (Platform.isLinux() || Platform.isMacOS()) {
+                               return PathUtil.getFromHome(SDK_DATA_DIR_NAME);
+                       } else if (Platform.isWindows()) {
+                               return WINDOWS_DEFAULT_DATA_PATH;
+                       } else {
+                               throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+                       }                       
                } else {
-                       throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+                       return Config.getInstance().getSdkDataDir();
                }
        }
        
index 6877163..636746f 100644 (file)
@@ -267,8 +267,8 @@ public class Installer {
                HashMap<String, String> env = new HashMap<String, String>();
 
                env.put("INSTALLED_PATH", Registry.getInstalledPath());
-               env.put("SDK_DATA_PATH", Registry.sdkWorkSpacePath);
-               env.put("USER_DATA_PATH", Registry.sdkWorkSpacePath);
+               env.put("SDK_DATA_PATH", Registry.sdkDataPath);
+               env.put("USER_DATA_PATH", Registry.sdkDataPath);
                env.put("MAKESHORTCUT_PATH", InstallManager.getInstance().getMakeShortCutPath());
                env.put("REMOVE_SHORTCUT", InstallManager.getInstance().getRemoveShortCutPath());
                env.put("TSUDO", InstallManager.getInstance().getTSudoPath());
index 24aede6..deb0b1d 100644 (file)
@@ -97,7 +97,7 @@ public class Performance {
                SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMddHHmmss");
                String testFileName = formatter.format(imStartTime) + ".txt";
                
-               String testResultFilePath = PathUtil.get(InstallManagerConstants.SDK_INSTALLMANAGER_TEST_RESULT_DIR_PATH, testFileName);
+               String testResultFilePath = PathUtil.get(InstallManagerConstants.getInstallManagerTestResultPath(), testFileName);
                File testResultFile = new File(testResultFilePath);
                
                if (!testResultFile.getParentFile().exists()) {
index 48903d7..484ed99 100644 (file)
@@ -74,7 +74,8 @@ public class Registry {
        private static final String REGISTRY_SEPERATOR = "=";
        
        public static String targetPath = "";
-       public static String sdkWorkSpacePath = "";
+       public static String sdkDataPath = "";
+//     public static String sdkDataPath = getSDKinfoBySDKPath(Config.getInstance().getTargetDir());
        private static ArrayList<String> sdkPathList = getSDKPath();
 
        /**
@@ -206,6 +207,15 @@ public class Registry {
                }
        }
        
+       /**
+        * @return path in which SDK is installed. empty string if not found.
+        */
+       public static String getSdkDataPath() {
+               return getPathFromRegistryKey(PathUtil.get(Registry.getInstalledPath(),
+                               InstallManagerConstants.SDK_INFORMATION_FILE_NAME)
+                               , SDK_DATA_PATH_KEY);
+       }
+       
        public static String getOldInstalledPath() {
                return getPathFromRegistryKey(OLD_REGISTRY_FILE_PATH, INSTALLED_PATH_KEY);
        }
@@ -238,11 +248,12 @@ public class Registry {
        /**
         * When installmanager updates SDK, installmanager have to know sdk information from sdk.info file.
         * @param sdkPath
+        * @return 
         */
        public static void setSDKinfoBySDKPath(String sdkPath) {
                File sdkInfoFile = new File(PathUtil.get(sdkPath, InstallManagerConstants.SDK_INFORMATION_FILE_NAME));
                if (sdkInfoFile.exists()) {
-                       sdkWorkSpacePath = getPathFromRegistryKey(sdkInfoFile.getAbsolutePath(), SDK_DATA_PATH_KEY);
+                       sdkDataPath = getPathFromRegistryKey(sdkInfoFile.getAbsolutePath(), SDK_DATA_PATH_KEY);
                        Log.log("sdk.info file exists. => " + sdkPath);
                        Log.log("InstallManager can set sdk environment.");
                } else {
@@ -451,7 +462,7 @@ public class Registry {
         */
        public static void saveSDKInfo(String installPath) {
                if (installPath == null || installPath.isEmpty() || 
-                               sdkWorkSpacePath == null || sdkWorkSpacePath.isEmpty()) {
+                               sdkDataPath == null || sdkDataPath.isEmpty()) {
                        Log.err("Install path or workspace path is invalid: " + installPath
                                        + ". This might be a bug of IM");
                        throw new IMFatalException(ErrorCode.INVALID_INSTALL_PATH);
@@ -459,7 +470,7 @@ public class Registry {
 
                String sdkInfoPath = PathUtil.get(installPath, InstallManagerConstants.SDK_INFORMATION_FILE_NAME);
                String target = INSTALLED_PATH_KEY + REGISTRY_SEPERATOR + installPath;
-               String workSpace = SDK_DATA_PATH_KEY + REGISTRY_SEPERATOR + sdkWorkSpacePath;
+               String workSpace = SDK_DATA_PATH_KEY + REGISTRY_SEPERATOR + sdkDataPath;
 
                File sdkInfoFile = null;
                try {
index 08bf95e..6390774 100644 (file)
@@ -463,7 +463,7 @@ public class InstallManagerWindow extends ApplicationWindow {
                                        boolean installable = compositeSetInstallDirectoryPage.isInstallablePath();
 
                                        Config.USER_CONFIG_HOME_PATH = compositeSetInstallDirectoryPage.getSDKWorkSpacePath();
-                                       Registry.sdkWorkSpacePath = controller.getSDKWorkSpacePath();
+                                       Registry.sdkDataPath = controller.getSDKWorkSpacePath();
                                        Registry.targetPath = controller.getInstallPath();
                                        Registry.saveSDKInfo(Registry.targetPath);
                                        
index de5417d..c0454d3 100644 (file)
@@ -360,21 +360,6 @@ public class ViewController {
                
                return packageManager.getInstallablePackages(selectedMetas);
        }
-       
-       private PackageSet getMetaPackagesByPurpose(PackageSet metaPackages) {
-               String userAttribute = Options.purposeOfInstalling;
-               for (Package pkg : metaPackages) {
-                       String attribute = pkg.getAttribute();
-                       
-                       if (!pkg.isRootMeta() && !pkg.isExtraMeta() && !pkg.isMandatory()) {
-                               if (!attribute.equalsIgnoreCase(userAttribute)) {
-                                       metaPackages.remove(pkg);
-                               }
-                       }
-               }
-               
-               return metaPackages;
-       }
 
        /**
         * Start to uninstall