[PATCH] find-debuginfo: Check RPM environment variables are there
Mark Wielaard
mark@klomp.org
Mon Jul 26 22:51:43 GMT 2021
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
More information about the Debugedit
mailing list