public inbox for debugedit@sourceware.org
 help / color / mirror / Atom feed
From: "Dmitry V. Levin" <ldv@altlinux.org>
To: debugedit@sourceware.org
Subject: Re: [PATCH] find-debuginfo: Check RPM environment variables are there
Date: Tue, 27 Jul 2021 01:32:59 +0300	[thread overview]
Message-ID: <20210726223259.GA13702@altlinux.org> (raw)
In-Reply-To: <20210726222311.16348-1-mark@klomp.org>

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 <mark@klomp.org>
> ---
>  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

  reply	other threads:[~2021-07-26 22:33 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 [this message]
2021-07-26 22:51   ` Mark Wielaard

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=20210726223259.GA13702@altlinux.org \
    --to=ldv@altlinux.org \
    --cc=debugedit@sourceware.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).