From 54f4830855f445b1179033c0ece46c4185232081 Mon Sep 17 00:00:00 2001 From: donghee yang Date: Wed, 31 Jul 2013 20:24:56 +0900 Subject: [PATCH] [Title] Updated latest source of tizen 2.2 --- .../org/tizen/installmanager/cli/CliInstall.java | 6 + .../org/tizen/installmanager/cli/CliUninstall.java | 12 +- .../tizen/installmanager/core/InstallManager.java | 6 + .../org/tizen/installmanager/core/Installer.java | 4 +- .../src/org/tizen/installmanager/core/Options.java | 18 +++ .../org/tizen/installmanager/core/Performance.java | 53 +++++++ .../installmanager/pkg/lib/PackageManager.java | 12 +- .../installmanager/ui/InstallManagerWindow.java | 5 + .../org/tizen/installmanager/ui/page/.gitignore | 1 - .../installmanager/ui/page/InstallingPage.java | 11 +- .../tizen/installmanager/ui/page/PageTemplate.java | 155 +++++++++++++++++++++ .../installmanager/ui/page/UninstallingPage.java | 4 +- .../installmanager/ui/page/ViewController.java | 11 +- InstallManager_java/src/res/COPYING | 27 ++-- 14 files changed, 287 insertions(+), 38 deletions(-) create mode 100644 InstallManager_java/src/org/tizen/installmanager/core/Performance.java delete mode 100644 InstallManager_java/src/org/tizen/installmanager/ui/page/.gitignore create mode 100644 InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java diff --git a/InstallManager_java/src/org/tizen/installmanager/cli/CliInstall.java b/InstallManager_java/src/org/tizen/installmanager/cli/CliInstall.java index 5b01810..989fce2 100644 --- a/InstallManager_java/src/org/tizen/installmanager/cli/CliInstall.java +++ b/InstallManager_java/src/org/tizen/installmanager/cli/CliInstall.java @@ -106,6 +106,12 @@ public class CliInstall { List installableMetaNames = getInstallableMetas(pm, packageNames); PackageSet installableMetas = pm.getPackagesByNames(installableMetaNames); PackageSet installablePackages = pm.getDependsPackagesFromRepository(installableMetas); + PackageSet skipPackages = pm.getPackagesByNames(Options.skipPackages); + + if (!skipPackages.isEmpty()) { + Log.log("Installation skip packages : " + skipPackages); + installablePackages = pm.diff(installablePackages, skipPackages); + } if (checkAvailableSize(installablePackages, targetDir)) { return installPackages(installablePackages, targetDir); diff --git a/InstallManager_java/src/org/tizen/installmanager/cli/CliUninstall.java b/InstallManager_java/src/org/tizen/installmanager/cli/CliUninstall.java index 827400e..724f031 100644 --- a/InstallManager_java/src/org/tizen/installmanager/cli/CliUninstall.java +++ b/InstallManager_java/src/org/tizen/installmanager/cli/CliUninstall.java @@ -64,7 +64,7 @@ public class CliUninstall { controller.init(); PackageManager pm = PackageManager.getInstance(); - + // Uninstall whole SDK. if (packageNames.contains("all")) { if (controller.uninstall(pm.getInstalledMetaNames(), null)) { @@ -73,12 +73,10 @@ public class CliUninstall { } else { return false; } - } - - // Uninstall specific installed packages. - if (!vailidateRemovePkgs(pm, packageNames)) { + } else if (!vailidateRemoveMetaPkgs(pm, packageNames)) { + // Uninstall specific installed packages. return false; - } + } if (controller.uninstall(packageNames, null)) { // After uninstall packages, if installed meta package is "ESSENTIAL-COMPONENT", @@ -117,7 +115,7 @@ public class CliUninstall { * @return If Installmanager can find input package in installed package list, return true. * otherwise, return false. */ - private static boolean vailidateRemovePkgs(PackageManager pm, Collection pkgNames) { + private static boolean vailidateRemoveMetaPkgs(PackageManager pm, Collection pkgNames) { List installedMetaNames = pm.getInstalledMetaNames(); for (String name : pkgNames) { diff --git a/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java b/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java index b2d1a54..68e9565 100644 --- a/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java +++ b/InstallManager_java/src/org/tizen/installmanager/core/InstallManager.java @@ -555,6 +555,9 @@ public class InstallManager { Log.log("start download package: " + packageToDownload); URL packageUrl = packageToDownload.getURL(); + if (monitor != null) { + monitor.workedDownload(packageToDownload.getPackageName()); + } size = mDownloader.download(packageUrl, fileDownloadTargetPath, monitor); @@ -794,6 +797,7 @@ public class InstallManager { int i = 0; for (Package pkg : installablePackages) { if (monitor != null) { + monitor.workedProcess(pkg.getPackageName()); monitor.worked(++i); } @@ -1306,6 +1310,7 @@ public class InstallManager { } PackageSet pkgsToRemove = packageManager.getToRemovePackagesInRemove(metasToRemove); + Log.log("Remove packages: " + pkgsToRemove); if (monitor != null) { @@ -1315,6 +1320,7 @@ public class InstallManager { int i = 0; for (Package pkg : pkgsToRemove) { if (monitor != null) { + monitor.workedProcess(pkg.getPackageName()); monitor.worked(++i); } diff --git a/InstallManager_java/src/org/tizen/installmanager/core/Installer.java b/InstallManager_java/src/org/tizen/installmanager/core/Installer.java index c94e8de..1f9a19b 100644 --- a/InstallManager_java/src/org/tizen/installmanager/core/Installer.java +++ b/InstallManager_java/src/org/tizen/installmanager/core/Installer.java @@ -548,7 +548,9 @@ public class Installer { String command = ShellUtil.addInterpreter(scriptFile.getAbsolutePath()); - int exitCode = ShellUtil.execute(command, env, null, + String current = PathUtil.getCurrentDir(); + Log.log("Current working directory. => " + current); + int exitCode = ShellUtil.execute(command, env, new File(current), new LoggerShellParser()); // check exit code diff --git a/InstallManager_java/src/org/tizen/installmanager/core/Options.java b/InstallManager_java/src/org/tizen/installmanager/core/Options.java index e76779c..27d0dc6 100644 --- a/InstallManager_java/src/org/tizen/installmanager/core/Options.java +++ b/InstallManager_java/src/org/tizen/installmanager/core/Options.java @@ -135,6 +135,7 @@ public class Options { public static boolean isNetwork = true; public static List packages = new ArrayList(); + public static List skipPackages = new ArrayList(); /** * Use only download for making SDK image. @@ -470,6 +471,23 @@ public class Options { } } + // set skip packages + argIter = argArray.iterator(); + while (argIter.hasNext()) { + if (argIter.next().equalsIgnoreCase("-skip")) { + argIter.remove(); + while (argIter.hasNext()) { + String pkg = argIter.next(); + if (!pkg.startsWith("-")) { + skipPackages.add(pkg); + argIter.remove(); + } else { + break; + } + } + } + } + // set proxy argIter = argArray.iterator(); while (argIter.hasNext()) { diff --git a/InstallManager_java/src/org/tizen/installmanager/core/Performance.java b/InstallManager_java/src/org/tizen/installmanager/core/Performance.java new file mode 100644 index 0000000..a8ce9de --- /dev/null +++ b/InstallManager_java/src/org/tizen/installmanager/core/Performance.java @@ -0,0 +1,53 @@ +package org.tizen.installmanager.core; + +import java.util.Date; + +import org.tizen.installmanager.lib.Log; + +public class Performance { + private static Date imStartTime = null; + private static Date imEndTime = null; + private static Date installationStartTime = null; + private static Date installationEndTime = null; + + public static void setIMStartTime() { + imStartTime = new Date(); + } + + public static void setIMEndTime() { + imEndTime = new Date(); + } + + public static void setInstallationStartTime() { + installationStartTime = new Date(); + } + + public static void setInstallationEndTime() { + installationEndTime = new Date(); + } + + public static void printToLogFile() { + Log.log("The installmanager start time : " + imStartTime); + Log.log("The installmanager end time : " + imEndTime); + Log.log("The installation start time : " + installationStartTime); + Log.log("The installation end time : " + installationEndTime); + + long progressSecond = getProgressTimeOfInstallation()/1000; + + if (progressSecond >= 0) { + Log.log("The progress time of the installation : About " + progressSecond/60 + " minutes" + +"(" + progressSecond + " seconds)"); + } else { + Log.log("The progress time of the installation : Installation fail"); + } + } + + private static long getProgressTimeOfInstallation() { + if (installationStartTime == null || installationEndTime == null) { + return -1; + } + + long interval = installationEndTime.getTime() - installationStartTime.getTime(); + return interval; + } +} diff --git a/InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager.java b/InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager.java index 5216c0c..458c6e2 100644 --- a/InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager.java +++ b/InstallManager_java/src/org/tizen/installmanager/pkg/lib/PackageManager.java @@ -661,6 +661,16 @@ public abstract class PackageManager { return installedMetaNames; } + public List getInstalledPkgNames() { + ArrayList installedPkgNames = new ArrayList(); + + for (Package pkg : getInstalledPackages()) { + installedPkgNames.add(pkg.getPackageName()); + } + + return installedPkgNames; + } + /** * @return meta packages among all recent packages */ @@ -1283,7 +1293,7 @@ public abstract class PackageManager { * @param pset2 * @return new package set that represents (pset1 - pset2). */ - private PackageSet diff(PackageSet pset1, PackageSet pset2) { + public PackageSet diff(PackageSet pset1, PackageSet pset2) { PackageSet diff = new PackageSet(); for(Package p : pset1) { if(!pset2.contains(p)) { diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java b/InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java index 8f7f32b..55ce20e 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/InstallManagerWindow.java @@ -64,6 +64,7 @@ import org.tizen.installmanager.core.IMExitException; import org.tizen.installmanager.core.IMFatalException; import org.tizen.installmanager.core.InstallManager; import org.tizen.installmanager.core.Options; +import org.tizen.installmanager.core.Performance; import org.tizen.installmanager.lib.ErrorController; import org.tizen.installmanager.lib.IMError; import org.tizen.installmanager.lib.Log; @@ -810,6 +811,7 @@ public class InstallManagerWindow extends ApplicationWindow { * @param args */ public static void main(String args[]) { + Performance.setIMStartTime(); InstallManager.deleteTempFile(); Log.open(); @@ -916,6 +918,9 @@ public class InstallManagerWindow extends ApplicationWindow { ProgramController.createProgramController().removeSDKTempDir(); } + Performance.setIMEndTime(); + Performance.printToLogFile(); + Log.LogTitle("Installmanager finish"); Log.close(); diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/.gitignore b/InstallManager_java/src/org/tizen/installmanager/ui/page/.gitignore deleted file mode 100644 index 0536a1f..0000000 --- a/InstallManager_java/src/org/tizen/installmanager/ui/page/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/PageTemplate.java diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/InstallingPage.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/InstallingPage.java index dfabdb3..ad6792d 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/page/InstallingPage.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/page/InstallingPage.java @@ -409,8 +409,6 @@ public class InstallingPage extends PageTemplate { display.syncExec(new Runnable() { @Override public void run() { - statusLabel.setText("Processing : package \"" - + mProgressTitle + "\""); installedNumberLabel.setText(work + "/" + (totalWork)); progressBar.setSelection(100 * work / (int) totalWork); } @@ -478,7 +476,7 @@ public class InstallingPage extends PageTemplate { return; } - workedTitle(title); + workedTitle("Downloading : " + title); } @Override @@ -487,8 +485,7 @@ public class InstallingPage extends PageTemplate { return; } - String processTitle = "File checking : " + title; - workedTitle(processTitle); + workedTitle("File checking : " + title); } /** @@ -522,8 +519,7 @@ public class InstallingPage extends PageTemplate { } else { currentSize = dformat.format(mProgressSize) + "KB"; } - - statusLabel.setText("File checking : " + mProgressTitle); + installedNumberLabel.setText(currentSize + "/" + totalSize); mSubTitleOfProgress.setText(""); mDownloadVelocity.setText(""); @@ -617,7 +613,6 @@ public class InstallingPage extends PageTemplate { } } - statusLabel.setText("Downloading : " + mProgressTitle); installedNumberLabel.setText(currentSize + "/" + totalSize); mSubTitleOfProgress.setText("Remaining time : " + remainTimeStr); mDownloadVelocity.setText(downloadVelocityStr); diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java new file mode 100644 index 0000000..5843dd7 --- /dev/null +++ b/InstallManager_java/src/org/tizen/installmanager/ui/page/PageTemplate.java @@ -0,0 +1,155 @@ +/* +* InstallManager +* +* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. +* +* Contact: +* Wooyoung Cho +* Shihyun Kim +* Taeyoung Son +* Yongsung kim +* + * Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +* +* Contributors: +* - S-Core Co., Ltd +* +*/ + +package org.tizen.installmanager.ui.page; + + +import org.eclipse.swt.SWT; +import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.FontData; +import org.eclipse.swt.widgets.Composite; +import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; +import org.tizen.installmanager.lib.Platform; +import org.tizen.installmanager.ui.InstallManagerWindow; +import org.tizen.installmanager.util.PathUtil; + + +/** + * This class is a parent class of all composite classes. + */ +public class PageTemplate extends Composite { + + public static final String RESOURCE_PATH = "/res/images"; + + private Label imgLabel; + private Label titleLabel; + private Label subtitleLabel; + public Composite customComposite; + + /** + * Set basic environment of child pages. + * @param parent + * @param style + */ + public PageTemplate(Composite parent, int style) { + super(parent, style); + setLayout(null); + setBackground(InstallManagerWindow.getBackgroundColor()); + + imgLabel = new Label(this, SWT.NONE); + imgLabel.setBounds(0, 0, 160, 398); + imgLabel.setBackground(InstallManagerWindow.getBackgroundColor()); + + titleLabel = new Label(this, SWT.NONE); + + if (Platform.isUbuntu()) { + titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Dejavu Sans", 11, SWT.BOLD)))); + } else if (Platform.isWindows()) { + titleLabel.setFont((new Font(Display.getCurrent(), new FontData("Verdana", 11, SWT.BOLD)))); + } + + titleLabel.setBounds(160, 17, 468, 20); + titleLabel.setText("New Label"); + titleLabel.setBackground(InstallManagerWindow.getBackgroundColor()); + + subtitleLabel = new Label(this, SWT.WRAP); + subtitleLabel.setBounds(160, 43, 451, 40); + subtitleLabel.setText(""); + subtitleLabel.setBackground(InstallManagerWindow.getBackgroundColor()); + + customComposite = new Composite(this, SWT.NONE); + + customComposite.setSize(468, 304); + customComposite.setLocation(160, 90); + customComposite.setBackground(InstallManagerWindow.getBackgroundColor()); + } + + /** + * Set the left image in resource. + * @param Image path + */ + public void setLeftImageFromResource(String imgRscPath) { + imgLabel.setImage(PathUtil.getImageFromResource(imgRscPath)); + } + + /** + * Set page's title. + * @param Title string + */ + public void setTitle(String strTitle) { + titleLabel.setText(strTitle); + } + + /** + * Set page's sub title + * @param Sub title string + */ + public void setSubTitle(String strSubTitle) { + subtitleLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLACK)); + subtitleLabel.setText(strSubTitle); + } + + public void setErrorSubTitle(String strSubTitle) { + subtitleLabel.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_DARK_RED)); + subtitleLabel.setText(strSubTitle); + } + + /** + * Return custom composite + * @return custom composite object + */ + public Composite getCustomComposite() { + return customComposite; + } + + public void setImageBounds(int nX, int nY, int nWidth, int nHeight) { + imgLabel.setBounds(nX, nY, nWidth, nHeight); + } + + public void setTitleBounds(int nX, int nY, int nWidth, int nHeight) { + titleLabel.setBounds(nX, nY, nWidth, nHeight); + } + + public void setSubTitleBounds(int nX, int nY, int nWidth, int nHeight) { + subtitleLabel.setBounds(nX, nY, nWidth, nHeight); + } + + public void setSubTitleFont(FontData fontData) { + subtitleLabel.setFont((new Font(Display.getCurrent(), fontData))); + } + + public void setCustomCompositeBounds(int nX, int nY, int nWidth, int nHeight) { + customComposite.setSize(nWidth, nHeight); + customComposite.setLocation(nX, nY); + } + + public void disableSubtitleBounds() { + subtitleLabel.dispose(); + } +} diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/UninstallingPage.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/UninstallingPage.java index ba43338..79404d2 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/page/UninstallingPage.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/page/UninstallingPage.java @@ -285,7 +285,6 @@ public class UninstallingPage extends PageTemplate { display.asyncExec(new Runnable() { @Override public void run() { - statusLabel.setText("Processing : package \"" + mProgressTitle + "\""); mSubTitleOfProgress.setText(mSubTitle); uninstalledNumberLabel.setText(work + "/" + totalWork); progressBar.setSelection(100 * work / totalWork); @@ -344,8 +343,7 @@ public class UninstallingPage extends PageTemplate { return; } - String processTitle = "Processing : package \"" + mProgressTitle + "\""; - workedTitle(processTitle); + workedTitle("Processing : package \"" + mProgressTitle + "\""); } @Override diff --git a/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java b/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java index ef90eb5..0432e97 100644 --- a/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java +++ b/InstallManager_java/src/org/tizen/installmanager/ui/page/ViewController.java @@ -46,6 +46,7 @@ import org.tizen.installmanager.core.IMFatalException; import org.tizen.installmanager.core.InstallManager; import org.tizen.installmanager.core.InstallManagerConstants; import org.tizen.installmanager.core.Options; +import org.tizen.installmanager.core.Performance; import org.tizen.installmanager.core.SDKExtensionInfo; import org.tizen.installmanager.core.Config.ServerType; import org.tizen.installmanager.lib.Documents; @@ -296,6 +297,8 @@ public class ViewController { */ public boolean install(Collection installList, String targetPath, InstallProgressMonitor monitor) throws IMExitException { + Performance.setInstallationStartTime(); + Log.log("======== Start Installing ========"); Log.log("Selected package list => " + installList); Log.log("target path => " + targetPath); @@ -336,6 +339,7 @@ public class ViewController { PathUtil.remove(Config.getInstance().getDownloadDirPath()); } + Performance.setInstallationEndTime(); return bResult; } @@ -395,6 +399,8 @@ public class ViewController { * @see ViewController#uninstallPackages(PackageSet, IIMProgressMonitor) */ public boolean uninstall(List uninstallList, IIMProgressMonitor monitor) { + Performance.setInstallationStartTime(); + Log.log("ViewController Uninstall Start => " + uninstallList); if (packageManager == null || uninstallList.size() == 0) { Log.err("ViewController.uninstall() uninstalllist does not exist. => " + uninstallList); @@ -404,11 +410,14 @@ public class ViewController { if (Options.doRemoveOldSDK || (uninstallList.size() == 1 && uninstallList.get(0).equals(Config.SDK_NAME))) { uninstallAll(monitor); + Performance.setInstallationEndTime(); return true; } else { PackageSet removablePackages = packageManager.getInstalledPackagesByName(uninstallList); - return uninstallPackages(removablePackages, monitor); + boolean result = uninstallPackages(removablePackages, monitor); + Performance.setInstallationEndTime(); + return result; } } diff --git a/InstallManager_java/src/res/COPYING b/InstallManager_java/src/res/COPYING index 35fe5b2..2fe6c04 100644 --- a/InstallManager_java/src/res/COPYING +++ b/InstallManager_java/src/res/COPYING @@ -1,17 +1,12 @@ - -Tizen SDK - -Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components. All open source software portions ("Open Source Software") are licensed under the open source licenses that accompany such Open Source Software. -The licenses governing the Open Source Software are available at: -https://developer.tizen.org/tizen-sdk-opensource-license - -Except for the Open Source Software and proprietary components contributed from companies other than Samsung, contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Samsung Tizen SDK License Agreement, available at: -https://developer.tizen.org/tizen-sdk-license - -The licenses of all proprietary components contributed from companies other than Samsung will be either displayed as part of their respective installers or accessed inside installation package archive of each component. - -You may access and download Tizen SDK Open Source Software at: -https://developer.tizen.org/downloads/tizen-sdk - -BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS, THE SAMSUNG TIZEN SDK LICENSE AGREEMENT AND THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG. If you do not agree with the Open Source Software license terms or the SAMSUNG TIZEN SDK LICENSE AGREEMENT or THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG, you may not download or use Tizen SDK. \ No newline at end of file +Tizen SDK + +Tizen SDK contains software portions licensed under various open source licenses as well as proprietary components. All software portions ("Software") are licensed under licenses that accompany such Software. + +The licenses governing the Software("Licenses") are available at: https://developer.tizen.org/tizen-sdk-software-licenses + +The licenses("Other Licenses") of software which are not listed at the above URL will be either displayed as part of their respective installers or accessed inside installation package archive of each component. + +You may access and download Tizen SDK Open Source Software at: http://developer.tizen.org/download/tizenopensdk.tar.gz + +BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE TERMS IN Licenses, AND THE TERMS IN Other Licenses. If you do not agree with the terms in Licenses or the terms in Other Licenses you may not download or use Tizen SDK. \ No newline at end of file -- 2.7.4