mirror of
https://github.com/UltraCoderRU/libwebrtc.git
synced 2026-01-28 03:15:11 +00:00
Replace all execute_process calls with libwebrtc_execute
This commit is contained in:
parent
64690d1a30
commit
c21220c58c
2 changed files with 54 additions and 56 deletions
|
|
@ -9,69 +9,66 @@ if (WEBRTC_REVISION)
|
|||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci ${WEBRTC_REVISION}
|
||||
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-commit-date
|
||||
STAMPFILE webrtc-revision-commit-date
|
||||
STATUS "Retrieving date for commit ${WEBRTC_REVISION}"
|
||||
ERROR "Unable to find webrtc commit date at ${WEBRTC_REVISION}"
|
||||
)
|
||||
elseif (WEBRTC_BRANCH_HEAD)
|
||||
message(STATUS "Retrieving branch-heads refspecs")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} config remote.origin.fetch +refs/branch-heads/*:refs/remotes/branch-heads/* ^\\+refs/branch-heads/\\*:.*$
|
||||
OUTPUT_VARIABLE _WEBRTC_CONFIG_FETCH
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE _ADD_REMOTE_RESULT)
|
||||
STAMPFILE webrtc-config-fetch
|
||||
STATUS "Setting up branch-heads refspecs"
|
||||
ERROR "Unable to add branch-heads refspec to the git config"
|
||||
)
|
||||
|
||||
if (NOT _ADD_REMOTE_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- Unable to add branch-heads refspec")
|
||||
endif (NOT _ADD_REMOTE_RESULT EQUAL 0)
|
||||
|
||||
message(STATUS "Fetching ${WEBRTC_BRANCH_HEAD}")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} fetch origin ${WEBRTC_BRANCH_HEAD}
|
||||
OUTPUT_VARIABLE _WEBRTC_FETCH
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE _WEBRTC_FETCH_RESULT)
|
||||
STAMPFILE webrtc-fetch-branch-heads
|
||||
STATUS "Fetching ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to fetch ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
|
||||
if (NOT _WEBRTC_FETCH_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- Unable to fetch ${WEBRTC_BRANCH_HEAD}")
|
||||
endif (NOT _WEBRTC_FETCH_RESULT EQUAL 0)
|
||||
|
||||
message(STATUS "Checking out ${WEBRTC_BRANCH_HEAD}")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout FETCH_HEAD
|
||||
OUTPUT_VARIABLE _WEBRTC_CHECKOUT
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
RESULT_VARIABLE _WEBRTC_CHECKOUT_RESULT)
|
||||
STAMPFILE webrtc-checkout-branch-head
|
||||
STATUS "Checking out ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to checkout ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
|
||||
if (NOT _WEBRTC_CHECKOUT_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- Unable to checkout ${WEBRTC_BRANCH_HEAD}")
|
||||
endif (NOT _WEBRTC_CHECKOUT_RESULT EQUAL 0)
|
||||
|
||||
message(STATUS "Retrieving date for commit ${WEBRTC_BRANCH_HEAD}")
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} log -1 --format=%ci
|
||||
OUTPUT_VARIABLE _WEBRTC_COMMIT_DATE
|
||||
RESULT_VARIABLE _WEBRTC_COMMIT_DATE_RESULT)
|
||||
|
||||
if (NOT _WEBRTC_COMMIT_DATE_RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- Unable to retrieve the commit date")
|
||||
endif (NOT _WEBRTC_COMMIT_DATE_RESULT EQUAL 0)
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
STAMPFILE webrtc-branch-head-commit-date
|
||||
STATUS "Retrieving date for commit ${WEBRTC_BRANCH_HEAD}"
|
||||
ERROR "Unable to retrieve the commit date for ${WEBRTC_BRANCH_HEAD}"
|
||||
)
|
||||
else (WEBRTC_REVISION)
|
||||
message(FATAL_ERROR "-- Both WEBRTC_REVISION and WEBRTC_BRANCH_HEAD variables are undefined")
|
||||
endif (WEBRTC_REVISION)
|
||||
|
||||
string(STRIP ${_WEBRTC_COMMIT_DATE} _WEBRTC_COMMIT_DATE)
|
||||
message(STATUS "Retrieving depot_tools commit before ${_WEBRTC_COMMIT_DATE}")
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} rev-list -n 1 --before=\"${_WEBRTC_COMMIT_DATE}\" master
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} rev-list -n 1 --before=\"${_WEBRTC_COMMIT_DATE}\" master
|
||||
OUTPUT_VARIABLE _DEPOT_TOOLS_COMMIT
|
||||
WORKING_DIRECTORY ${DEPOT_TOOLS_PATH}
|
||||
OUTPUT_VARIABLE _DEPOT_TOOLS_COMMIT)
|
||||
|
||||
if (NOT _DEPOT_TOOLS_COMMIT)
|
||||
message(FATAL_ERROR "-- Unable to find depot_tools commit before ${_WEBRTC_COMMIT_DATE}")
|
||||
endif (NOT _DEPOT_TOOLS_COMMIT)
|
||||
STAMPFILE webrtc-depot-tools-date
|
||||
STATUS "Retrieving depot_tools commit before ${_WEBRTC_COMMIT_DATE}"
|
||||
ERROR "Unable to find depot_tools commit before ${_WEBRTC_COMMIT_DATE}"
|
||||
)
|
||||
|
||||
string(STRIP ${_DEPOT_TOOLS_COMMIT} _DEPOT_TOOLS_COMMIT)
|
||||
message(STATUS "Checking out depot_tools to commit ${_DEPOT_TOOLS_COMMIT}")
|
||||
|
||||
execute_process(COMMAND ${GIT_EXECUTABLE} checkout ${_DEPOT_TOOLS_COMMIT}
|
||||
libwebrtc_execute(
|
||||
COMMAND ${GIT_EXECUTABLE} checkout ${_DEPOT_TOOLS_COMMIT}
|
||||
OUTPUT_VARIABLE _DEPOT_TOOLS_CHECKED_OUT
|
||||
WORKING_DIRECTORY ${DEPOT_TOOLS_PATH}
|
||||
RESULT_VARIABLE _DEPOT_TOOLS_CHECKED_OUT)
|
||||
|
||||
if (NOT _DEPOT_TOOLS_CHECKED_OUT EQUAL 0)
|
||||
message(FATAL_ERROR "-- Unable to checkout depot_tools to commit ${_DEPOT_TOOLS_COMMIT}")
|
||||
endif (NOT _DEPOT_TOOLS_CHECKED_OUT EQUAL 0)
|
||||
STAMPFILE webrtc-depot-tools-checkout
|
||||
STATUS "Checking out depot_tools to commit ${_DEPOT_TOOLS_COMMIT}"
|
||||
ERROR "Unable to checkout depot_tools to commit ${_DEPOT_TOOLS_COMMIT}"
|
||||
)
|
||||
|
|
|
|||
|
|
@ -35,15 +35,16 @@ function (libwebrtc_execute)
|
|||
|
||||
execute_process(COMMAND ${COMMAND_COMMAND}
|
||||
WORKING_DIRECTORY ${COMMAND_WORKING_DIRECTORY}
|
||||
OUTPUT_VARIABLE _OUTPUT)
|
||||
OUTPUT_VARIABLE _OUTPUT
|
||||
RESULT_VARIABLE _RESULT)
|
||||
|
||||
if (NOT _OUTPUT)
|
||||
if (NOT _RESULT EQUAL 0)
|
||||
message(FATAL_ERROR "-- " ${COMMAND_ERROR})
|
||||
endif (NOT _OUTPUT)
|
||||
endif (NOT _RESULT EQUAL 0)
|
||||
|
||||
if (COMMAND_STAMPFILE)
|
||||
file(WRITE ${STAMP_FILE} ${_OUTPUT})
|
||||
endif (COMMAND_STAMP_FILE)
|
||||
endif (COMMAND_STAMPFILE)
|
||||
|
||||
if (COMMAND_OUTPUT_VARIABLE)
|
||||
set(${COMMAND_OUTPUT_VARIABLE} ${_OUTPUT} PARENT_SCOPE)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue