sha256 doesn't appear to work with git_repository

107 views
Skip to first unread message

rodr...@google.com

unread,
Aug 31, 2017, 6:25:35 AM8/31/17
to bazel-discuss
I can't get the sha256 parameter to work with git_repository - am I doing something wrong, or is this a bug?

Relatedly, is there an automated way of working out the sha256 for git_repository/http_archive? I've been using `curl -L ... | sha256sum` but it's pretty tedious.

➜ cat WORKSPACE
git_repository(
name = "git_repo",
commit = "e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d",
remote = "https://github.com/google/googletest.git",
sha256 = "f7b26ab6f9c1c938766c4fc523f48cdf8108f2a16fa1a001c7c97ec39f7595ca",
)

http_archive(
name = "http_repo",
sha256 = "f7b26ab6f9c1c938766c4fc523f48cdf8108f2a16fa1a001c7c97ec39f7595ca",
strip_prefix = "googletest-e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d",
url = "https://github.com/google/googletest/archive/e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.tar.gz",
)
➜ bazel build @git_repo//...
ERROR: Could not download tarball, but sha256 specified (f7b26ab6f9c1c938766c4fc523f48cdf8108f2a16fa1a001c7c97ec39f7595ca)
INFO: Elapsed time: 0.788s
FAILED: Build did NOT complete successfully (0 packages loaded)
➜ bazel build @http_repo//...
WARNING: /usr/local/google/home/rodrigoq/.cache/bazel/_bazel_rodrigoq/0a9ee07d9c49cbcf7174a896fad264a7/external/http_repo/WORKSPACE:1: Workspace name in /usr/local/google/home/rodrigoq/.cache/bazel/_bazel_rodrigoq/0a9ee07d9c49cbcf7174a896fad264a7/external/http_repo/WORKSPACE (@com_google_googletest) does not match the name given in the repository's definition (@http_repo); this will cause a build error in future versions
INFO: Analysed 11 targets (11 packages loaded).
INFO: Found 11 targets...
INFO: Elapsed time: 28.780s, Critical Path: 26.68s
INFO: Build completed successfully, 102 total actions

Marcel Hlopko

unread,
Sep 1, 2017, 4:07:54 AM9/1/17
to rodr...@google.com, bazel-discuss, dmar...@google.com

--
You received this message because you are subscribed to the Google Groups "bazel-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bazel-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bazel-discuss/b524d964-728e-4d18-a4d0-e2c43422857f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
-- 
Marcel Hlopko | Software Engineer | hlo...@google.com | 

Google Germany GmbH | Erika-Mann-Str. 33  | 80636 München | Germany | Geschäftsführer: Geschäftsführer: Paul Manicle, Halimah DeLaine Prado | Registergericht und -nummer: Hamburg, HRB 86891

Damien Martin-Guillerez

unread,
Sep 1, 2017, 4:41:32 AM9/1/17
to Marcel Hlopko, rodr...@google.com, bazel-discuss
Hi Rodrigo,

This is a bit weird, I was ble to repro but when I tried another time to build the git repo, it passes:
[dmarting@trantor] /tmp/w$ bazel build @git_repo//...
...........
ERROR: Could not download tarball, but sha256 specified (f7b26ab6f9c1c938766c4fc523f48cdf8108f2a16fa1a001c7c97ec39f7595ca)
INFO: Elapsed time: 1.173s
FAILED: Build did NOT complete successfully (0 packages loaded)
[dmarting@trantor] /tmp/w$ bazel build @http_repo//...
WARNING: /usr/local/google/home/dmarting/.cache/bazel/_bazel_dmarting/c06a12bbe2b47cf6ffc2589a847c1ccd/external/http_repo/WORKSPACE:1: Workspace name in /usr/local/google/home/dmarting/.cache/bazel/_bazel_dmarting/c06a12bbe2b47cf6ffc2589a847c1ccd/external/http_repo/WORKSPACE (@com_google_googletest) does not match the name given in the repository's definition (@http_repo); this will cause a build error in future versions
INFO: Analysed 11 targets (11 packages loaded).
INFO: Found 11 targets...
INFO: Elapsed time: 35.452s, Critical Path: 24.31s
INFO: Build completed successfully, 102 total actions
[dmarting@trantor] /tmp/w$ bazel build @git_repo//...
WARNING: /usr/local/google/home/dmarting/.cache/bazel/_bazel_dmarting/c06a12bbe2b47cf6ffc2589a847c1ccd/external/git_repo/WORKSPACE:1: Workspace name in /usr/local/google/home/dmarting/.cache/bazel/_bazel_dmarting/c06a12bbe2b47cf6ffc2589a847c1ccd/external/git_repo/WORKSPACE (@com_google_googletest) does not match the name given in the repository's definition (@git_repo); this will cause a build error in future versions
INFO: Analysed 11 targets (3 packages loaded).
INFO: Found 11 targets...
INFO: Elapsed time: 32.369s, Critical Path: 24.03s
INFO: Build completed successfully, 102 total actions


Looking at the code it is likely an error during HTTP download that got swallowed and the user error is not understandable. Filed #3661.
Reply all
Reply to author
Forward
0 new messages