-
-
Notifications
You must be signed in to change notification settings - Fork 99
feat(mtree_mutate): support file_mode argument #1059
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
base: main
Are you sure you want to change the base?
Conversation
Tested locally using http_archive(
name = "aspect_bazel_lib",
integrity = "sha256-xi9efFcuNYR8c50Ji0+yj1cxy5kW6c+sQBDrDFMKuKM=",
strip_prefix = "bazel-lib-3e312b35178fae5de0cad2a1fadcd03d9819b3b1",
url = "https://github.com/skeggse/bazel-lib/archive/3e312b35178fae5de0cad2a1fadcd03d9819b3b1.tar.gz",
) seems to work |
@@ -153,6 +153,9 @@ _mutate_mtree_attrs = { | |||
"mtime": attr.string( | |||
doc = "Specifies the modification time (mtime) to be applied to all files in the tar file. Used for deterministic builds.", | |||
), | |||
"file_mode": attr.string( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name "file_mode" is confusing since this applies to everything, of any type
. Should this be just mode?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it apply solely to type=file
?
bazel-lib/lib/private/modify_mtree.awk
Lines 82 to 84 in 3e312b3
if (file_mode != "" && $0 ~ /type=file/) { | |
sub(/mode=[0-9]+/, "mode=" file_mode) | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, mtree contains everything, intermediary directories, files, symlinks, fifo etc. in this case, this variable will apply to all directories and files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm still not sure i understand. the line of code i linked to specifically checks for type=file
. how is the mode
getting changed for non-file
s, and why am i not seeing the behavior you're claiming in my local testing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh my bad, that’s true. Do we something more generic than this though? I feel like we can do better in terms of Public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let me thinker over the weekend and see if I could come up with a better api
fixes #921