From 56ca13c9722e3fd418a9b8f96300c0c2a9e678dd Mon Sep 17 00:00:00 2001 From: Joachim Gehweiler <44170764+jgehw@users.noreply.github.com> Date: Tue, 1 Jun 2021 20:49:53 +0200 Subject: [PATCH] [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 --- .../tensorflow-common/tensorflow-common.cmake | 23 +++++++++++++------ ports/tensorflow-common/vcpkg.json | 2 +- versions/baseline.json | 2 +- versions/t-/tensorflow-common.json | 5 ++++ 4 files changed, 23 insertions(+), 9 deletions(-) diff --git a/ports/tensorflow-common/tensorflow-common.cmake b/ports/tensorflow-common/tensorflow-common.cmake index 4746fcda4f9..90cba9197e0 100644 --- a/ports/tensorflow-common/tensorflow-common.cmake +++ b/ports/tensorflow-common/tensorflow-common.cmake @@ -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} ) diff --git a/ports/tensorflow-common/vcpkg.json b/ports/tensorflow-common/vcpkg.json index 447d665b583..35d2fdb2675 100644 --- a/ports/tensorflow-common/vcpkg.json +++ b/ports/tensorflow-common/vcpkg.json @@ -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" } diff --git a/versions/baseline.json b/versions/baseline.json index 0611e4e8da9..841a0fa5f32 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -6082,7 +6082,7 @@ }, "tensorflow-common": { "baseline": "2.4.1", - "port-version": 1 + "port-version": 2 }, "tensorpipe": { "baseline": "2021-04-26", diff --git a/versions/t-/tensorflow-common.json b/versions/t-/tensorflow-common.json index fc8ec6df090..3ac6d830ed3 100644 --- a/versions/t-/tensorflow-common.json +++ b/versions/t-/tensorflow-common.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "84ba326c66ab77faaf3e59d8eb3f04ffa155a4bb", + "version-semver": "2.4.1", + "port-version": 2 + }, { "git-tree": "c2a11af14488e643cf0a07f676d08319a0f70f08", "version-semver": "2.4.1",