aboutsummaryrefslogtreecommitdiff
path: root/llvm_tools/README.md
blob: 2aab1ec0dd9d1beb23cc38d7ce3acfe02c799e71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
# LLVM Tools

## Overview

These scripts helps automate tasks such as updating the LLVM next hash,
determing whether a new patch applies correctly, and patch management.

In addition, there are scripts that automate the process of retrieving the
git hash of LLVM from either google3, top of trunk, or for a specific SVN
version.

**NOTE: All scripts must must be run outside the chroot**

**NOTE: sudo must be permissive (i.e. **`cros_sdk`** should NOT prompt for a
password)**

## `update_packages_and_run_tryjobs.py`

### Usage

This script is used for updating a package's `LLVM_NEXT_HASH` (sys-devel/llvm,
sys-libs/compiler-rt, sys-libs/libcxx, sys-libs/libcxxabi, and
sys-libs/llvm-libunwind) and then run tryjobs after updating the git hash.

An example when this script should be run is when certain boards would like
to be tested with the updated `LLVM_NEXT_HASH`.

For example:

```
python update_packages_and_run_tryjobs.py --llvm_version tot --options
nochromesdk --builders kevin-release-tryjob nocturne-release-tryjob
```

The above example would update the packages' `LLVM_NEXT_HASH` to the top of
trunk's git hash and would submit tryjobs for kevin and nocturne boards.

For help with the command line arguments of the script, run:

```
python update_packages_and_run_tryjobs.py --help
```

## `update_chromeos_llvm_next_hash.py`

### Usage

This script is used for updating a package's/packages' `LLVM_NEXT_HASH` and
creating a change list of those changes which will uploaded for review. For
example, some changes that would be included in the change list are
the updated ebuilds, changes made to the patches of the updated packages such
as being removed or an updated patch metadata file. These changes are determined
by the `--failure_mode` option.

An example where this script would be used is when multiple packages need to
have their `LLVM_NEXT_HASH` updated.

For example:

```
python update_chromeos_llvm_next_hash.py --update_packages sys-devel/llvm
sys-libs/compiler-rt --llvm_version google3 --failure_mode disable_patches
```

The example above would update sys-devel/llvm and sys-libs/compiler-rt
`LLVM_NEXT_HASH` to the latest google3's git hash of LLVM. And the change list
may include patches that were disabled for either sys-devel/llvm or
sys-libs/compiler-rt.

For help with the command line arguments of the script, run:

```
python update_chromeos_llvm_next.py --help
```

## `llvm_patch_management.py`

### Usage

This script is used to test whether a newly added patch in a package's patch
metadata file would apply successfully. The script is also used to make sure
the patches of a package applied successfully, failed, etc., depending on the
failure mode specified.

An example of using this script is when multiple packages would like to be
tested when a new patch was added to their patch metadata file.

For example:

```
python llvm_patch_management.py --packages sys-devel/llvm sys-libs/compiler-rt
--failure_mode continue
```

The above example tests sys-devel/llvm and sys-libs/compiler-rt patch metadata
file with the failure mode `continue`.

For help with the command line arguments of the script, run:

```
python llvm_patch_management.py --help
```

## `patch_manager.py`

### Usage

This script is used when when all the command line arguments are known such as
testing a specific metadata file or a specific source tree.

For help with the command line arguments of the script, run:

```
python patch_manager.py --help
```

## Other Helpful Scripts

### `get_google3_llvm_version.py`

#### Usage

This script has a class that deals with retrieving the latest google3 LLVM
version.

For example, to retrieve the latest google3 LLVM version:

```
from get_google3_llvm_version import LLVMVersion

LLVMVersion().GetGoogle3LLVMVersion()
```

### `get_llvm_hash.py`

#### Usage

The script has a class that deals with retrieving either the top of trunk git
hash of LLVM, the git hash of google3, or a specific git hash of a SVN version.
It also has other functions when dealing with a git hash of LLVM.

For example, to retrieve the top of trunk git hash of LLVM:

```
from get_llvm_hash import LLVMHash

LLVMHash().GetTopOfTrunkGitHash()
```

For example, to retrieve the git hash of google3:

```
from get_llvm_hash import LLVMHash

LLVMHash().GetGoogle3LLVMHash()
```

For example, to retrieve the git hash of a specific SVN version:

```
from get_llvm_hash import LLVMHash

LLVMHash().GetLLVMHash(<svn_version>)
```

For example, to retrieve the commit message of a git hash of LLVM:

```
from get_llvm_hash import LLVMHash

LLVMHash.GetCommitMessageForHash(<git_hash>)
```