[tensorflow-common] check for invalid username (#18111)

* Revert "incorporate changes from microsoft:master"

* Revert "Revert "incorporate changes from microsoft:master""

* added check for spaces in username (unsupported by bazel)

* apply a work-around with custom build root instead of terminating build when username contains spaces

* x-add-version

* Add check for spaces in vcpkg path.
Keep non-Windows build output in vcpkg subfolders because it easily sums up to 100GB. So users have only one place to cleanup.

* vcpkg x-add-version

* fix typo

* re-run x-add-version

Co-authored-by: jgehw <Joachim_Gehweiler@McAfee.com>
This commit is contained in:
Joachim Gehweiler 2021-06-01 20:49:53 +02:00 committed by GitHub
parent 482149c68b
commit 56ca13c972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 9 deletions

View File

@ -18,7 +18,17 @@ vcpkg_find_acquire_program(GIT)
get_filename_component(GIT_DIR "${GIT}" DIRECTORY)
vcpkg_add_to_path(PREPEND ${GIT_DIR})
string(FIND "${CURRENT_BUILDTREES_DIR}" " " POS)
if(NOT POS EQUAL -1)
message(FATAL_ERROR "Your vcpkg path contains spaces. This is not supported by the bazel build tool. Aborting.")
endif()
if(CMAKE_HOST_WIN32)
string(FIND "$ENV{USERNAME}" " " POS)
if(NOT POS EQUAL -1)
message(WARNING "Your Windows username '$ENV{USERNAME}' contains spaces. Applying work-around to bazel. Be warned of possible further issues.")
endif()
vcpkg_acquire_msys(MSYS_ROOT PACKAGES bash unzip patch diffutils libintl gzip coreutils mingw-w64-x86_64-python-numpy)
vcpkg_add_to_path(${MSYS_ROOT}/usr/bin)
vcpkg_add_to_path(${MSYS_ROOT}/mingw64/bin)
@ -44,9 +54,6 @@ set(ENV{PYTHON_LIB_PATH} "${PYTHON_LIB_PATH}")
# check if numpy can be loaded
vcpkg_execute_required_process(COMMAND ${PYTHON3} -c "import numpy" WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR} LOGNAME prerequesits-numpy-${TARGET_TRIPLET})
# tensorflow has long file names, which will not work on windows
set(ENV{TEST_TMPDIR} "${CURRENT_BUILDTREES_DIR}/.bzl")
set(ENV{USE_DEFAULT_PYTHON_LIB_PATH} 1)
set(ENV{TF_NEED_KAFKA} 0)
set(ENV{TF_NEED_OPENCL_SYCL} 0)
@ -219,14 +226,15 @@ foreach(BUILD_TYPE dbg rel)
list(JOIN COPTS " " COPTS)
list(JOIN CXXOPTS " " CXXOPTS)
list(JOIN LINKOPTS " " LINKOPTS)
# use --output_user_root to work-around too-long-path-names issue and username-with-spaces issue
vcpkg_execute_build_process(
COMMAND ${BASH} --noprofile --norc -c "'${BAZEL}' build --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
COMMAND ${BASH} --noprofile --norc -c "'${BAZEL}' --output_user_root='${CURRENT_BUILDTREES_DIR}/.bzl' build --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
else()
vcpkg_execute_build_process(
COMMAND ${BAZEL} build --verbose_failures ${BUILD_OPTS} --python_path=${PYTHON3} ${COPTS} ${CXXOPTS} ${LINKOPTS} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
COMMAND ${BAZEL} --output_user_root=${CURRENT_BUILDTREES_DIR}/.bzl build --verbose_failures ${BUILD_OPTS} --python_path=${PYTHON3} ${COPTS} ${CXXOPTS} ${LINKOPTS} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
@ -243,14 +251,15 @@ foreach(BUILD_TYPE dbg rel)
list(JOIN COPTS " " COPTS)
list(JOIN CXXOPTS " " CXXOPTS)
list(JOIN LINKOPTS " " LINKOPTS)
# use --output_user_root to work-around too-long-path-names issue and username-with-spaces issue
vcpkg_execute_build_process(
COMMAND ${BASH} --noprofile --norc -c "${BAZEL} build -s --verbose_failures ${BUILD_OPTS} --features=fully_static_link ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
COMMAND ${BASH} --noprofile --norc -c "${BAZEL} --output_user_root='${CURRENT_BUILDTREES_DIR}/.bzl' build -s --verbose_failures ${BUILD_OPTS} --features=fully_static_link ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path='${PYTHON3}' --define=no_tensorflow_py_deps=true ///tensorflow:${BAZEL_LIB_NAME} ///tensorflow:install_headers"
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)
else()
vcpkg_execute_build_process(
COMMAND ${BAZEL} build -s --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path=${PYTHON3} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
COMMAND ${BAZEL} --output_user_root=${CURRENT_BUILDTREES_DIR}/.bzl build -s --verbose_failures ${BUILD_OPTS} ${COPTS} ${CXXOPTS} ${LINKOPTS} --python_path=${PYTHON3} --define=no_tensorflow_py_deps=true //tensorflow:${BAZEL_LIB_NAME} //tensorflow:install_headers
WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-${BUILD_TYPE}
LOGNAME build-${TARGET_TRIPLET}-${BUILD_TYPE}
)

View File

@ -1,7 +1,7 @@
{
"name": "tensorflow-common",
"version-semver": "2.4.1",
"port-version": 1,
"port-version": 2,
"description": "This meta package holds common files for the C [tensorflow] and the C++ [tensorflow-cc] API version of TensorFlow but is not installable on its own.",
"homepage": "https://github.com/tensorflow/tensorflow"
}

View File

@ -6082,7 +6082,7 @@
},
"tensorflow-common": {
"baseline": "2.4.1",
"port-version": 1
"port-version": 2
},
"tensorpipe": {
"baseline": "2021-04-26",

View File

@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "84ba326c66ab77faaf3e59d8eb3f04ffa155a4bb",
"version-semver": "2.4.1",
"port-version": 2
},
{
"git-tree": "c2a11af14488e643cf0a07f676d08319a0f70f08",
"version-semver": "2.4.1",