Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
otb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sébastien Peillet
otb
Commits
d38619e8
Commit
d38619e8
authored
8 years ago
by
Rashad Kanavath
Browse files
Options
Downloads
Patches
Plain Diff
PKG: unix file command have different output
parent
107dc86b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
SuperBuild/Packaging/PackageHelper.cmake
+17
-9
17 additions, 9 deletions
SuperBuild/Packaging/PackageHelper.cmake
SuperBuild/Packaging/PackageMacros.cmake
+45
-47
45 additions, 47 deletions
SuperBuild/Packaging/PackageMacros.cmake
with
62 additions
and
56 deletions
SuperBuild/Packaging/PackageHelper.cmake
+
17
−
9
View file @
d38619e8
...
...
@@ -18,6 +18,9 @@ macro(macro_super_package)
message
(
FATAL_ERROR
"PATCHELF_PROGRAM not set"
)
endif
()
#setting this variable. prints a lot of debug information
#set( PKG_OTB_DEBUG 1)
set
(
loader_program_PATHS
)
set
(
eol_char
"E"
)
if
(
MSVC
)
...
...
@@ -312,13 +315,11 @@ function(func_prepare_package)
endif
()
unset
(
${
var_to_unset
}
CACHE
)
endforeach
()
foreach
(
infile
${
PKG_PEFILES
}
)
get_filename_component
(
bn
${
infile
}
NAME
)
func_process_deps
(
${
bn
}
)
endforeach
()
endfunction
()
#func_prepare_package
...
...
@@ -327,9 +328,9 @@ function(func_process_deps input_file)
if
(
NOT input_file_full_path
)
message
(
FATAL_ERROR
"
${
input_file
}
not found. searched in
${
PKG_SEARCHDIRS
}
"
)
endif
()
message
(
"Processing
${
input_file_full_path
}
"
)
set
(
is_executable FALSE
)
is_file_executable2
(
"
${
input_file_full_path
}
"
is_executable
)
if
(
NOT is_executable
)
...
...
@@ -428,21 +429,28 @@ function(func_process_deps input_file)
list
(
APPEND raw_items
${
raw_item
}
)
endforeach
()
if
(
PKG_OTB_DEBUG
)
message
(
FATAL_ERROR
"raw_items=
${
raw_items
}
"
)
string
(
REPLACE
";"
"
\n
"
raw_items_pretty_print
"
${
raw_items
}
"
)
message
(
FATAL_ERROR
"raw_items=
${
raw_items_pretty_print
}
"
)
endif
(
PKG_OTB_DEBUG
)
if
(
raw_items
)
list
(
REVERSE raw_items
)
foreach
(
item
${
raw_items
}
)
search_library
(
${
item
}
PKG_SEARCHDIRS item_full_path
)
set
(
is_a_symlink FALSE
)
set
(
item_target_file
)
if
(
PKG_OTB_DEBUG
)
message
(
"item0=
${
item_full_path
}
"
)
endif
()
func_is_file_a_symbolic_link
(
"
${
item_full_path
}
"
is_a_symlink item_target_file
)
if
(
is_a_symlink
)
set
(
${
item
}
_RESOLVED TRUE CACHE INTERNAL
""
)
set
(
item
${
item_target_file
}
)
set
(
item
${
item_target_file
}
)
endif
()
if
(
PKG_OTB_DEBUG
)
message
(
"running func_process_deps on '
${
item
}
'"
)
endif
()
func_process_deps
(
${
item
}
)
endforeach
()
...
...
This diff is collapsed.
Click to expand it.
SuperBuild/Packaging/PackageMacros.cmake
+
45
−
47
View file @
d38619e8
...
...
@@ -283,6 +283,11 @@ function(func_is_file_a_symbolic_link 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
(
NOT UNIX
)
return
()
endif
()
# Use the information returned from the Unix shell command "file" to
# determine if ${file_full} should be considered an executable file...
#
...
...
@@ -290,59 +295,52 @@ function(func_is_file_a_symbolic_link file result_var1 result_var2)
# "text" then it is likely an executable suitable for prerequisite analysis
# via the get_prerequisites macro.
#
if
(
UNIX
)
if
(
NOT file_cmd
)
find_program
(
file_cmd
"file"
)
mark_as_advanced
(
file_cmd
)
if
(
NOT file_cmd
)
find_program
(
file_cmd
"file"
)
mark_as_advanced
(
file_cmd
)
endif
()
if
(
file_cmd
)
execute_process
(
COMMAND
"
${
file_cmd
}
"
"
${
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_cmd
}
failed:
${
file_rv
}
\n
${
file_ev
}
"
)
endif
()
if
(
file_cmd
)
execute_process
(
COMMAND
"
${
file_cmd
}
"
"
${
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_cmd
}
failed:
${
file_rv
}
\n
${
file_ev
}
"
)
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
)
# 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
if
(
UNIX
)
if
(
APPLE
)
string
(
REGEX REPLACE
"_file_full_*.*symbolic.link.to."
""
symlinked_to
${
file_ov
}
)
else
(
APPLE
)
string
(
REGEX REPLACE
"_file_full_*.*symbolic.link.to.."
""
symlinked_to
${
file_ov
}
)
endif
(
APPLE
)
endif
(
UNIX
)
#Take out last character which is a single quote
string
(
REPLACE
"'"
""
symlinked_to
"
${
symlinked_to
}
"
)
#strip for our own sanity
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
()
#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
}
)
#Take out last character which is a single quote
string
(
REPLACE
"'"
""
symlinked_to
"
${
symlinked_to
}
"
)
else
()
message
(
STATUS
"warning: No 'file' command, skipping execute_process..."
)
#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
()
else
()
message
(
STATUS
"warning: No 'file' command, skipping execute_process..."
)
endif
()
endfunction
()
macro
(
setif_value_in_list matched value list
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment