Page MenuHomePhabricator

Gerrit tools/download_file.py needs some enhancement
Closed, ResolvedPublic

Description

Gerrit build uses a python script to download materials: tools/download_file.py. It has at least a couple issues:

  • it always cache to the home directory (~) but should really honor XDG_CACHE_HOME
  • when the build is interrupted, a truncated cached file might have been saved and the script choke on the checksum mismatch. It should instead discard the faulty file from the cache and retry.

Event Timeline

hashar triaged this task as Low priority.Jul 9 2019, 9:30 PM
hashar claimed this task.

I have encountered that issue two years later when taking over the maintenance of Gerrit. I have patched download_file and download_bower with:

https://gerrit-review.googlesource.com/c/gerrit/+/305127
https://gerrit-review.googlesource.com/c/gerrit/+/306285

The cache can be set by setting`GERRIT_CACHE_HOME` (rather than XDG_CONFIG_CACHE) since upstream wanted to have all caches at the same place (aka with the bazel cache).

My patches got released with Gerrit 3.1.14, 3.2.10, 3.3.4, 3.4.0 (and thus any later versions).