From nobody Thu May 2 00:36:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579194963; cv=none; d=zohomail.com; s=zohoarc; b=huidYQyTlSErcbXaIapBMAP6s5+Lml4Crl83MyLxzTmhgH1nGKOCV0sqkb3d5PeTpjJ+Xa7N+LUqdJddu3RAfaL1992U/mYjXIMhQ3CUNpFKq4P8yHd4BIhXBCA+gqgzt3/t8F3WmHmHnN948Alkglgs+SoObLW1kgpxnPAShjk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579194963; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=I4G/46GcgzPWcj1xzGhH/tG3/vM5CWrEwCqw/hlXEtk=; b=DGFcqFA67qBRxaalqomRUTrjLBe4elH5eS4c/WUEwDhf2sMzSv4T/RGN3XPtHWu8bXibvvGTiDfVudjrfXQlIN4E562m3b+8GCUUq6EEVfVHNxkW8VX/j9Pv4JoiDg63REHh0IreHsChMAd4PDsMQPF/Spy6ufv1gBwBb1bgA7s= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 15791949630861022.2477594103367; Thu, 16 Jan 2020 09:16:03 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-146-x5GZ_bq5OEiwC1H5KotaBA-1; Thu, 16 Jan 2020 12:15:58 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7628B477; Thu, 16 Jan 2020 17:15:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 188ED100E7E3; Thu, 16 Jan 2020 17:15:53 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id CEF9F845EC; Thu, 16 Jan 2020 17:15:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00GHFno1004323 for ; Thu, 16 Jan 2020 12:15:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 893697C41A; Thu, 16 Jan 2020 17:15:49 +0000 (UTC) Received: from foo.home.annexia.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTP id A9E95842BA; Thu, 16 Jan 2020 17:15:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579194961; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=I4G/46GcgzPWcj1xzGhH/tG3/vM5CWrEwCqw/hlXEtk=; b=WRMywKlpDluPcxbU+v7mqDZs5xzbmw2HzaxqaDuhJT9Myec0KOOrgb0Rwr6QFCbSqc4+hc 0QwnlyUohDJAREluY8V98u81mFCRAnAUElLzsnfbWpHD8ZjEwgS8TIK9IV22tz8iFUJKNu WZDiKX9VS13Z5ySYMtCoUX/Ei6z/UAo= From: "Richard W.M. Jones" To: libvir-list@redhat.com Subject: [PATCH 1/2] run.in: Add intelligent prepend function. Date: Thu, 16 Jan 2020 17:15:41 +0000 Message-Id: <20200116171542.2764144-2-rjones@redhat.com> In-Reply-To: <20200116171542.2764144-1-rjones@redhat.com> References: <20200116171542.2764144-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-MC-Unique: x5GZ_bq5OEiwC1H5KotaBA-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This has been used in libguestfs and libnbd for quite a while as it makes the ./run script easier to read and write. See also: http://stackoverflow.com/a/9631350 Signed-off-by: Richard W.M. Jones Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Erik Skultety --- run.in | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/run.in b/run.in index 8574f81463..3118f9a9a4 100644 --- a/run.in +++ b/run.in @@ -42,22 +42,20 @@ # #---------------------------------------------------------------------- =20 +# Function to intelligently prepend a path to an environment variable. +# See http://stackoverflow.com/a/9631350 +prepend() +{ + eval $1=3D"$2\${$1:+:\$$1}" +} + # Find this script. b=3D@abs_builddir@ =20 -library_path=3D"$b/src/.libs" -if [ -z "$LD_LIBRARY_PATH" ]; then - LD_LIBRARY_PATH=3D$library_path -else - LD_LIBRARY_PATH=3D"$library_path:$LD_LIBRARY_PATH" -fi +prepend LD_LIBRARY_PATH "$b/src/.libs" export LD_LIBRARY_PATH =20 -if [ -z "$PKG_CONFIG_PATH" ]; then - PKG_CONFIG_PATH=3D"$b/src" -else - PKG_CONFIG_PATH=3D"$b/src:$PKG_CONFIG_PATH" -fi +prepend PKG_CONFIG_PATH "$b/src" export PKG_CONFIG_PATH =20 # Ensure that any 3rd party apps using libvirt.so from the build tree get --=20 2.24.1 From nobody Thu May 2 00:36:14 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) client-ip=207.211.31.120; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1579194972; cv=none; d=zohomail.com; s=zohoarc; b=R66hE6FDExqygd23vHDnCRHUurSrJR6NqF33FuAbIvo+Ka+mt6S5gqGh+3VSpRFhBffGD8FER8BsTx7T2gL8ucfBMLCKqbqAZKrowtxb/m8xJJoGBrR783a5VzwJwV7Z3jd9RPJmgd8wbJRMlQcbJU3UhLjchDYQaAMF6ElGTHw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1579194972; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=JTKtvte7ffRu44GFXuvGjHc97CeGgr7mcy+ZknPrUgg=; b=BWxXqKLEJzC5HtzAadgELjzqcMiFMGx566ZqP4q4QfREQbHkjdrJiwf6KSnZhi4mnONsY0JqWNf6nuyOP5H5ahqS0nnKtskhB1Ox2oIzyXYg6aDMAMZEUI07ryQ+BELPTRZBWwMiySdLTDUWyHbRO/rgT7Y7N8mb2g5nXqtVEXs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.120 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by mx.zohomail.com with SMTPS id 157919497230444.20854568595439; Thu, 16 Jan 2020 09:16:12 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-303-BXhKfmcCM0WeRpqXONA3Xw-1; Thu, 16 Jan 2020 12:16:09 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 96923800D53; Thu, 16 Jan 2020 17:16:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 66D3760F8D; Thu, 16 Jan 2020 17:16:02 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 19EF0845FA; Thu, 16 Jan 2020 17:16:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 00GHFoEF004330 for ; Thu, 16 Jan 2020 12:15:50 -0500 Received: by smtp.corp.redhat.com (Postfix) id B612A7C41A; Thu, 16 Jan 2020 17:15:50 +0000 (UTC) Received: from foo.home.annexia.org (ovpn-117-237.ams2.redhat.com [10.36.117.237]) by smtp.corp.redhat.com (Postfix) with ESMTP id D83D984327; Thu, 16 Jan 2020 17:15:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1579194971; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=JTKtvte7ffRu44GFXuvGjHc97CeGgr7mcy+ZknPrUgg=; b=fdoC5XGg5vyqfwJhxKFrj51XgvB4xaq1rqovOJ9s9+9BSGIF9pFP/NUG+0Rsm0CvUsHiqB DrLOh9JnUSEAI8ciexhFgVa2XasV5RfA/5eE8rtvHmOTAb4zvpwrEYgMIqat0yTGyXtPd2 1Dy32NUgdpGMuhtkc+41Zk7zzGakFEU= From: "Richard W.M. Jones" To: libvir-list@redhat.com Subject: [PATCH 2/2] run.in: Include tools directory on $PATH. Date: Thu, 16 Jan 2020 17:15:42 +0000 Message-Id: <20200116171542.2764144-3-rjones@redhat.com> In-Reply-To: <20200116171542.2764144-1-rjones@redhat.com> References: <20200116171542.2764144-1-rjones@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-MC-Unique: BXhKfmcCM0WeRpqXONA3Xw-1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" You normally want to run the locally compiled copy of virsh. Trying to run the installed version with the locally compiled library is a recipe for problems with missing symbols and so on. By adding tools to the path we can ensure that (eg) the libguestfs test suite will use compatible copies of the library and virsh. Signed-off-by: Richard W.M. Jones Reviewed-by: Daniel P. Berrang=C3=A9 Reviewed-by: Erik Skultety --- run.in | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/run.in b/run.in index 3118f9a9a4..d508e64802 100644 --- a/run.in +++ b/run.in @@ -21,12 +21,10 @@ # With this script you can run libvirt programs without needing to # install them first. You just have to do for example: # -# ./run ./tools/virsh [args ...] +# ./run virsh [args ...] # -# If you are already in the tools/ subdirectory, then the following -# command will also work: -# -# ../run ./virsh [...] +# Note that this runs the locally compiled copy of virsh which +# is usually want you want. # # You can also run the C programs under valgrind like this: # @@ -38,7 +36,7 @@ # # This also works with sudo (eg. if you need root access for libvirt): # -# sudo ./run ./tools/virsh list --all +# sudo ./run virsh list --all # #---------------------------------------------------------------------- =20 @@ -58,6 +56,9 @@ export LD_LIBRARY_PATH prepend PKG_CONFIG_PATH "$b/src" export PKG_CONFIG_PATH =20 +prepend PATH "$b/tools" +export PATH + # Ensure that any 3rd party apps using libvirt.so from the build tree get # files resolved to the build/source tree too. Typically useful for langua= ge # bindings running tests against non-installed libvirt. --=20 2.24.1