diff options
author | 2010-07-15 22:55:18 -0300 | |
---|---|---|
committer | 2010-07-15 22:55:18 -0300 | |
commit | 4dc90cf7d9e5a1103b0d9ef2be6ac9cc47885332 (patch) | |
tree | 5d330a05306b0f02f402dd8c45487654f215d875 | |
parent | added a security test, to check if the current user belongs to the user (diff) | |
download | g-octave-4dc90cf7d9e5a1103b0d9ef2be6ac9cc47885332.tar.gz g-octave-4dc90cf7d9e5a1103b0d9ef2be6ac9cc47885332.tar.bz2 g-octave-4dc90cf7d9e5a1103b0d9ef2be6ac9cc47885332.zip |
added a test to verify if the selected package manager is currently
installed.
-rw-r--r-- | g_octave/package_manager.py | 11 | ||||
-rwxr-xr-x | scripts/g-octave | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/g_octave/package_manager.py b/g_octave/package_manager.py index 60f7472..6de64b1 100644 --- a/g_octave/package_manager.py +++ b/g_octave/package_manager.py @@ -36,6 +36,11 @@ class Base: check_overlay = lambda a,b,c: True create_manifest = lambda a,b: os.EX_OK + def is_installed(self): + if self._client != '': + return os.path.exists(self._client) + return False + def do_ebuilds(self, packages): for package in packages: Ebuild(package[len('g-octave/'):], pkg_manager=self).create() @@ -55,7 +60,7 @@ class Base: class Portage(Base): - _client = 'emerge' + _client = '/usr/bin/emerge' _group = 'portage' post_uninstall = [ @@ -110,7 +115,7 @@ class Portage(Base): class Pkgcore(Base): - _client = 'pmerge' + _client = '/usr/bin/pmerge' _group = 'portage' post_uninstall = [ @@ -163,7 +168,7 @@ class Pkgcore(Base): class Paludis(Base): - _client = 'paludis' + _client = '/usr/bin/paludis' _group = 'paludisbuild' post_uninstall = [ diff --git a/scripts/g-octave b/scripts/g-octave index 458d3db..7241431 100755 --- a/scripts/g-octave +++ b/scripts/g-octave @@ -193,6 +193,12 @@ def main(): out.eerror('Invalid package manager: %s' % conf_prefetch.package_manager) return os.EX_CONFIG + # checking if the package manager is installed + if not pkg_manager.is_installed(): + log.error('Package manager not installed: %s' % conf_prefetch.package_manager) + out.eerror('Package manager not installed: %s' % conf_prefetch.package_manager) + return os.EX_CONFIG + # checking if the current user is allowed to run g-octave current_user = getpass.getuser() if current_user not in pkg_manager.allowed_users(): |