[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 1 | # Windows binary tool bootstrap |
| 2 | |
| 3 | This directory has the 'magic' for the `depot_tools` windows binary update |
| 4 | mechanisms. |
| 5 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 6 | A previous Python may actually be in use when it is run, preventing us |
| 7 | from replacing it outright without breaking running code. To |
| 8 | ommodate this, and Python cleanup, we handle Python in two stages: |
| 9 | |
| 10 | 1. Use CIPD to install both Git and Python at once. |
| 11 | 2. Use "win_tools.py" as a post-processor to install generated files and |
| 12 | fix-ups. |
| 13 | |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 14 | ## Software bootstrapped |
| 15 | * Python (https://www.python.org/) |
| 16 | * Git for Windows (https://git-for-windows.github.io/) |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 17 | |
| 18 | ## Mechanism |
| 19 | |
| 20 | Any time a user runs `gclient` on windows, it will invoke the `depot_tools` |
| 21 | autoupdate script [depot_tools.bat](../../update_depot_tools.bat). This, in |
| 22 | turn, will run [win_tools.bat](./win_tools.bat), which does the bulk of the |
| 23 | work. |
| 24 | |
| 25 | `win_tools.bat` will successively look to see if the local version of the binary |
| 26 | package is present, and if so, if it's the expected version. If either of those |
| 27 | cases is not true, it will download and unpack the respective binary. |
| 28 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 29 | Installation of Git and Python is done by the [win_tools.bat](./win_tools.bat) |
| 30 | script, which uses CIPD (via the [cipd](/cipd.bat) bootstrap) to acquire and |
| 31 | install each package into the root of the `depot_tools` repository. Afterwards, |
| 32 | the [win_tools.py](./win_tools.py) Python script is invoked to install stubs, |
| 33 | wrappers, and support scripts into `depot_tools` for end-users. |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 34 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 35 | ### Manifest |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 36 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 37 | The Git and Python versions are specified in [manifest.txt](./manifest.txt). |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 38 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 39 | There is an associated file, |
| 40 | [manifest_bleeding_edge.txt](./manifest_bleeding_edge.txt), that can be used |
| 41 | to canary new versions on select bots. Any bots with a `.bleeding_edge` file |
| 42 | in their `depot_tools` root will automatically use the bleeding edge manifest. |
| 43 | This allows opt-in systems to test against new versions of Python or Git. Once |
| 44 | those versions have been verified correct, `manifest.txt` can be updated to the |
| 45 | same specification, which will cause the remainder of systems to update. |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 46 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 47 | ### Bundles |
| 48 | |
| 49 | Git and Python bundle construction is documented in |
| 50 | [infra packaging](https://chromium.googlesource.com/infra/infra/+/master/doc/packaging/). |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 51 | |
| 52 | Note that in order for the update to take effect, `gclient` currently needs to |
| 53 | run twice. The first time it will update the `depot_tools` repo, and the second |
| 54 | time it will see the new git version and update to it. This is a bug that should |
| 55 | be fixed, in case you're reading this and this paragraph infuriates you more |
| 56 | than the rest of this README. |
| 57 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 58 | ## Testing |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 59 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 60 | After any modification to this script set, a test sequence should be run on a |
| 61 | Windows bot. |
[email protected] | 2d22423 | 2016-04-01 06:11:28 | [diff] [blame] | 62 | |
Dan Jacques | 3d9b588 | 2017-07-12 22:14:26 | [diff] [blame] | 63 | The post-processing will regenerate "python.bat" to point to the current |
| 64 | Python instance. Any previous Python installations will stick around, but |
| 65 | new invocations will use the new instance. Old installations will die |
| 66 | off either due to processes terminating or systems restarting. When this |
| 67 | happens, they will be cleaned up by the post-processing script. |
| 68 | |
| 69 | Testing |
| 70 | ======= |
| 71 | |
| 72 | For each of the following test scenarios, run these commands and verify that |
| 73 | they are working: |
| 74 | |
| 75 | ```bash |
| 76 | # Assert that `gclient` invocation will update (and do the update). |
| 77 | gclient version |
| 78 | |
| 79 | # Assert that Python fundamentally works. |
| 80 | python -c "import psutil; print dir(psutil)" |
| 81 | |
| 82 | # Assert that Python scripts work from `cmd.exe`. |
| 83 | git map-branches |
| 84 | |
| 85 | # Assert that `git bash` works. |
| 86 | git bash |
| 87 | |
| 88 | ## (Within `git bash`) assert that Python fundamentally works. |
| 89 | python -c "import psutil; print dir(psutil)" |
| 90 | ## (Within `git bash`) assert that Python scripts work. |
| 91 | git map-branches |
| 92 | ``` |
| 93 | |
| 94 | Run 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 | |
| 138 | This will take some time, but will ensure that all affected bots and users |
| 139 | should not encounter any problems due to the change. As systems and users are |
| 140 | migrated off of this implicit bootstrap, the testing procedure will become less |
| 141 | critical. |