[cipd] Try to bootstrap CIPD from scratch if selfupdate fails.

When updating the CIPD client to be identified by SHA256 hash, old clients (that
have no idea about SHA256) fail during 'selfupdate'.

We'll roll our SHA256 support in two stages:
  1. Deploy new client that understand SHA256 using its SHA1 name, so
     self-update from old clients works.
  2. Deploy same (or newer) client using its SHA256 name. This would work since
     the client doing the self-update already understands SHA256 at this point.

But we can't guarantee that ALL buildtools deployments will update through
stages (1) and (2) sequentially. Some of them may skip (1) and end-up directly
in (2), failing on 'selfupdate'.

This CL makes sure they can recover from this state by rebootstraping the client
from scratch (this works with SHA256 hashes).

Similar CL in Chromium's depot_tools:
https://chromium-review.googlesource.com/1149454

Change-Id: I6bb6cb9980ad536008260af74ddec90ded51dd22
2 files changed
tree: 9fc9781ee914b2c33c219d12957618fe99626168
  1. manifest/
  2. .cipd_version
  3. .gitignore
  4. AUTHORS
  5. cipd
  6. download.sh
  7. exec_tool.sh
  8. fuchsia.ensure
  9. gn
  10. go
  11. godepfile
  12. LICENSE
  13. MAINTAINERS
  14. ninja
  15. PATENTS
  16. README.md
  17. update.sh
  18. vars.sh
README.md

Fuchsia Build Tools

This repository contains the hashes of a number of prebuilt tools that are used to build Fuchsia-related projects. The actual tools themselves are located in Google Storage.

In most cases, the jiri tool will download the build tools automatically during its update step. To download the tools manually, run update.sh.

Uploading a tool

NOTE: These instructions are for Googlers only.

Installing gsutil

The tarballs are uploaded with the “gsutil” program. See https://cloud.google.com/storage/docs/gsutil

There's a link there to download and install the Google Cloud SDK: https://cloud.google.com/sdk/docs/

After installing the SDK you need to initialize/authenticate: https://cloud.google.com/storage/docs/gsutil_install#authenticate

One of the steps will ask you for a cloud project. Choose loas-fuchsia-team.

At this point you can use gsutil to upload/download tarballs, view cloud directory contents, and so on.

Tarballs

Tarballs must have the tool name as the top level directory. E.g.,

bash$ tar tvf qemu.tar.bz2
drwxr-xr-x ... qemu/
drwxr-xr-x ... qemu/libexec/
...

The uploaded file name is the sha1 hash of the tarball. It could also be a sha1 hash of the tarball contents, avoiding unnecessary spurious differences in uploads.

To compute the latter, one can do something like:

bash$ LC_ALL=POSIX cat $(find qemu/ -type f | sort) | shasum -a1

The sha1 hash is checked into the buildtools repo and supports adding new tarballs or rolling back to a previous one. See the *.sha1 files in buildtools/{mac,linux64}.

There are separate directories for mac and linux tarballs. E.g.,

bash$ ./bin/gsutil ls gs://fuchsia-build/fuchsia/qemu/mac
gs://fuchsia-build/fuchsia/qemu/mac/
gs://fuchsia-build/fuchsia/qemu/mac/10d77d7df5b39440148ac3aab1a401ff42337a76
...
bash$ ./bin/gsutil ls gs://fuchsia-build/fuchsia/qemu/linux64
gs://fuchsia-build/fuchsia/qemu/linux64/
gs://fuchsia-build/fuchsia/qemu/linux64/10d77d7df5b39440148ac3aab1a401ff42337a76
...