Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: bootstrap/README.md

Issue 381043002: Add a virtualenv-based python bootstrapping service to infra. (Closed) Base URL: https://chromium.googlesource.com/infra/infra@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Bootstrapping the Chromium Infra Repo
2
3 The infra/infra repo uses python [wheel files][1], [virtualenv][2] and [pip][3]
agable 2014/07/10 17:12:56 FWIW, I prefer putting [asdf][1]-style footnotes a
iannucci 2014/07/11 02:14:44 Done.
4 to manage dependencies. The process for bootstrapping these is contained
5 entirely within the bootstrap directory.
6
7
8 ## `bootstrap.py` (a.k.a. "I just want a working infra repo!")
9 Run `./bootstrap/bootstrap.py --deps_file bootstrap/deps.pst`. This will create
agable 2014/07/10 17:12:56 Same comment re: python -m.
iannucci 2014/07/11 02:14:44 Nack!
10 a virtualenv called `{repo_root}/ENV` with all the deps contained in
11 `bootstrap/deps.pst`. You must be online, or must already have the wheels for
agable 2014/07/10 17:12:56 nit: normalize number of spaces after periods to a
iannucci 2014/07/11 02:14:44 Done.
12 your system cached in `{repo_root}/.wheelcache`.
13
14 If you already have an ENV, `bootstrap.py` will check the manifest in ENV to
15 see if it matches `deps.pst` (e.g. the diff is zero). If it's not, then ENV
agable 2014/07/10 17:12:56 I think you mean i.e., not e.g.
iannucci 2014/07/11 02:14:44 So I do... And I was being so careful....
16 will be re-created _from scratch_.
17
18 Running `{repo_root}/run.py` in any capacity will implicitly call `bootstrap.py`
agable 2014/07/10 17:12:56 I don't see it doing this...
iannucci 2014/07/11 02:14:44 Done.
19 unless `--no_bootstrap` is passed (which will make run.py use whatever ENV is
agable 2014/07/10 17:12:56 run.py doesn't implement --no_bootstrap.
iannucci 2014/07/11 02:14:44 Acknowledged.
20 currently present).
21
22
23 ## `deps.pst`
agable 2014/07/10 17:12:56 Is ".pst" a standard extension for PyAST files, or
iannucci 2014/07/11 02:14:44 Changing to .pyl
24 This file is a python dictionary containing the exact versions of all python
25 module dependencies. These versions are the standard upstream package versions
26 (e.g. '0.8.0'), plus the commit hash or sha1.{ext} of an ingested source bundle
27 (see `inject_source.py`).
28
29 The format of this file is `{'package_name': <values>}`. This file is a python
30 [ast literal][4], so comments are allowed and encouraged.
31
32 Values are:
33 * version: The pip version of the module
34 * build: An integer representing which build of this version/hash. If you
35 modify the _way_ that a requirement is built, but not the source hash, you
36 can bump the build number to get a new pinned dependency.
37
38 And either:
39 * rev: The revision or sha1 of the source for this module.
40 * The repo is
41 'git+https://chromium.googlesource.com/infra/third_party/{package_name}'
agable 2014/07/10 17:12:56 What happens when spread this system to additional
iannucci 2014/07/11 02:14:44 Chatted in person, but essentially, the only time
42 * gs: '{sha1}.{ext}' indicates file
43 'gs://chrome-infra-wheelhouse/sources/{sha1}.{ext}'. The sha1 will be
44 checked against the content of the file.
45
46 And optionally:
47 * implicit: A boolean indicating that this dep should only be installed as a
48 dependency of some other dep. For example, you want package A, which
49 depends on package Z, but you don't really care about Z. You should mark
50 Z as 'implicit' to allow it to be pinned correctly, but not to
51 deliberately install it.
52
agable 2014/07/10 17:12:56 nit: two newlines
iannucci 2014/07/11 02:14:44 Done.
53 ## `ingest_source.py`
54 Some python modules don't have functional python repos (i.e. ones that pip
55 can natively clone+build), and thus ship their source in tarballs. To ingest
56 such a tarball into the infra google storage bucket, use
57 `ingest_source.py /path/to/archive`.
58 This will print the value for the 'gs' key for a deps.pst entry.
59
60
61 ## `build_deps.py` / rolling deps
agable 2014/07/10 17:12:56 This file doesn't actually do a good job of descri
iannucci 2014/07/11 02:14:44 Done. Sort of. :D
62 Any time a new dependency/version is introduced into `deps.pst`, you must run
63 `build_deps.py`. If the dependency is a pure-python dependency (i.e. no compiled
64 extensions), you only need to run it once on CPython 2.7. You can tell that it's
65 a pure python module by looking at the name of the wheel file. For example:
66
67 requests-2.3.0-py2.py3-none-any.whl
68
69 Is compatible with Python 2 and Python 3 (py2.py3) any python ABI (none), and
70 any OS platform (any).
71
72 If the module does contain compiled extensions, you must run `build_deps.py` on
73 the following systems (all with CPython 2.7):
74 * OS X 10.9 - `x86_64`
75 * Windows 7 - `x86_64`
76 * Linux - `x86_64`
77
78 TODO(iannucci): Add job to build wheels on all appropriate systems.
79
80 Once a wheel is sucessfully built, it is uploaded to
Vadim Sh. 2014/07/10 18:18:24 Who has write access to the bucket?
81 `gs://chrome-python-wheelhouse/wheels` if it is not there already.
82
83 Running `build_deps.py` will only attempt to build dependencies which are
84 missing for the current platform.
85
86 `build_deps.py` assumes that it can find `gsutil` on PATH, so go ahead and
Vadim Sh. 2014/07/10 18:18:24 Does it have minimum version requirement for gsuti
87 install it appropriately for whichever platform you're on.
88
89
90 ## custom builds
91 Sometimes building a wheel is a bit trickier than `pip wheel {repo}@{hash}`. In
92 order to support this, add a script named `custom_builds/{name}.py`. This module
93 should have a function defined like:
94
95 `def Build(source_path, wheelhouse_path)`
96
97 Where `source_path` is a string path to the checked-out / unpacked source code,
98 and `wheelhouse_path` is a string path where `build_deps.py` expects to find
99 a .whl file after Build completes.
100
101
102 ## rolling the version of wheel
103 Since wheel is a package needed to build the wheels, it has a slightly different
104 treatment. To roll wheel, bump the version in deps.pst, and then run
105 `bootstrap_wheel_wheel.sh`
Vadim Sh. 2014/07/10 18:18:24 funny name :)
106 To build and upload the wheel for 'wheel' pinned at the version in deps.pst.
agable 2014/07/10 17:12:56 nit: uncapitalize To
iannucci 2014/07/11 02:14:44 Done.
107
108 Once you do that, `build_deps.py` will continue working as expected.
109
110
111 ## Building deps on Windows
112 TODO(iannucci): actually implement this
113
114 Windows builds require a slightly more care when building, due to the
115 complexities of getting a compile environment. To this effect, `build_deps.py`
116 relies on the `depot_tools/win_toolchain` functionality to get a hermetic
117 windows compiler toolchain. This should not be an issue for chromium devs
118 working on windows, since they should already have this installed by compiling
119 chromium, but it's something to be aware of.
120
121
122 ## modified (non-upstream) deps
123 If it is necessary to roll a patched version of a library, we should branch it
124 in the infra googlesource mirror. This branch should be named `{version}-cr`,
125 and will build packages whose version is `{version}.{cr_version}` (e.g. modify
126 setup.py on this branch to add an additional component to the version field).
127
128 For example, given the package `jane` at version `2.1.3`, we would create
129 a branch `2.1.3-cr`. On this branch we would commit any changes necessary to
130 `2.1.3`, and would adjust the version number in the builds to be e.g. `2.1.3.0`.
131
132
133 1: http://legacy.python.org/dev/peps/pep-0427/
134 2: https://github.com/pypa/virtualenv
135 3: https://github.com/pypa/pip
136 4: https://docs.python.org/2/library/ast.html#ast.literal_eval
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698