Skip to content

Commit

Permalink
Fix to pkg_tar(mtime=N). The code never worked.
Browse files Browse the repository at this point in the history
See: bazelbuild#7482

Wow. This testing scheme is fragile. Someone shoudld rewrite it with a
golden test scheme so the expected tar content can be put in the BUILD
file and each pkg can have a distinct test.

RELNOTES: None
PiperOrigin-RevId: 243187745
  • Loading branch information
aiuto authored and copybara-github committed Apr 12, 2019
1 parent 3f6ed62 commit d888e4d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/build_defs/pkg/build_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ function test_tar() {
drwxrwxrwx 0/0 0 2000-01-01 00:00 ./tmp/
drwxrwxrwx 0/0 0 2000-01-01 00:00 ./pmt/" \
"$(get_tar_verbose_listing test-tar-empty_dirs.tar)"
check_eq \
"drwxr-xr-x 0/0 0 1999-12-31 23:59 ./
-r-xr-xr-x 0/0 2 1999-12-31 23:59 ./nsswitch.conf" \
"$(get_tar_verbose_listing test-tar-mtime.tar)"
}

function test_deb() {
Expand Down
2 changes: 1 addition & 1 deletion tools/build_defs/pkg/pkg.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def _pkg_tar_impl(ctx):
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)
args.append("--mtime=%d" % ctx.attr.mtime)
if ctx.attr.portable_mtime:
args.append("--mtime=portable")

Expand Down

0 comments on commit d888e4d

Please sign in to comment.