From a740dfba1383195aa4be4158416a20266da9d6db Mon Sep 17 00:00:00 2001 From: harshadyeola Date: Wed, 21 Jan 2015 18:40:44 +0530 Subject: [PATCH] fixed dependenc purge problem in mail stack --- ee/cli/plugins/site.py | 1 - ee/core/aptget.py | 32 ++++++++++++++++++-------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ee/cli/plugins/site.py b/ee/cli/plugins/site.py index 6c18e451..8b165fb4 100644 --- a/ee/cli/plugins/site.py +++ b/ee/cli/plugins/site.py @@ -836,7 +836,6 @@ class EESiteUpdateController(CementBaseController): if oldsitetype == 'mysql': config_file = (ee_site_webroot + '/backup/{0}/ee-config.php' .format(EEVariables.ee_date)) - print(config_file, 'DB_NAME') data['ee_db_name'] = (EEFileUtils.grep(self, config_file, 'DB_NAME') .split(',')[1] diff --git a/ee/core/aptget.py b/ee/core/aptget.py index 57eaa7b8..b1adc51b 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -151,6 +151,8 @@ class EEAptGet(): fprogress = apt.progress.text.AcquireProgress() iprogress = apt.progress.base.InstallProgress() + onelevel = [] + my_selected_packages = [] # Cache Initialization if not cache: @@ -176,22 +178,11 @@ class EEAptGet(): # 2) We sequentially remove every package in list # - via is_auto_installed we check if we can safely remove it deplist = [] - onelevel = __dependencies_loop(cache, deplist, pkg, - onelevel=True) + onelevel = onelevel + __dependencies_loop(cache, deplist, pkg, + onelevel=True) # Mark for deletion the first package, to fire up # auto_removable Purge? - for dep in onelevel: - my_selected_packages.append(dep.name) - try: - if purge: - dep.mark_delete(purge=True) - else: - dep.mark_delete(purge=False) - except SystemError as e: - Log.debug(self, "{0}".format(e)) - Log.error(self, "Unable to purge depedencies.") - try: if purge: pkg.mark_delete(purge=True) @@ -199,7 +190,20 @@ class EEAptGet(): pkg.mark_delete(purge=False) except SystemError as e: Log.debug(self, "{0}".format(e)) - Log.error(self, "Unable to purge packages.") + apt.ProblemResolver(cache).remove(pkg) + # print(pkg.inst_state) + # Log.error(self, "Unable to purge packages.") + + for dep in onelevel: + my_selected_packages.append(dep.name) + try: + if purge: + dep.mark_delete(purge=True) + else: + dep.mark_delete(purge=False) + except SystemError as e: + Log.debug(self, "{0}".format(e)) + Log.error(self, "Unable to purge depedencies.") # Check if packages available for remove/update. if cache.delete_count > 0: