blob: a286f3c46bcf8199f01a0328111324086bb42d85 [file] [log] [blame] [view]
[email protected]2d224232016-04-01 06:11:281# Windows binary tool bootstrap
2
3This directory has the 'magic' for the `depot_tools` windows binary update
4mechanisms.
5
Dan Jacques3d9b5882017-07-12 22:14:266A previous Python may actually be in use when it is run, preventing us
7from replacing it outright without breaking running code. To
8ommodate this, and Python cleanup, we handle Python in two stages:
9
101. Use CIPD to install both Git and Python at once.
112. Use "win_tools.py" as a post-processor to install generated files and
12 fix-ups.
13
[email protected]2d224232016-04-01 06:11:2814## Software bootstrapped
15 * Python (https://www.python.org/)
16 * Git for Windows (https://git-for-windows.github.io/)
[email protected]2d224232016-04-01 06:11:2817
18## Mechanism
19
20Any time a user runs `gclient` on windows, it will invoke the `depot_tools`
21autoupdate script [depot_tools.bat](../../update_depot_tools.bat). This, in
22turn, will run [win_tools.bat](./win_tools.bat), which does the bulk of the
23work.
24
25`win_tools.bat` will successively look to see if the local version of the binary
26package is present, and if so, if it's the expected version. If either of those
27cases is not true, it will download and unpack the respective binary.
28
Dan Jacques3d9b5882017-07-12 22:14:2629Installation of Git and Python is done by the [win_tools.bat](./win_tools.bat)
30script, which uses CIPD (via the [cipd](/cipd.bat) bootstrap) to acquire and
31install each package into the root of the `depot_tools` repository. Afterwards,
32the [win_tools.py](./win_tools.py) Python script is invoked to install stubs,
33wrappers, and support scripts into `depot_tools` for end-users.
[email protected]2d224232016-04-01 06:11:2834
Dan Jacques3d9b5882017-07-12 22:14:2635### Manifest
[email protected]2d224232016-04-01 06:11:2836
Dan Jacques3d9b5882017-07-12 22:14:2637The Git and Python versions are specified in [manifest.txt](./manifest.txt).
[email protected]2d224232016-04-01 06:11:2838
Dan Jacques3d9b5882017-07-12 22:14:2639There is an associated file,
40[manifest_bleeding_edge.txt](./manifest_bleeding_edge.txt), that can be used
41to canary new versions on select bots. Any bots with a `.bleeding_edge` file
42in their `depot_tools` root will automatically use the bleeding edge manifest.
43This allows opt-in systems to test against new versions of Python or Git. Once
44those versions have been verified correct, `manifest.txt` can be updated to the
45same specification, which will cause the remainder of systems to update.
[email protected]2d224232016-04-01 06:11:2846
Dan Jacques3d9b5882017-07-12 22:14:2647### Bundles
48
49Git and Python bundle construction is documented in
50[infra packaging](https://chromium.googlesource.com/infra/infra/+/master/doc/packaging/).
[email protected]2d224232016-04-01 06:11:2851
52Note that in order for the update to take effect, `gclient` currently needs to
53run twice. The first time it will update the `depot_tools` repo, and the second
54time it will see the new git version and update to it. This is a bug that should
55be fixed, in case you're reading this and this paragraph infuriates you more
56than the rest of this README.
57
Dan Jacques3d9b5882017-07-12 22:14:2658## Testing
[email protected]2d224232016-04-01 06:11:2859
Dan Jacques3d9b5882017-07-12 22:14:2660After any modification to this script set, a test sequence should be run on a
61Windows bot.
[email protected]2d224232016-04-01 06:11:2862
Dan Jacques3d9b5882017-07-12 22:14:2663The post-processing will regenerate "python.bat" to point to the current
64Python instance. Any previous Python installations will stick around, but
65new invocations will use the new instance. Old installations will die
66off either due to processes terminating or systems restarting. When this
67happens, they will be cleaned up by the post-processing script.
68
69Testing
70=======
71
72For each of the following test scenarios, run these commands and verify that
73they are working:
74
75```bash
76# Assert that `gclient` invocation will update (and do the update).
77gclient version
78
79# Assert that Python fundamentally works.
80python -c "import psutil; print dir(psutil)"
81
82# Assert that Python scripts work from `cmd.exe`.
83git map-branches
84
85# Assert that `git bash` works.
86git bash
87
88## (Within `git bash`) assert that Python fundamentally works.
89python -c "import psutil; print dir(psutil)"
90## (Within `git bash`) assert that Python scripts work.
91git map-branches
92```
93
94Run this sequence through the following upgrade/downgrade procedures:
95
96* Cold default installation.
97 - Clean `depot_tools` via: `git clean -x -f -d .`
98 - Run through test steps.
99 - Test upgrade to bleeding edge (if it differs).
100 - Run `python.bat` in another shell, keep it open
101 - Add `.bleeding_edge` to `depot_tools` root.
102 - Run through test steps.
103 - In the old `python.bat` shell, run `import psutil`, confirm that it
104 works.
105 - Close the Python shell, run `gclient version`, ensure that old directory
106 is cleaned.
107* Cold bleeding edge installation.
108 - Clean `depot_tools` via: `git clean -x -f -d .`
109 - Add `.bleeding_edge` to `depot_tools` root.
110 - Run through test steps.
111 - Test downgrade to default (if it differs).
112 - Run `python.bat` in another shell, keep it open
113 - Delete `.bleeding_edge` from `depot_tools` root.
114 - Run through test steps.
115 - In the old `python.bat` shell, run `import psutil`, confirm that it
116 works.
117 - Close the Python shell, run `gclient version`, ensure that old directory
118 is cleaned.
119* Warm bleeding edge upgrade.
120 - Clean `depot_tools` via: `git clean -x -f -d .`
121 - Run `gclient version` to load defaults.
122 - Run `python.bat` in another shell, keep it open
123 - Add `.bleeding_edge` to `depot_tools` root.
124 - Run through test steps.
125 - In the old `python.bat` shell, run `import psutil`, confirm that it
126 works.
127 - Close the Python shell, run `gclient version`, ensure that old directory is
128 cleaned.
129* Upgradable and Revertible.
130 - Checkout current `HEAD`.
131 - Run `gclient version` to load HEAD toolchain (initial).
132 - Apply the candidate patch.
133 - Run through test steps (upgrade).
134 - Checkout current `HEAD` again.
135 - Run `gclient version` to load HEAD toolchain (revert).
136 - Run through test steps.
137
138This will take some time, but will ensure that all affected bots and users
139should not encounter any problems due to the change. As systems and users are
140migrated off of this implicit bootstrap, the testing procedure will become less
141critical.