From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ferruh Yigit Subject: Re: [dpdk-stable] [PATCH] devbind: check for lspci Date: Wed, 7 Nov 2018 18:07:17 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: john.mcnamara@intel.com, stable@dpdk.org To: "Burakov, Anatoly" , dev@dpdk.org Return-path: In-Reply-To: Content-Language: en-US List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On 11/7/2018 4:30 PM, Burakov, Anatoly wrote: > On 07-Nov-18 4:01 PM, Ferruh Yigit wrote: >> On 11/7/2018 1:56 PM, Anatoly Burakov wrote: >>> On some distributions (such as CentOS 7) lspci may not be installed >>> by default, causing exceptions which are difficult to interpret. >>> >>> Fix devbind script to check if lspci is installed at script startup. >> >> I guess we need lspci for `--status`, bind/unbind can be done without `lspci`, >> what about adding check only display path? > > IMO it's not worth respinning over that minor detail, but if you feel > strongly about it - sure, i can do a v2 with this on display path only :) No strong opinion, was just an idea, OK to go as it is if you prefer, not having lspci installed but still want to use devbind may not be common usecase.. > >> >>> >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Anatoly Burakov >>> --- >>> usertools/dpdk-devbind.py | 7 +++++++ >>> 1 file changed, 7 insertions(+) >>> >>> diff --git a/usertools/dpdk-devbind.py b/usertools/dpdk-devbind.py >>> index 7d564634c..74bf514c0 100755 >>> --- a/usertools/dpdk-devbind.py >>> +++ b/usertools/dpdk-devbind.py >>> @@ -655,6 +655,13 @@ def do_arg_actions(): >>> >>> def main(): >>> '''program main function''' >>> + # check if lspci is installed, suppress any output >>> + with open(os.devnull, 'w') as devnull: >>> + ret = subprocess.call(['which', 'lspci'], >>> + stdout=devnull, stderr=devnull) >>> + if ret != 0: >>> + print("'lspci' not found - please install 'lspci'") >>> + sys.exit(1) >>> parse_args() >>> check_modules() >>> clear_data() >>> >> >> > >