Browse Source

apt-get unable to fork bug solved

bugfixes
harshadyeola 10 years ago
parent
commit
0fe8026bad
  1. 28
      ee/core/aptget.py

28
ee/core/aptget.py

@ -34,17 +34,19 @@ class EEAptGet():
def install(self, packages): def install(self, packages):
"""Installation of packages""" """Installation of packages"""
apt_pkg.init()
# #apt_pkg.PkgSystemLock()
apt_cache = apt.cache.Cache()
def install_package(self, package_name): def install_package(self, package_name):
apt_pkg.init() global apt_cache
# #apt_pkg.PkgSystemLock()
apt_cache = apt.cache.Cache()
pkg = apt_cache[package_name.strip()] pkg = apt_cache[package_name.strip()]
if package_name.strip() in apt_cache: if package_name.strip() in apt_cache:
if pkg.is_installed: if pkg.is_installed:
#apt_pkg.PkgSystemUnLock() #apt_pkg.PkgSystemUnLock()
Log.info(self, 'Trying to install a package that ' Log.debug(self, 'Trying to install a package that '
'is already installed (' + 'is already installed (' +
package_name.strip() + ')') package_name.strip() + ')')
#apt_cache.close() #apt_cache.close()
return False return False
else: else:
@ -67,17 +69,19 @@ class EEAptGet():
continue continue
def remove(self, packages, auto=False, purge=False): def remove(self, packages, auto=False, purge=False):
apt_pkg.init()
# apt_pkg.PkgSystemLock()
apt_cache = apt.cache.Cache()
def remove_package(self, package_name, purge=False): def remove_package(self, package_name, purge=False):
apt_pkg.init() global apt_cache
# apt_pkg.PkgSystemLock()
apt_cache = apt.cache.Cache()
pkg = apt_cache[package_name.strip()] pkg = apt_cache[package_name.strip()]
if package_name.strip() in apt_cache: if package_name.strip() in apt_cache:
if not pkg.is_installed: if not pkg.is_installed:
# apt_pkg.PkgSystemUnLock() # apt_pkg.PkgSystemUnLock()
Log.info(self, 'Trying to uninstall a package ' Log.debug(self, 'Trying to uninstall a package '
'that is not installed (' + 'that is not installed (' +
package_name.strip() + ')') package_name.strip() + ')')
return False return False
else: else:
try: try:

Loading…
Cancel
Save