* Do not remove SDK packages when install extension packages.
* Show an error message when cannot find files in repository.
Change-Id: Iad1f2a08b2e3f293897b54bffc61e213b486596c
}
Log.log("start download package: " + packageToDownload);
URL packageUrl = packageToDownload.getURL();
+
size = mDownloader.download(packageUrl, fileDownloadTargetPath,
monitor);
+
if (size >= 0) {
if (Options.onlyDownload) {
System.out.println(" done.");
removeAllPackages(monitor);
} else {
// remove missing packages
- removeMissingPackages(monitor);
+ if (!packageManager.isRepoPackagesEmpty()) {
+ removeMissingPackages(monitor);
+ }
// remove conflict packages
if (!removeConflictPackages(installablePackages, monitor)) {
Log.log("InstallManager packages remove success. return => " + true);
return true;
}
-
+
/**
* Remove all of packages.
*
PathUtil.remove(localPath);
}
- throw new IMNetworkConnectException(responseCode, responseMessage);
+ return ERROR;
}
long downloadSize = downloadFile(localPath, monitor);
} catch (FileNotFoundException e) {
Log.ExceptionLog(e);
ErrorController
- .setError(ErrorCode.CONFIG_CANNOT_FIND_PACKAGE_LIST_FILE_IN_REPOSITORY);
+ .setError(ErrorCode.CANNOT_FIND_FILE_IN_REPOSITROY);
} catch (SSLHandshakeException e) {
Log.ExceptionLog(e);
*/
public enum ErrorCode {
CANNOT_FIND_CONFIG_FILE("The installmanager.conf file not found."),
- CANNOT_FIND_FILE_IN_REPOSITROY("Cannot connect to SDK package server."),
+ CANNOT_FIND_FILE_IN_REPOSITROY("Cannot find file in repository."),
CANNOT_CREATE_DOWNLOAD_FILE("Download file cannot be created."),
CANNOT_CHECK_INSTLLED_FILE_LIST("Installed file list cannot be checked."),
CANNOT_MOVE_FILE_TO_TARGET_DIRECTORY("File cannot be moved to the target directory."),
//Configuration file error
CONFIG_CANNOT_PARSING_PACKAGE_LIST("Package list cannot be read. Check the repository or proxy server."),
- CONFIG_CANNOT_FIND_PACKAGE_LIST_FILE_IN_REPOSITORY("Package list file not found in the repository."),
+ CONFIG_CANNOT_FIND_PACKAGE_LIST_FILE_IN_REPOSITORY("Cannot get the package information. " +
+ "\nPlease check your repository or SDK image file."),
CONFIG_CANNOT_REMOVE_CONFLICT_PACKAGES("Conflict package removal failed."),
CONFIG_CANNOT_REMOVE_UPDATABLE_PACKAGES("Updatable package removal failed."),
CONFIG_CANNOT_READ_SERVER_TYPE("Server type cannot be read. Check the server type in the installmanager.conf file."),
if (errorCode != null) {
return errorCode.getErrorMessage();
} else {
- if (responseMessage == null || responseMessage.equalsIgnoreCase("OK")) {
+ if (responseMessage == null || responseMessage.isEmpty() || responseMessage.equalsIgnoreCase("OK")) {
return ErrorController.getErrorMessage();
} else {
return responseMessage;
import org.tizen.installmanager.core.InstallManager;
import org.tizen.installmanager.core.Options;
import org.tizen.installmanager.core.SDKExtensionInfo;
+import org.tizen.installmanager.core.Config.ServerType;
import org.tizen.installmanager.lib.Downloader;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.Log;
}
}
- /**
- * Initializes package manager with information of installed packages and packages of repository
- * @param sectionsInstalled a list of property sections of the installed packages
- * @param repoToSectionsMap a map from base url of repository to a list of property sections of the repository
- */
- protected PackageManager(List<PropertySection> sectionsInstalled, Map<String,List<PropertySection>> repoToSectionsMap) {
- setInstalledPackageList(sectionsInstalled);
- setRepoPackages(repoToSectionsMap);
- getRecentPackages();
- }
-
private void setRepository(String repository) {
if (installedRepository == null) {
installedRepository = repository;
if (repoPackages == null) {
repoPackages = new PackageSet();
} else {
- if (repoPackages.hasPackageByName("EXTRA")) {
+ if (repoPackages.hasPackageByName("EXTRAS")) {
return;
}
}
}
/**
+ * If package set of repository is empty, return true;
+ * @return
+ */
+ public boolean isRepoPackagesEmpty() {
+ if (repoPackages == null || repoPackages.isEmpty()) {
+ return true;
+ } else if (repoPackages.size() == 1) {
+ if (repoPackages.getPackageByName("EXTRAS") != null) {
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
* If pkg is installed, return true. else return false
* @param pkg
* @return
}
}
+ public PackageSet getRecentMetaPackages() {
+ PackageSet recentPackages = union(repoPackages, installedPackages);
+ return rootMeta(recentPackages);
+ }
+
/**
* @return meta packages among installed packages
*/
return meta(installedPackages);
}
+
/**
* @return meta packages among all recent packages
*/
}
try {
- loadPackagesToTreeViewer(viewController.getRootMetaPackageListOfRepository());
+ loadPackagesToTreeViewer(viewController.getInstallableMetaPackageList());
viewController.loadSdkExtension();
addExtensionPackagesToExtra(viewController.getRootMetaPackageListOfExtension());
getItems().clear();
try {
- loadPackagesToTreeViewer(viewController.getRootMetaPackageListOfRepository());
+ loadPackagesToTreeViewer(viewController.getInstallableMetaPackageList());
viewController.loadSdkExtension();
addExtensionPackagesToExtra(viewController.getRootMetaPackageListOfExtension());
}
}
+ public PackageSet getTreeMetaPackageListOfRepository() {
+ if (packageManager == null) {
+ return null;
+ } else {
+ return packageManager.getRecentMetaPackages();
+ }
+ }
+
public PackageSet getRootMetaPackageListOfExtension() {
if (packageManager == null) {
return null;
Log.ExceptionLog(e);
//retry dialog.
- String errorMsg = "Network connection is not available.\nWould you like to retry?\n(" +
- e.getMessage() + ")";
+ String errorMsg = e.getMessage() + "\nWould you like to retry?";
int ret = MessageBoxDlg.showDlg(
InstallManagerWindow.getInstallManagerWindow().getShell(),
"Warning",
}
//get all meta packages (installable packages)
+ //TODO : show all packages. (installable, installed)
PackageSet metaPackageSet = packageManager.getRootMetaPackagesOfRepository();
return makeTreeItem(metaPackageSet);