Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --mtime flag to build_tar.py. Use this feature for pkg_tar.
This effectively reverts part of #7276. archive.py no longer makes TAR files with the mtime 2000-01-01. Now, only tar files made with the pkg_tar() rule will get that mtime value by default. This means other users of archive.py (e.g. rules_docker) will not experience a sudden change in tar content when updating Bazel. #1299 @beasleyr-vmw: Can you test this in your process to see that it still solves issue 1299 for you? Closes #7482. PiperOrigin-RevId: 234991284
- Loading branch information
Showing
4 changed files
with
52 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -47,6 +47,12 @@ def _pkg_tar_impl(ctx): | |
"--owner=" + ctx.attr.owner, | ||
"--owner_name=" + ctx.attr.ownername, | ||
] | ||
if ctx.attr.mtime != -1: # Note: Must match default in rule def. | ||
if ctx.attr.portable_mtime: | ||
fail("You may not set both mtime and portable_mtime") | ||
args.append("--mtime=" + ctx.attr.mtime) | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
aiuto
via email
Author
Contributor
|
||
if ctx.attr.portable_mtime: | ||
args.append("--mtime=portable") | ||
|
||
# Add runfiles if requested | ||
file_inputs = [] | ||
|
@@ -218,6 +224,8 @@ _real_pkg_tar = rule( | |
"files": attr.label_keyed_string_dict(allow_files = True), | ||
"mode": attr.string(default = "0555"), | ||
"modes": attr.string_dict(), | ||
"mtime": attr.int(default = -1), | ||
"portable_mtime": attr.bool(default = True), | ||
"owner": attr.string(default = "0.0"), | ||
"ownername": attr.string(default = "."), | ||
"owners": attr.string_dict(), | ||
|
this actually fails: