From bfe7c60092f8d4540578a669eca6444f8206f6a6 Mon Sep 17 00:00:00 2001 From: John Cater Date: Thu, 5 Sep 2019 17:09:53 -0400 Subject: [PATCH] Revert "Make http_archive honor $HOME/.netrc" This reverts commit c26e3396cb341e173b4be5c780cafac3ec386df5. Work on #9327. --- .../shell/bazel/skylark_repository_test.sh | 37 ------------------- tools/build_defs/repo/http.bzl | 10 +---- 2 files changed, 1 insertion(+), 46 deletions(-) diff --git a/src/test/shell/bazel/skylark_repository_test.sh b/src/test/shell/bazel/skylark_repository_test.sh index 3b753e42abbc78..d67d028ff11900 100755 --- a/src/test/shell/bazel/skylark_repository_test.sh +++ b/src/test/shell/bazel/skylark_repository_test.sh @@ -1852,41 +1852,4 @@ EOF || fail "Expected success despite needing a file behind basic auth" } -function test_implicit_netrc() { - mkdir x - echo 'exports_files(["file.txt"])' > x/BUILD - echo 'Hello World' > x/file.txt - tar cvf x.tar x - sha256=$(sha256sum x.tar | head -c 64) - serve_file_auth x.tar - - export HOME=`pwd` - cat > .netrc <<'EOF' -machine 127.0.0.1 -login foo -password bar -EOF - - mkdir main - cd main - cat > WORKSPACE < BUILD <<'EOF' -genrule( - name = "it", - srcs = ["@ext//x:file.txt"], - outs = ["it.txt"], - cmd = "cp $< $@", -) -EOF - bazel build //:it \ - || fail "Expected success despite needing a file behind basic auth" -} - run_suite "local repository tests" diff --git a/tools/build_defs/repo/http.bzl b/tools/build_defs/repo/http.bzl index da4bf88b67dbff..8e33d434a8462a 100644 --- a/tools/build_defs/repo/http.bzl +++ b/tools/build_defs/repo/http.bzl @@ -45,15 +45,7 @@ def _get_auth(ctx, urls): netrc = read_netrc(ctx, ctx.attr.netrc) return use_netrc(netrc, urls) - if "HOME" in ctx.os.environ: - if not ctx.os.name.startswith("windows"): - netrcfile = "%s/.netrc" % (ctx.os.environ["HOME"],) - if ctx.execute(["test", "-f", netrcfile]).return_code == 0: - netrc = read_netrc(ctx, netrcfile) - return use_netrc(netrc, urls) - - # TODO: Search at a similarly canonical place for Windows as well - + # TODO: use ~/.netrc instead, if it exists and is readable return {} def _http_archive_impl(ctx):