def update_package(self, package_name): """ Update a package and all packages that depend on it.""" self._check_package(package_name) package = self._packages[package_name] self._check_mode(package) if not isinstance(package, localpackage.LocalPackage): raise snoing_exceptions.PackageException( "Package cannot be updated by snoing. " + package.get_help_text(), package_name) if package.is_updated(): # Nothing todo if already updated return dependencies = self._install_dependencies(package) package.set_dependency_paths(dependencies) try: self._logger.set_state("Updating", package_name) package.update() except snoing_exceptions.SystemException, e: self._logger.error(e.args[0]) self._logger.detail(e.Details) raise snoing_exceptions.PackageException("Installation fail", package_name)
def install_package(self, package_name): """ Install a package, installing all it's dependencies first.""" if self.check_installed(package_name): return package = self._packages[package_name] self._check_mode(package) if not isinstance(package, localpackage.LocalPackage): raise snoing_exceptions.PackageException( "Package cannot be installed by snoing. " + package.get_help_text(), package_name) dependencies = self._install_dependencies(package) package.set_dependency_paths(dependencies) try: self._logger.set_state("Downloading", package_name) package.download() self._logger.package_downloaded(package_name) self._logger.set_state("Installing", package_name) package.install() self._logger.package_installed(package_name) except snoing_exceptions.SystemException, e: self._logger.error(e.args[0]) self._logger.detail(e.Details) raise snoing_exceptions.PackageException("Installation fail", package_name)