diff --git a/ee/core/aptget.py b/ee/core/aptget.py index ce6f9712..90004b5e 100644 --- a/ee/core/aptget.py +++ b/ee/core/aptget.py @@ -113,18 +113,6 @@ class EEAptGet(): except SystemError as e: Log.debug(self, 'SystemError: ' + str(e)) return False - try: - # apt_pkg.PkgSystemUnLock() - result = apt_cache.commit() - # apt_cache.close() - return result - except SystemError as e: - Log.debug(self, 'SystemError: ' + str(e)) - return False - except Exception as e: - Log.debug(self, str(e)) - Log.error(self, str(e)) - # apt_cache.close() else: # apt_cache.close() Log.error(self, 'Unknown package selected (' + @@ -134,6 +122,20 @@ class EEAptGet(): if not remove_package(self, package, purge=purge): continue + if apt_cache.delete_count > 0: + try: + # apt_pkg.PkgSystemUnLock() + result = apt_cache.commit() + # apt_cache.close() + return result + except SystemError as e: + Log.debug(self, 'SystemError: ' + str(e)) + return False + except Exception as e: + Log.debug(self, str(e)) + Log.error(self, str(e)) + # apt_cache.close() + def auto_clean(self): """ Similar to `apt-get autoclean`