From: Mark Wielaard <mark@klomp.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: debugedit@sourceware.org
Subject: Re: [PATCH] find-debuginfo: Check RPM environment variables are there
Date: Tue, 27 Jul 2021 00:51:43 +0200 [thread overview]
Message-ID: <YP88f+yGbGa0fjUF@wildebeest.org> (raw)
In-Reply-To: <20210726223259.GA13702@altlinux.org>
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
prev parent reply other threads:[~2021-07-26 22:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-26 22:23 Mark Wielaard
2021-07-26 22:32 ` Dmitry V. Levin
2021-07-26 22:51 ` Mark Wielaard [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YP88f+yGbGa0fjUF@wildebeest.org \
--to=mark@klomp.org \
--cc=debugedit@sourceware.org \
--cc=ldv@altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).