Using depot_tools

View the updated depot_tools documentation here.These same docs are also available as man pages.Not all the information on this page has been migrated to the man pages yet, so this resource will stay around for a while, but where there are discrepancies, the man pages should be considered authoritative.

Introduction

Chromium uses a package of scripts, the depot_tools, to manage interaction with the Chromium source code repository and the Chromium development process. It contains the following utilities:

gclient: Meta-checkout tool managing both subversion and git checkouts. It is similar to repo tool except that it works on Linux, OS X, and Windows and supports both svn and git. On the other hand, gclient doesn't integrate any code review functionality.

svn [Windows only]: subversion client for Chromium development. (Executable Subversion binaries are included in the depot_tools on Windows systems as a convenience, so that working with Chromium source code does not require a separate Subversion download.)

drover: Quickly revert svn commits.

cpplint.py: Checks for C++ style compliance.

pylint: Checks for Python style compliance.

presubmit_support.py: Runs PRESUBMIT.py presubmit checks.

repo: The repo tool.

wtf: Displays the active git branches in a chromium os checkout.

weekly: Displays the log of checkins for a particular developer since a particular date for git checkouts.

git-gs: Wrapper for git grep with relevant source types.

zsh-goodies: Completion for zsh users.

It is highly encouraged to look around and open the files in a text editor as this page can quickly become outdated.

Each project described in the solutions array can contain an optional DEPS file that will be processed. The .gclient file is generated with gclient config <url> or by hand. Each solutions entry is a dictionary that can contain the following variables:

name: really, the path of the checkout.

url: the remote repository to fetch/clone.

custom_deps: (optional) override the dependencies specified in the deps and deps_os variables in child DEPS files. Useful when you want to fetch a writable checkout instead of the default read-only checkout of a dependency, e.g. you work on native_client from a chromium checkout.

custom_vars: (optional) override the variables defined in vars in child DEPS files. Example: override the WebKit version used for a chromium checkout.

safesync_url: (optional) url to fetch to retrieve the revision to sync this checkout to.

DEPS file

A DEPS file specifies dependencies of a project. It is in fact a python script. It specifies the following variables:

deps: a dictionary of child dependencies to fetch.

deps_os: a dictionary of OSes for OS-specific dependencies, each containing a dictionary of child dependencies to fetch.

vars: a dictionary of variables to define. Mainly useful to easily override a batch of revisions at once.

hooks: hooks to run after a sync.

use_relative_paths: relative paths should specify the checkout relative to this directory instead of the root gclient checkout.

Additional variables are ignored. Special keywords are:

File(): used for dependencies, specify to expect to checkout a file instead of a directory.

From(): used to fetch a dependency definition from another DEPS file, for chaining.

Var(): replace this string with a variable defined in vars or overridden.

Pinned deps

Each dependency checkout URL can (and usually does) contain a revision number or git hash, which means you're going to check out and build from that specific revision of the module in question. We call that pinned deps. The advantage is that you can build from a known working revision, even if it comes from a completely different SCM repository or going back in time. The drawback is you have to update the revision number(s) constantly, what we call deps rolls.

DEPS examples

Chromium's src/DEPS is a fairly complex example that will show all the possibilities of a DEPS file.