Change tar format to posix

Hello! First a little bit about my use case. I’m working on a scala project that uses the scala build tool. I’m caching some source dependencies and their compiled forms, all according to documentation provided by sbt. I can see the class files are all restored correctly. However, SBT recompiles all of it anyway!

The root cause of the above is that the modify time (“last changed”) of files is stored in the cache in the default tar format, which truncates that time to whole seconds. SBT doesn’t like this. Would you consider changing the tar format to POSIX? Clearly my use case is quite narrow, but the posix format is the least restrictive format by any measure, see e.g. here: https://www.gnu.org/software/tar/manual/html_chapter/tar_8.html. I’ve successfully tried this by injecting the flag --format=posix before the cache is stored, and the cache is also successfully loaded again without any additional flags, so the tar version used can already distinguish between posix and gnu tar files without any change. The only thing that would need to change is the storing side of the cache, by adding the flag --format=posix.

Thanks for the pointers. Assuming that tar automatically detects the POSIX format, this seems like a reasonable change.

You can try this:

cache:
  branch: format-posix
  ⋮ # rest

Run at least two builds to see if the second (and later) builds see any benefit, and please report the results.

Thanks.

1 Like

That works, here are some builds:

“works”, as in “works with the desired effects”? https://travis-ci.org/utwente-fmt/vercors/builds/598618103#L620 says that the new archive was created. Was that expected?

Thanks for pointing that out. I meant works as in SBT no longer recompiles the cached class files, as seen in the build time & build log.

The listed changed files in that build seem to be log files that contain which files were compiled due to changes (it just contains “[debug] No changes” on my machine). I did one more rebuild here, which now indeed says that the cache paths don’t have changes anymore.

I just took the caching configuration from the sbt reference here, but I guess at least this file should also be excluded from the cache.

Thanks for the clarification. I’ll push this to production shortly.

2 Likes
Imprint