Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug while detecting dependencies on Debian/Ubuntu systems, iff rpm is installed #732

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions easybuild/framework/easyconfig/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
from easybuild.tools.filetools import run_cmd
from easybuild.tools.module_naming_scheme.utilities import det_full_ec_version
from easybuild.tools.modules import get_software_root_env_var_name, get_software_version_env_var_name
from easybuild.tools.systemtools import get_shared_lib_ext
from easybuild.tools.systemtools import get_shared_lib_ext, get_os_name
from easybuild.tools.toolchain import DUMMY_TOOLCHAIN_NAME, DUMMY_TOOLCHAIN_VERSION
from easybuild.tools.toolchain.utilities import search_toolchain
from easybuild.framework.easyconfig.default import DEFAULT_CONFIG, ALL_CATEGORIES
Expand Down Expand Up @@ -459,12 +459,17 @@ def _os_dependency_check(self, dep):
# - uses rpm -q and dpkg -s --> can be run as non-root!!
# - fallback on which
# - should be extended to files later?
if run_cmd('which rpm', simple=True, log_ok=False):
cmd = "rpm -q %s" % dep
elif run_cmd('which dpkg', simple=True, log_ok=False):
cmd = "dpkg -s %s" % dep
if get_os_name() in ['debian', 'ubuntu']:
if run_cmd('which dpkg', simple=True, log_ok=False):
cmd = "dpkg -s %s" % dep
else:
cmd = "exit 1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't repeat this in multiple places, set this as the first value for cmd, i.e. on line 461 (above the debian and ubuntu if clause)

else:
cmd = "exit 1"
# OK for get_os_name() == redhat, fedora, RHEL, SL, centos
if run_cmd('which rpm', simple=True, log_ok=False):
cmd = "rpm -q %s" % dep
else:
cmd = "exit 1"

found = run_cmd(cmd, simple=True, log_all=False, log_ok=False)

Expand Down