Sanitize awk and find-debuginfo paths in macros
Commit adad2be2e4
moved the detection of
awk outside of makemacros() so that we could require it at build time,
but that isn't ideal. These are two separate use cases, really, they
just happen to involve awk in both cases.
In the first case (build time), keep using find_program(REQUIRED) as
normal, however for makemacros(), revert back to the custom findutil()
function.
The find-debuginfo script is the same story so fix that too while at it.
In practice, it's not likely for there to be multiple implementations of
this script installed on the build system for this to matter, so this
change is mostly just for the sake of consistency.
Also add a short description of findutil() to make its purpose a bit
clearer to the casual onlooker.
Fixes: #2926
This commit is contained in:
parent
4cb7aaa6da
commit
78fd1fc05f
|
@ -64,6 +64,9 @@ include(CheckSymbolExists)
|
||||||
add_compile_definitions(_GNU_SOURCE)
|
add_compile_definitions(_GNU_SOURCE)
|
||||||
add_definitions(-D_FILE_OFFSET_BITS=64)
|
add_definitions(-D_FILE_OFFSET_BITS=64)
|
||||||
|
|
||||||
|
# Find a (system) utility in canonical FHS paths, excluding $PATH. Useful for
|
||||||
|
# when the path is to be used at RPM runtime, such as in the macro files. The
|
||||||
|
# MYPATH environment variable can be used to augment these paths.
|
||||||
function(findutil UTIL TRY)
|
function(findutil UTIL TRY)
|
||||||
list(GET TRY 0 util)
|
list(GET TRY 0 util)
|
||||||
find_program(${UTIL}
|
find_program(${UTIL}
|
||||||
|
@ -140,6 +143,8 @@ function(makemacros)
|
||||||
findutil(__OBJDUMP objdump)
|
findutil(__OBJDUMP objdump)
|
||||||
findutil(__STRIP strip)
|
findutil(__STRIP strip)
|
||||||
findutil(__SYSTEMD_SYSUSERS systemd-sysusers)
|
findutil(__SYSTEMD_SYSUSERS systemd-sysusers)
|
||||||
|
findutil(__FIND_DEBUGINFO find-debuginfo)
|
||||||
|
findutil(__AWK awk)
|
||||||
findutil(__AR ar)
|
findutil(__AR ar)
|
||||||
findutil(__AS as)
|
findutil(__AS as)
|
||||||
findutil(__CPP cpp)
|
findutil(__CPP cpp)
|
||||||
|
@ -301,11 +306,11 @@ if (WITH_IMAEVM)
|
||||||
target_include_directories(IMA::IMA INTERFACE "${IMA_INCLUDE_DIR}")
|
target_include_directories(IMA::IMA INTERFACE "${IMA_INCLUDE_DIR}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
find_program(__AWK awk REQUIRED)
|
find_program(AWK awk REQUIRED)
|
||||||
mark_as_advanced(__AWK)
|
mark_as_advanced(AWK)
|
||||||
|
|
||||||
find_program(__FIND_DEBUGINFO find-debuginfo)
|
find_program(FIND_DEBUGINFO find-debuginfo)
|
||||||
mark_as_advanced(__FIND_DEBUGINFO)
|
mark_as_advanced(FIND_DEBUGINFO)
|
||||||
|
|
||||||
function(chkdef func req)
|
function(chkdef func req)
|
||||||
string(TOUPPER ${func} FUNC)
|
string(TOUPPER ${func} FUNC)
|
||||||
|
@ -343,7 +348,7 @@ foreach(f ${OPTINCS})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
function(id0name var file)
|
function(id0name var file)
|
||||||
execute_process(COMMAND ${__AWK} -F: "$3==0 {print $1;exit}" ${file}
|
execute_process(COMMAND ${AWK} -F: "$3==0 {print $1;exit}" ${file}
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||||
OUTPUT_VARIABLE name)
|
OUTPUT_VARIABLE name)
|
||||||
if ("${name}" STREQUAL "")
|
if ("${name}" STREQUAL "")
|
||||||
|
|
|
@ -70,7 +70,7 @@ if(WITH_CAP)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_custom_command(OUTPUT tagtbl.C
|
add_custom_command(OUTPUT tagtbl.C
|
||||||
COMMAND AWK=${__AWK} ${CMAKE_CURRENT_SOURCE_DIR}/gentagtbl.sh ${CMAKE_SOURCE_DIR}/include/rpm/rpmtag.h > tagtbl.C
|
COMMAND AWK=${AWK} ${CMAKE_CURRENT_SOURCE_DIR}/gentagtbl.sh ${CMAKE_SOURCE_DIR}/include/rpm/rpmtag.h > tagtbl.C
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/include/rpm/rpmtag.h gentagtbl.sh
|
DEPENDS ${CMAKE_SOURCE_DIR}/include/rpm/rpmtag.h gentagtbl.sh
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ export TZ
|
||||||
unset SOURCE_DATE_EPOCH
|
unset SOURCE_DATE_EPOCH
|
||||||
|
|
||||||
RPM_XFAIL=${RPM_XFAIL-1}
|
RPM_XFAIL=${RPM_XFAIL-1}
|
||||||
if test -x "@__FIND_DEBUGINFO@"; then
|
if test -x "@FIND_DEBUGINFO@"; then
|
||||||
DEBUGINFO_DISABLED=false;
|
DEBUGINFO_DISABLED=false;
|
||||||
else
|
else
|
||||||
DEBUGINFO_DISABLED=true;
|
DEBUGINFO_DISABLED=true;
|
||||||
|
|
Loading…
Reference in New Issue