functions (ValidateBuildRoot): require canonical RPM_BUILD_ROOT
Some scripts like lib.req rely on the fact that RPM_BUILD_ROOT should not end with trailing slashes or something. Other scripts like find-package explicitly assume that RPM_BUILD_ROOT can be relocated within filesystem; they use something like "real_buildroot" variables. The code gets complicated, fragile, and error-prone. Therefore, guys, hereby I FORBID non-canonical RPM_BUILD_ROOT path. Note that RPM_BUILD_ROOT actually does not have to exist. This is another problem...
This commit is contained in:
parent
17b1c6b296
commit
e0598b6fe3
@ -57,8 +57,16 @@ Debug()
|
||||
|
||||
ValidateBuildRoot()
|
||||
{
|
||||
[ -n "${RPM_BUILD_ROOT-}" ] ||
|
||||
Fatal 'RPM_BUILD_ROOT not set'
|
||||
[ -n "$(printf %s "$RPM_BUILD_ROOT" |tr -d ' /.')" ] ||
|
||||
Fatal 'invalid $RPM_BUILD_ROOT'
|
||||
Fatal "bogus RPM_BUILD_ROOT=$RPM_BUILD_ROOT"
|
||||
local real_buildroot
|
||||
# There could be simply no %install section...
|
||||
# I pretend that non-existent buildroot is just canonical enough.
|
||||
real_buildroot=$(readlink -vm -- "$RPM_BUILD_ROOT")
|
||||
[ "$RPM_BUILD_ROOT" = "$real_buildroot" ] ||
|
||||
Fatal "non-canonical RPM_BUILD_ROOT=$RPM_BUILD_ROOT real_buildroot=$real_buildroot"
|
||||
}
|
||||
|
||||
[ -z "${RPM_BUILD_ROOT-}" ] || ValidateBuildRoot
|
||||
|
Loading…
Reference in New Issue
Block a user