Commit 4278c753 authored by Rashad Kanavath's avatar Rashad Kanavath

PKG: fix install_rule for symlink files

parent 18d8653d
......@@ -45,25 +45,20 @@ set(QT_TRANSLATIONS_DIR "${SUPERBUILD_INSTALL_DIR}/translations")
get_filename_component(PACKAGE_OTB_SRC_DIR ${OTBPackaging_SOURCE_DIR} PATH)
set(SUPERBUILD_SOURCE_DIR "${PACKAGE_OTB_SRC_DIR}/SuperBuild")
if(OTB_WRAP_PYTHON AND NOT PYTHON_EXECUTABLE)
find_package(PythonInterp REQUIRED)
endif()
find_program(FILE_COMMAND "file")
if(WIN32)
set(ZIP_EXE_NAMES 7z 7za)
find_program(ZIP_EXECUTABLE NAMES ${ZIP_EXE_NAMES})
if(NOT ZIP_EXECUTABLE)
message(FATAL_ERROR
"Cannot find 7z executable '${ZIP_EXE_NAMES}' in your PATH")
endif()
endif()
set(LINUX FALSE)
if( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(LINUX TRUE)
endif()
if(OTB_WRAP_PYTHON AND NOT PYTHON_EXECUTABLE)
find_package(PythonInterp REQUIRED)
endif()
find_program(FILE_COMMAND NAMES "file")
find_program(READLINK NAMES "readlink")
find_program(ZIP_EXECUTABLE NAMES 7z 7za)
#install prefix is same as SUPERBUILD_INSTALL_DIR. could be changed later
set(CMAKE_INSTALL_PREFIX "${SUPERBUILD_INSTALL_DIR}")
......@@ -140,6 +135,8 @@ include(install_without_message)
include(install_rule)
include(isfile_symlink)
include(update_symlinks_script)
include(detect_using_file_command)
include(install_otbapp_wrapper_scripts)
# below functions include many install commands which are installing
# files under PKG_STAGE_DIR
......@@ -224,6 +221,7 @@ endif()
create_package()
if(BUILD_TESTING)
message("adding testing")
enable_testing()
include(testing.cmake)
endif()
......
......@@ -40,10 +40,9 @@ unset LD_LIBRARY_PATH
#RK: We cannot avoid -maxdepth 1 option in find command below because,
# there are files in $OUT_DIR/lib/gtk which we CANNOT add new rpath
BINARY_FILES=$(find $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':')
PYMODULE_FILE=$(find $OUT_DIR/lib/python -maxdepth 1)
BINARY_FILES=$(find $OUT_DIR/lib/python $OUT_DIR/lib $OUT_DIR/bin $OUT_DIR/lib/otb/applications -maxdepth 1 -type f -exec file {} \; | grep -i elf|cut -f1 -d':')
# run patchelf
for bin_file in $BINARY_FILES $PYMODULE_FILE; do
for bin_file in $BINARY_FILES; do
#echo "adding rpath to $bin_file"
if [ -f "$bin_file" ]; then
"$PATCH_ELF_EXE" "--set-rpath" "$OUT_DIR/lib" "$bin_file"
......@@ -51,10 +50,10 @@ for bin_file in $BINARY_FILES $PYMODULE_FILE; do
done
#install uninstall_otb script
echo "Installing uninstall script for OTB 'uninstall_otb.sh'"
sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/install_manifest.txt"
sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/uninstall_otb.sh"
chmod +x "$OUT_DIR/uninstall_otb.sh"
echo "Installing uninstall script for OTB 'tools/uninstall_otb.sh'"
sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/tools/install_manifest_otb.txt"
sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/tools/uninstall_otb.sh"
chmod +x "$OUT_DIR/tools/uninstall_otb.sh"
sed -i -E "s,OUT_DIR,$OUT_DIR,g" "$OUT_DIR/monteverdi.sh"
chmod +x "$OUT_DIR/monteverdi.sh"
......@@ -79,6 +78,8 @@ printf %s\\n "You can also copy above line to ~/.profile to keep changes perman
printf %s\\n "More documentation can be found in $OUT_DIR/README"
#rm -f "$OUT_DIR/make_symlinks"
rm -f "$OUT_DIR/patchelf"
rm -f "$OUT_DIR/setup_python.sh"
rm -f "$OUT_DIR/pkgsetup"
......@@ -18,8 +18,18 @@
# limitations under the License.
#
macro(check_cmake_variables)
set(required_vars)
if(OTB_WRAP_PYTHON)
set(required_vars PYTHON_EXECUTABLE)
list(APPEND required_vars PYTHON_EXECUTABLE)
endif()
if(LINUX)
list(APPEND required_vars FILE_COMMAND)
list(APPEND required_vars READLINK)
endif()
if(WIN32)
list(APPEND required_vars ZIP_EXECUTABLE)
endif()
foreach(req
${required_vars}
......@@ -35,6 +45,8 @@ macro(check_cmake_variables)
LOADER_PROGRAM
LOADER_ARGS
LOADER_REGEX
PKG_ITK_SB_VERSION
PKG_OTB_VERSION_STRING
)
if(NOT DEFINED ${req} OR "${${req}}" STREQUAL "")
message(FATAL_ERROR "you must set ${req}")
......
function(detect_using_file_command input_file result_type result_dir)
execute_process(COMMAND "${FILE_COMMAND}" "${input_file}"
RESULT_VARIABLE file_rv
OUTPUT_VARIABLE file_ov
ERROR_VARIABLE file_ev
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT file_rv STREQUAL "0")
message(FATAL_ERROR "${FILE_COMMAND} failed: ${file_rv}\n${file_ev}\n${file_ov}")
endif()
get_filename_component(input_file_NAME ${input_file} NAME)
string(REPLACE "${input_file}" " _file_full_ " file_ov "${file_ov}")
string(TOLOWER "${file_ov}" file_ov_lower)
set(detected_type)
set(detected_dir)
# below executable check works for both mac osx and linux
if("${file_ov_lower}" MATCHES "executable")
set(detected_type PROGRAMS)
set(detected_dir bin)
# detect position independent executables on Linux,
# where "file" gives "dynamically linked (uses shared libraries)"
elseif("${file_ov_lower}" MATCHES "dynamically linked.*\(uses shared libs\)")
set(detected_type FILES)
set(detected_dir lib)
# detect position independent executables on Linux,
# where "file" gives "shared object ... (uses shared libraries)"
elseif("${file_ov_lower}" MATCHES "shared object.*\(uses shared libs\)")
set(detected_type FILES)
set(detected_dir lib)
# detect shared libraries on Linux,
# where "file" gives "ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped"
elseif("${file_ov_lower}" MATCHES "elf.*shared object.*version")
set(detected_type FILES)
set(detected_dir lib)
# "file" version 5.22 does not print "(used shared libraries)"
# but uses "interpreter"
elseif("${file_ov_lower}" MATCHES "shared object.*interpreter")
set(detected_type FILES)
set(detected_dir lib)
# detect shared libraries on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 dynamically linked shared library"
elseif("${file_ov_lower}" MATCHES "mach-o.*dynamically linked shared library")
set(detected_type FILES)
set(detected_dir lib)
#below check is redundant. detect executables on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 executable"
elseif("${file_ov_lower}" MATCHES "mach-o.*executable")
set(detected_type PROGRAMS)
set(detected_dir bin)
# detect shared libraries on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 bundle"
elseif("${file_ov_lower}" MATCHES "mach-o.*bundle")
set(detected_type FILES)
set(detected_dir lib)
elseif("${file_ov_lower}" MATCHES "mach-o.*bundle")
set(detected_type FILES)
set(detected_dir lib)
elseif("${file_ov_lower}" MATCHES "symbolic link")
#this will do a symlink check again using but that's okay!
#set type to symlink we are going to resolve it anyway
set(detected_type "symlink")
set(is_this_a_symbolic_link FALSE)
set(target_file)
isfile_symlink("${input_file}" is_this_a_symbolic_link target_file)
if(is_this_a_symbolic_link)
if(target_file)
set(libdir "lib")
setif_value_in_list(is_gtk_lib "${input_file_NAME}" GTK_LIB_LIST_1)
if(is_gtk_lib)
set(libdir "lib/gtk")
endif()
file(APPEND
${CMAKE_BINARY_DIR}/make_symlinks
"ln -sf \"$OUT_DIR/${libdir}/${target_file}\" \"$OUT_DIR/${libdir}/${input_file_NAME}\" \n"
)
endif() #target_file
endif() #is_this_a_symbolic_link
else() #if("${file_ov_lower}" MATCHES ...)
#we are out of options at this point. throw error!
message(FATAL_ERROR "unknown/untracked file type found: ${input_file}")
endif() #if("${file_ov_lower}" MATCHES ...)
#message("detected_type=${detected_type}")
set(${result_type} "${detected_type}" PARENT_SCOPE)
set(${result_dir} "${detected_dir}" PARENT_SCOPE)
endfunction()
function(install_otbapp_wrapper_scripts otbapp_libfile)
########### install cli and gui script for each application ###########
set(my_script_ext "")
if(WIN32)
set(my_script_ext ".bat")
endif()
get_filename_component(otbapp_libfile_WE ${otbapp_libfile} NAME_WE)
#just remove otbapp_ first. we will add otbcli_ or otbgui_ later
set(otbapp_name)
string(REPLACE "otbapp_" "" otbapp_name ${otbapp_libfile_WE})
#now define cli_script with valid name otbcli_<APPNAME><EXT>
set(cli_script "otbcli_${otbapp_name}${my_script_ext}")
if(NOT EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/${cli_script}")
#report error!
message(FATAL_ERROR "Cannot find ${cli_script} for ${otbapp_libfile}")
endif()
#install file
install(
PROGRAMS "${SUPERBUILD_INSTALL_DIR}/bin/${cli_script}"
DESTINATION ${PKG_STAGE_DIR}/bin
)
#Do the same for otbgui script but only if HAVE_QT4 is set.
if(NOT HAVE_QT4)
return()
endif()
#now define gui_script_actual with valid name otbgui_<APPNAME><EXT>
set(gui_script "otbgui_${otbapp_name}${my_script_ext}")
if(NOT EXISTS "${SUPERBUILD_INSTALL_DIR}/bin/${gui_script}")
#report error
message(FATAL_ERROR "Cannot find ${gui_script} for ${otbapp_libfile}")
endif()
#install script file
install(
PROGRAMS "${SUPERBUILD_INSTALL_DIR}/bin/${gui_script}"
DESTINATION ${PKG_STAGE_DIR}/bin )
endfunction()
......@@ -2,179 +2,71 @@ function(install_rule src_file)
get_filename_component(src_file_EXT ${src_file} EXT)
get_filename_component(src_file_NAME ${src_file} NAME)
get_filename_component(src_file_NAME_WE ${src_file} NAME_WE)
get_filename_component(src_file_PATH ${src_file} PATH)
if(NOT FILE_COMMAND)
message(FATAL_ERROR "warning: No 'file' command, cannot continue...")
endif()
file(GLOB src_file_star "${src_file_PATH}/${src_file_NAME_WE}*")
foreach(sfile ${src_file_star})
#message( "sfile=${sfile}")
get_filename_component(sfile_NAME ${sfile} NAME)
get_filename_component(file_full "${sfile}" ABSOLUTE)
string(TOLOWER "${file_full}" file_full_lower)
string(TOLOWER "${sfile_NAME}" sfile_NAME_LOWER)
get_filename_component(sfile_ABS "${sfile}" ABSOLUTE) #file_full -> sfile_ABS
string(TOLOWER "${sfile_ABS}" sfile_ABS_LOWER) #file_full_lower -> sfile_ABS_LOWER
if ("${sfile_NAME_LOWER}" MATCHES "^(otb|mvd)([a-z]+)(headertest|testdriver)")
message( "SKIP INSTALL for ${sfile_NAME_LOWER}")
continue()
endif()
endif()
set(install_type)
set(install_dir)
if("${file_full_lower}" MATCHES "(\\.exe)$")
if("${sfile_ABS_LOWER}" MATCHES "(\\.exe)$")
set(install_type PROGRAMS)
set(install_dir bin)
elseif("${file_full_lower}" MATCHES "(\\.dll)$")
elseif("${sfile_ABS_LOWER}" MATCHES "(\\.dll)$")
set(install_type FILES)
set(install_dir bin)
elseif("${file_full_lower}" MATCHES "(\\.lib)$")
elseif("${sfile_ABS_LOWER}" MATCHES "(\\.lib)$")
set(install_type FILES)
set(install_dir lib)
elseif("${file_full_lower}" MATCHES "(\\.a)$")
elseif("${sfile_ABS_LOWER}" MATCHES "(\\.a)$")
set(install_type FILES)
set(install_dir lib)
elseif("${file_full_lower}" MATCHES "\\.lnk$")
#Assuming the file is linked to a file with same name without .lnk extension
get_filename_component(real_file "${file_full_lower}" NAME_WE)
get_filename_component(real_file_PATH "${real_file}" PATH)
get_filename_component(real_file_PATH "${real_file_PATH}" PATH)
set(install_type "symlink")
set(install_dir ${real_file_PATH})
set(linked_to_file ${real_file})
elseif("${file_full_lower}" MATCHES "\\.prl$")
elseif("${sfile_ABS_LOWER}" MATCHES "\\.lnk$")
#we don't install symlink on windows. issue a warning
message(WARNING "${sfile_ABS} is a symbolic link and this will be excluded from package")
continue()
elseif("${file_full_lower}" MATCHES "\\.la$")
elseif("${sfile_ABS_LOWER}" MATCHES "\\.prl$")
continue()
else()
execute_process(COMMAND "${FILE_COMMAND}" "${file_full}"
RESULT_VARIABLE file_rv
OUTPUT_VARIABLE file_ov
ERROR_VARIABLE file_ev
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT file_rv STREQUAL "0")
message(FATAL_ERROR "${FILE_COMMAND} failed: ${file_rv}\n${file_ev}\n${file_ov}")
endif()
string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
string(TOLOWER "${file_ov}" file_ov)
# below executable check works for both mac osx and linux
if("${file_ov}" MATCHES "executable")
set(install_type PROGRAMS)
set(install_dir bin)
# detect position independent executables on Linux,
# where "file" gives "dynamically linked (uses shared libraries)"
elseif("${file_ov}" MATCHES "dynamically linked.*\(uses shared libs\)")
set(install_type FILES)
set(install_dir lib)
# detect position independent executables on Linux,
# where "file" gives "shared object ... (uses shared libraries)"
elseif("${file_ov}" MATCHES "shared object.*\(uses shared libs\)")
set(install_type FILES)
set(install_dir lib)
# detect shared libraries on Linux,
# where "file" gives "ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped"
elseif("${file_ov}" MATCHES "elf.*shared object.*version")
set(install_type FILES)
set(install_dir lib)
# "file" version 5.22 does not print "(used shared libraries)"
# but uses "interpreter"
elseif("${file_ov}" MATCHES "shared object.*interpreter")
set(install_type FILES)
set(install_dir lib)
# detect shared libraries on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 dynamically linked shared library"
elseif("${file_ov}" MATCHES "mach-o.*dynamically linked shared library")
set(install_type FILES)
set(install_dir lib)
#below check is redundant. detect executables on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 executable"
elseif("${file_ov}" MATCHES "mach-o.*executable")
set(install_type PROGRAMS)
set(install_dir bin)
# detect shared libraries on Mac OSX
# where "file" gives "Mach-O 64-bit x86_64 bundle"
elseif("${file_ov}" MATCHES "mach-o.*bundle")
set(install_type FILES)
set(install_dir lib)
elseif("${file_ov}" MATCHES "mach-o.*bundle")
set(install_type FILES)
set(install_dir lib)
elseif("${file_ov}" MATCHES "symbolic link")
#Now find where the symlink is linked to.
#Do a regex replace
string(REGEX REPLACE "_file_full_*.*symbolic.link.to." "" target_file ${file_ov})
#older version of file command output has [`} character(remove it).
string(REPLACE "`" "" target_file ${target_file} )
#older version of file command output has {'} character(remove it).
string(REPLACE "'" "" target_file "${target_file}")
#strip final output
string(STRIP ${target_file} target_file)
setif_value_in_list(is_gtk_lib "${sfile_NAME}" GTK_LIB_LIST_1)
set(lib_dir "lib")
if(is_gtk_lib)
set(lib_dir "lib/gtk")
set(install_dir "lib/gtk")
endif()
file(APPEND
${CMAKE_BINARY_DIR}/make_symlinks
"ln -sf \"$OUT_DIR/${lib_dir}/${target_file}\" \"$OUT_DIR/${lib_dir}/${sfile_NAME}\" \n"
)
continue()
endif()
endif()
if("${sfile_NAME}" MATCHES "^otbapp_")
elseif("${sfile_ABS_LOWER}" MATCHES "\\.la$")
continue()
elseif("${sfile_NAME_LOWER}" MATCHES "^otbapp_")
set(install_dir "lib/otb/applications")
set(install_type PROGRAMS)
########### install cli and gui script for each application ###########
set(WRAPPER_SCRIPT_EXT "")
if(WIN32)
set(WRAPPER_SCRIPT_EXT ".bat")
endif()
set(${src_file_NAME_WE}_CLI "${SUPERBUILD_INSTALL_DIR}/bin/otbcli_${src_file_NAME_WE}${WRAPPER_SCRIPT_EXT}")
set(${src_file_NAME_WE}_GUI "${SUPERBUILD_INSTALL_DIR}/bin/otbgui_${src_file_NAME_WE}${WRAPPER_SCRIPT_EXT}")
string(REPLACE "otbapp_" "" ${src_file_NAME_WE}_GUI ${${src_file_NAME_WE}_GUI})
string(REPLACE "otbapp_" "" ${src_file_NAME_WE}_CLI ${${src_file_NAME_WE}_CLI})
if(NOT EXISTS "${${src_file_NAME_WE}_CLI}")
message(FATAL_ERROR "Cannot find ${${src_file_NAME_WE}_CLI} for ${src_file_NAME_WE}")
endif()
if(NOT EXISTS "${${src_file_NAME_WE}_GUI}")
message(FATAL_ERROR "Cannot find ${${src_file_NAME_WE}_GUI} for ${src_file_NAME_WE}")
endif()
install(PROGRAMS
${${src_file_NAME_WE}_CLI}
${${src_file_NAME_WE}_GUI}
DESTINATION
${PKG_STAGE_DIR}/bin )
endif()
if(install_type AND install_dir)
install(${install_type} "${sfile}"
DESTINATION
"${PKG_STAGE_DIR}/${install_dir}"
)
install_otbapp_wrapper_scripts(${sfile_NAME})
else()
message(FATAL_ERROR "sfile=${sfile} || file_ov=${file_ov}")
endif()
if(UNIX)
#the last else() loop where we run a 'file' command to find file type and directory
set(install_type)
set(install_dir)
#message("sfile_ABS=${sfile_ABS}")
detect_using_file_command(${sfile_ABS} install_type install_dir)
endif(UNIX)
endif()
endforeach()
if(NOT install_type OR NOT install_type)
message(FATAL_ERROR "install_type OR install_dir is empty\ninstall_type=${install_dir}\ninstall_dir=${install_dir}")
return()
endif()
if ( NOT install_type STREQUAL "symlink")
install(${install_type} "${sfile}"
DESTINATION
"${PKG_STAGE_DIR}/${install_dir}"
)
endif()
endforeach()
endfunction()
......@@ -10,14 +10,16 @@ function(isfile_symlink file result_var1 result_var2)
get_filename_component(file_full "${file}" ABSOLUTE)
string(TOLOWER "${file_full}" file_full_lower)
# If file name ends in .exe on Windows, *assume* executable:
# If file name ends in .lnk on Windows,
# *assume* symlink a.k.a shortcut.
#
if(WIN32 AND NOT UNIX)
if("${file_full_lower}" MATCHES "\\.lnk$")
set(${result_var1} 1 PARENT_SCOPE)
#Assuming the file is linked to a file with same name without .lnk extension
get_filename_component(name_we_lnk "${file_full_lower}" NAME_WE)
set(${result_var2} "${name_we_lnk}" PARENT_SCOPE)
#Assuming the file is linked to a file
#with same name without .lnk extension
get_filename_component(file_full_name_we "${file_full}" NAME_WE)
set(${result_var2} "${file_full_name_we}" PARENT_SCOPE)
return()
endif()
......@@ -27,7 +29,8 @@ function(isfile_symlink file result_var1 result_var2)
#
endif()
#if we are not on a unix or unix-like platform, then we don't have any business here
#if we are not on a unix or unix-like platform,
#then we don't have any business after this line.
if(NOT UNIX)
return()
endif()
......@@ -38,49 +41,65 @@ function(isfile_symlink file result_var1 result_var2)
# If the file command's output contains "executable" and does *not* contain
# "text" then it is likely an executable suitable for prerequisite analysis
# via the get_prerequisites macro.
#
if(NOT FILE_COMMAND)
message(FATAL_ERROR "warning: No 'file' command, cannot continue...")
endif()
execute_process(COMMAND "${FILE_COMMAND}" "${file_full}"
RESULT_VARIABLE file_rv
OUTPUT_VARIABLE file_ov
ERROR_VARIABLE file_ev
execute_process(COMMAND "${READLINK}" "${file_full}"
RESULT_VARIABLE readlink_rv
OUTPUT_VARIABLE readlink_ov
ERROR_VARIABLE readlink_ev
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT file_rv STREQUAL "0")
message(FATAL_ERROR "${FILE_COMMAND} failed: ${file_rv}\n${file_ev}")
if(PKG_DEBUG)
message("${READLINK} on '${file_full} has output: '${readlink_ov}'\nreadlink_ev=${readlink_ev}")
endif()
if(readlink_rv STREQUAL "1")
set(${result_var1} 0 PARENT_SCOPE)
set(${result_var2} "" PARENT_SCOPE)
return()
endif()
# Replace the name of the file in the output with a placeholder token
# (the string " _file_full_ ") so that just in case the path name of
# the file contains the word "text" or "executable" we are not fooled
# into thinking "the wrong thing" because the file name matches the
# other 'file' command output we are looking for...
#
string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
string(TOLOWER "${file_ov}" file_ov_lower)
#got a symlink!. set result_var1 to TRUE
set(${result_var1} 1 PARENT_SCOPE)
# message(FATAL_ERROR "file_ov='${file_ov}'")
if("${file_ov_lower}" MATCHES "symbolic link")
set(${result_var1} 1 PARENT_SCOPE)
#Now find where the symlink is linked to.
#Do a regex replace
string(REGEX REPLACE "_file_full_*.*symbolic.link.to." "" symlinked_to ${file_ov})
#Now get the resolved link to result_var2
set(symlinked_to)
string(STRIP ${readlink_ov} symlinked_to)
set(${result_var2} "${symlinked_to}" PARENT_SCOPE)
#older version of file command output has [`} character(remove it).
string(REPLACE "`" "" symlinked_to ${symlinked_to} )
return()
#older version of file command output has {'} character(remove it).
string(REPLACE "'" "" symlinked_to "${symlinked_to}")
# message(FATAL_ERROR "xx${READLINK} failed on '${file_full}' \nExit status: '${readlink_rv}' \nOutput: '${readlink_ov}' \nError status: '${readlink_ev}'")
#strip final output
string(STRIP ${symlinked_to} symlinked_to)
set(${result_var2} "${symlinked_to}" PARENT_SCOPE)
#message(FATAL_ERROR "${file_full} is symlinked_to ${symlinked_to}")
return()
endif()
# # Replace the name of the file in the output with a placeholder token
# # (the string " _file_full_ ") so that just in case the path name of
# # the file contains the word "text" or "executable" we are not fooled
# # into thinking "the wrong thing" because the file name matches the
# # other 'file' command output we are looking for...
# #
# string(REPLACE "${file_full}" " _file_full_ " file_ov "${file_ov}")
# string(TOLOWER "${file_ov}" file_ov_lower)
# # message(FATAL_ERROR "file_ov='${file_ov}'")
# if("${file_ov_lower}" MATCHES "symbolic link")
# set(${result_var1} 1 PARENT_SCOPE)
# #Now find where the symlink is linked to.
# #Do a regex replace
# string(REGEX REPLACE "_file_full_*.*symbolic.link.to." "" symlinked_to ${file_ov})
# #older version of file command output has [`} character(remove it).
# string(REPLACE "`" "" symlinked_to ${symlinked_to} )
# #older version of file command output has {'} character(remove it).
# string(REPLACE "'" "" symlinked_to "${symlinked_to}")
# #strip final output
# string(STRIP ${symlinked_to} symlinked_to)
# set(${result_var2} "${symlinked_to}" PARENT_SCOPE)
# #message(FATAL_ERROR "${file_full} is symlinked_to ${symlinked_to}")
# return()
# endif()
endfunction()
......@@ -98,7 +98,7 @@ function(process_file_recurse input_file)
search_library(${item} PKG_SEARCHDIRS item_full_path)
set(is_a_symlink FALSE)
set(item_target_file)
isfile_symlink("${item_full_path}" is_a_symlink item_target_file)
isfile_symlink("${item_full_path}" is_a_symlink item_target_file)
if(is_a_symlink)
set(${item}_RESOLVED TRUE CACHE INTERNAL "")
set(item ${item_target_file})
......
......@@ -3,7 +3,7 @@
# [WORKING_DIRECTORY <dir>])
set(testing_dir ${CMAKE_BINARY_DIR}/tests)
execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${testing_dir})
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${testing_dir})
set(pkg_extracted_dir "${testing_dir}/${PKG_STAGE_DIR}")
if(WIN32)
......@@ -16,13 +16,15 @@ else()
set(my_ext ".sh")
endif()
add_test(Tu_install_package
add_test(
NAME Tu_install_package
COMMAND ${extract_cmd}
${extract_opts}
WORKING_DIRECTORY ${testing_dir}
)
add_test(Tu_selftester
add_test(
NAME Tu_selftester
COMMAND ${pkg_extracted_dir}/tools/selftester${my_ext}
WORKING_DIRECTORY ${pkg_extracted_dir}
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment