-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
git_repository strip_prefix breaks WORKSPACE load
statements
#10062
Comments
My suspicion is that this is caused by git.bzl reaching outside of --- git.bzl.orig 2019-10-18 09:13:55.720479487 -0400
+++ git.bzl 2019-10-18 09:09:43.118443397 -0400
@@ -31,7 +31,7 @@
root = ctx.path(".")
directory = str(root)
if ctx.attr.strip_prefix:
- directory = directory + "-tmp"
+ directory = root.get_child(".tmp")
git_ = git_repo(ctx, directory)
@@ -39,8 +39,9 @@
dest_link = "{}/{}".format(directory, ctx.attr.strip_prefix)
if not ctx.path(dest_link).exists:
fail("strip_prefix at {} does not exist in repo".format(ctx.attr.strip_prefix))
- ctx.delete(root)
- ctx.symlink(dest_link, root)
+
+ for item in ctx.path(dest_link).readdir():
+ ctx.symlink(item, root.get_child(item.basename))
return {"commit": git_.commit, "shallow_since": git_.shallow_since}
|
Unrelated to this bug in It's not necessarily true that a release The But, on the other hand, we have repositories like Instead of consuming the mirrored repository, it would be much more robust to host the release |
…/ tree The release packages currently do not share the same file structure as the git source tree, causing confusion when one switches from the git repository structure to the archive structure. Unfortunately, this doesn't really work with rules_pkg right now due to bazelbuild/bazel#10062. Further, the `experimental/` tree containing `pkgfilegroup` was missing from the 0.2.5 release archive. It will be present in future releases (in `pkg/experimental/`). Additional changes in the future will involve changing the entire structure of rules_pkg to match existing best practices (bazelbuild#111). Given that this is somewhat invasive change, this one is made for now to favor consistency with that currently exists. Testing was done by building the archive, extracting its contents, and performing a diff (`//distro:rules_pkg-0.2.5`), further confirming that `pkgfilegroup` was available with a custom project importing rules_pkg. Fixes bazelbuild#104.
What's the status on this? This is causing a lot of headaches, a fix would be highly appreciated. |
As a hacky woraround, one can replace strip_prefix = "foo" with patch_cmds = ["mv foo/* ."] This is likely brittle; a real fix would be highly appreciated :) |
Any update on this? This is quite troublesome. |
@beasleyr-vmw The first section of your fix is not necessary, the second section alone is enough for it to work. But never the less it breaks patching. |
@meteorcloudy Could you please look into this? This seems to affect a few users, maybe we can easily fix this. 😊 |
OK, let me take a look~ |
I don't think I can figure out a proper easy fix for this in short time, will follow up next week, I have to focus on preparing for BazelCon this week. |
No worries and thanks for looking into it! |
I looked into this, Bazel really doesn't like repository rule touching anything outside of <output_base>/external/, I will accept the fix in #10062 (comment), which does the prefix stripping within the repo directory. When users use |
Description of the problem / feature request:
We mirror GitHub repositories internally, so we have to replace http_archive rules with git_repository equivalents.
When cloning bazelbuild/rules_pkg via
git_repository
withstrip_prefix
, I encounter the following error:Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
WORKSPACE:
BUILD:
If I create a local Git repository rooted at rules_pkg's
pkg
directory, allowing me to remove thestrip_prefix
attr, then the WORKSPACEload
+rules_pkg_dependencies()
calls work just fine.What operating system are you running Bazel on?
Ubuntu 18.04
What's the output of
bazel info release
?release 0.28.1
However, I can also reproduce this with 1.0.0 on CentOS 7.2.
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.What's the output of
git remote get-url origin ; git rev-parse master ; git rev-parse HEAD
?Have you found anything relevant by searching the web?
No. :(
Any other information, logs, or outputs that you want to share?
The text was updated successfully, but these errors were encountered: