From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 39071383D827 for ; Mon, 26 Jul 2021 22:51:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39071383D827 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from reform (deer0x10.wildebeest.org [172.31.17.146]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 11DC7300047B; Tue, 27 Jul 2021 00:51:44 +0200 (CEST) Received: by reform (Postfix, from userid 1000) id D18B62E8071A; Tue, 27 Jul 2021 00:51:43 +0200 (CEST) Date: Tue, 27 Jul 2021 00:51:43 +0200 From: Mark Wielaard To: "Dmitry V. Levin" Cc: debugedit@sourceware.org Subject: Re: [PATCH] find-debuginfo: Check RPM environment variables are there Message-ID: References: <20210726222311.16348-1-mark@klomp.org> <20210726223259.GA13702@altlinux.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210726223259.GA13702@altlinux.org> X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no 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:51:50 -0000 Hi Dmitry, On Tue, Jul 27, 2021 at 01:32:59AM +0300, Dmitry V. Levin wrote: > > +# 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 Much nicer. I added that. And moved the check after the option handling. As the buildbot pointed out, this broke --help and --version. Oops. Double checked the new version still works as a drop-n replacement for rpm script. Thanks, Mark