The find-debuginfo.sh scripts only works correctly when the following (rpm) environment variables are set: RPM_BUILD_ROOT RPM_PACKAGE_NAME RPM_PACKAGE_VERSION RPM_PACKAGE_RELEASE RPM_ARCH We must find a better way to provide this information to the find-debuginfo.sh scripts that isn't dependent on rpm setting these before calling find-debuginfo.sh so that it can be used with other packaging tools.
I'd collapse that into two arguments, one for taking the buildroot equivalent and another for the package nevra (or similar). Rpm needs slight modifications anyhow due to the split, we can just as easily add these to the calling macro.