Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
virtme
0008-modfinder-Use-find_binary_or_raise-to-find...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0008-modfinder-Use-find_binary_or_raise-to-find-modprobe.patch of Package virtme
From 7a5257bc978bc26637c7d6a8fa75851beba0bd80 Mon Sep 17 00:00:00 2001 From: Andy Lutomirski <luto@kernel.org> Date: Wed, 13 Nov 2019 13:10:23 -0800 Subject: [PATCH 8/9] modfinder: Use find_binary_or_raise() to find modprobe This should fix #53. Signed-off-by: Andy Lutomirski <luto@kernel.org> --- virtme/modfinder.py | 6 +++--- virtme/util.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/virtme/modfinder.py b/virtme/modfinder.py index d0269b0..88f7df57 100644 --- a/virtme/modfinder.py +++ b/virtme/modfinder.py @@ -14,16 +14,16 @@ everything. The idea is to require very few modules. from typing import List import re -import shutil import subprocess -import os, os.path +import os import itertools +from . import util _INSMOD_RE = re.compile('insmod (.*[^ ]) *$') def resolve_dep(modalias, root=None, kver=None, moddir=None): # /usr/sbin might not be in the path, and modprobe is usually in /usr/sbin - modprobe = shutil.which('modprobe') or '/usr/sbin/modprobe' + modprobe = util.find_binary_or_raise(['modprobe']) args = [modprobe, '--show-depends'] args += ['-C', '/var/empty'] if root is not None: diff --git a/virtme/util.py b/virtme/util.py index 16b7ef7..cc1787b 100644 --- a/virtme/util.py +++ b/virtme/util.py @@ -31,3 +31,10 @@ def find_binary(names: Sequence[str], root: str = '/', # We give up. return None + +def find_binary_or_raise(names: Sequence[str], root: str = '/', + use_path: bool = True) -> str: + ret = find_binary(names, root=root, use_path=use_path) + if ret is None: + raise RuntimeError('Could not find %r' % names) + return ret -- 2.26.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor