[PATCH] find-debuginfo: Check RPM environment variables are there
Dmitry V. Levin
ldv@altlinux.org
Mon Jul 26 22:32:59 GMT 2021
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
More information about the Debugedit
mailing list