From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from vmicros1.altlinux.org (vmicros1.altlinux.org [194.107.17.57]) by sourceware.org (Postfix) with ESMTP id A3545383D827 for ; Mon, 26 Jul 2021 22:33:00 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A3545383D827 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=altlinux.org Received: from mua.local.altlinux.org (mua.local.altlinux.org [192.168.1.14]) by vmicros1.altlinux.org (Postfix) with ESMTP id 9F5E472C8BB for ; Tue, 27 Jul 2021 01:32:59 +0300 (MSK) Received: by mua.local.altlinux.org (Postfix, from userid 508) id 8F9337CF724; Tue, 27 Jul 2021 01:32:59 +0300 (MSK) Date: Tue, 27 Jul 2021 01:32:59 +0300 From: "Dmitry V. Levin" To: debugedit@sourceware.org Subject: Re: [PATCH] find-debuginfo: Check RPM environment variables are there Message-ID: <20210726223259.GA13702@altlinux.org> References: <20210726222311.16348-1-mark@klomp.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210726222311.16348-1-mark@klomp.org> X-Spam-Status: No, score=-12.7 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: debugedit@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: debugedit development mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 26 Jul 2021 22:33:02 -0000 On Tue, Jul 27, 2021 at 12:23:11AM +0200, Mark Wielaard wrote: > find-debuginfo relies on a couple of RPM environment variables. > Ideally we provide command line arguments to set them. But they are > somewhat tied to how rpm sets things up. So for now just warn and > exit if they aren't set. > > See also https://sourceware.org/bugzilla/show_bug.cgi?id=27637 > > Signed-off-by: Mark Wielaard > --- > scripts/find-debuginfo.in | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/scripts/find-debuginfo.in b/scripts/find-debuginfo.in > index 828fd09..971218a 100755 > --- a/scripts/find-debuginfo.in > +++ b/scripts/find-debuginfo.in > @@ -146,6 +146,24 @@ n_jobs=1 > # exit early on --version or --help > done=false > > +# Currently this scripts depends on some RPM environment variables > +# being set. RPM_BUILD_ROOT as the installation root directory. > +# RPM_BUILD_DIR as the top build dir (usually one above BUILDDIR). > +# And RPM_PACKAGE_NAME, RPM_PACKAGE_VERSION, RPM_PACKAGE_RELEASE, > +# RPM_ARCH to create an unique (dir) name. Warn if they aren't set. > +if test -z "${RPM_BUILD_ROOT}"; then > + echo "RPM_BUILD_ROOT not set" > + exit 1; > +fi > +if test -z "${RPM_BUILD_DIR}"; then > + echo "RPM_BUILD_DIR not set" > + exit 1; > +fi > +if test -z "${RPM_PACKAGE_NAME}"; then > + echo "RPM_PACKAGE_NAME not set" > + exit 1; > +fi Three redundant trailing semicolons here. How about this version instead: for n in RPM_BUILD_ROOT RPM_BUILD_DIR RPM_PACKAGE_NAME; do if eval test -z \"\${$n-}\"; then echo >&2 "$n is not set" exit 1 fi done -- ldv