This commit is contained in:
huoju
2021-09-12 01:12:22 -04:00
parent 0b6cf6fb76
commit 0f24369766
2 changed files with 30 additions and 0 deletions

View File

@@ -62,6 +62,10 @@ TF_NEED_CUDA_VARS_OFF= TF_ENV+="TF_NEED_CUDA=0"
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-docker_tensorflow_tensorflow-1.15.2_tensorflow_core_protobuf_autotuning.proto
.endif
.if ${OPSYS} == FreeBSD && ${OSVERSION} > 1200000 && ${OSVERSION} < 1300000
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-docker_tensorflow_tensorflow-1.15.2_third_party_repo.bz
.endif
post-extract:
@${REINPLACE_CMD} -e 's|sha1sum|shasum|g' ${WRKSRC}/scripts/download-nasnet.sh
@${REINPLACE_CMD} -e 's|sha1sum|shasum|g' ${WRKSRC}/scripts/download-nsfw.sh

View File

@@ -0,0 +1,26 @@
diff --git a/third_party/repo.bzl b/third_party/repo.bzl
index a7506b4efe..083ebf9d6a 100644
--- docker/tensorflow/tensorflow-1.15.2/third_party/repo.bzl.orig
+++ docker/tensorflow/tensorflow-1.15.2/third_party/repo.bzl
@@ -62,13 +62,15 @@ def _repos_are_siblings():
return Label("@foo//bar").workspace_root.startswith("../")
# Apply a patch_file to the repository root directory
-# Runs 'git apply' on Unix, 'patch -p1' on Windows.
+# Runs 'patch -p1'
def _apply_patch(ctx, patch_file):
- if _is_windows(ctx):
- patch_command = ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)]
- else:
- patch_command = ["git", "apply", "-v", ctx.path(patch_file)]
- cmd = _wrap_bash_cmd(ctx, patch_command)
+ # Don't check patch on Windows, because patch is only available under bash.
+ if not _is_windows(ctx) and not ctx.which("patch"):
+ fail("patch command is not found, please install it")
+ cmd = _wrap_bash_cmd(
+ ctx,
+ ["patch", "-p1", "-d", ctx.path("."), "-i", ctx.path(patch_file)],
+ )
_execute_and_check_ret_code(ctx, cmd)
def _apply_delete(ctx, paths):