Skip to content

Commit c715c31

Browse files
authored
Merge pull request tensorflow#4284 from caisq/r0.10-fixes
Cherry-picking r0.10 fixes
2 parents 23da860 + f5a9638 commit c715c31

File tree

2 files changed

+34
-4
lines changed

2 files changed

+34
-4
lines changed

tensorflow/tools/docker/parameterized_docker_build.sh

+15-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,21 @@ fi
323323

324324
# Apply the final image name and tag
325325
FINAL_IMG="${FINAL_IMAGE_NAME}:${FINAL_TAG}"
326-
docker tag -f "${IMG}" "${FINAL_IMG}" || \
326+
327+
DOCKER_VER=$(docker version | grep Version | head -1 | awk '{print $NF}')
328+
if [[ -z "${DOCKER_VER}" ]]; then
329+
die "ERROR: Failed to determine docker version"
330+
fi
331+
DOCKER_MAJOR_VER=$(echo "${DOCKER_VER}" | cut -d. -f 1)
332+
DOCKER_MINOR_VER=$(echo "${DOCKER_VER}" | cut -d. -f 2)
333+
334+
FORCE_TAG=""
335+
if [[ "${DOCKER_MAJOR_VER}" -le 1 ]] && \
336+
[[ "${DOCKER_MINOR_VER}" -le 9 ]]; then
337+
FORCE_TAG="--force"
338+
fi
339+
340+
docker tag ${FORCE_TAG} "${IMG}" "${FINAL_IMG}" || \
327341
die "Failed to tag intermediate docker image ${IMG} as ${FINAL_IMG}"
328342

329343
echo ""

tensorflow/tools/pip_package/build_pip_package.sh

+19-3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@
1717

1818
set -e
1919

20+
function cp_external() {
21+
local src_dir=$1
22+
local dest_dir=$2
23+
for f in `find "$src_dir" -maxdepth 1 -mindepth 1 ! -name '*local_config_cuda*'`; do
24+
cp -R "$f" "$dest_dir"
25+
done
26+
}
27+
2028
function main() {
2129
if [ $# -lt 1 ] ; then
2230
echo "No destination dir provided"
@@ -36,23 +44,31 @@ function main() {
3644
if [ ! -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow ]; then
3745
# Really old (0.2.1-) runfiles, without workspace name.
3846
cp -R \
39-
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/{tensorflow,external} \
47+
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/tensorflow \
4048
"${TMPDIR}"
49+
mkdir "${TMPDIR}/external"
50+
cp_external \
51+
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/external \
52+
"${TMPDIR}/external"
4153
RUNFILES=bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles
4254
else
4355
if [ -d bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/external ]; then
4456
# Old-style runfiles structure (--legacy_external_runfiles).
4557
cp -R \
46-
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/{tensorflow,external} \
58+
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/tensorflow \
4759
"${TMPDIR}"
60+
mkdir "${TMPDIR}/external"
61+
cp_external \
62+
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/external \
63+
"${TMPDIR}/external"
4864
else
4965
# New-style runfiles structure (--nolegacy_external_runfiles).
5066
cp -R \
5167
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/org_tensorflow/tensorflow \
5268
"${TMPDIR}"
5369
mkdir "${TMPDIR}/external"
5470
# Note: this makes an extra copy of org_tensorflow.
55-
cp -R \
71+
cp_external \
5672
bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles \
5773
"${TMPDIR}/external"
5874
fi

0 commit comments

Comments
 (0)