diff options
author | Trevor Woerner <twoerner@gmail.com> | 2025-09-18 17:27:27 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2025-09-22 22:09:48 +0100 |
commit | 9cfbed3d27b0671c562dfa6ef17bb8d2f9ccde49 (patch) | |
tree | 7115c57847d1fd6de24743c46d6f67eda2ed701b | |
parent | ed8544941bf47307a2e3bca39e5fa3a6a35dd447 (diff) | |
download | poky-9cfbed3d27b0671c562dfa6ef17bb8d2f9ccde49.tar.gz |
patchtest.README: expand obtaining patches
Expand the section on how to obtain patches with more methods, expanded
explanations, and detailed steps. The suggested set of methods include:
b4, git-pw, "git format-patch", and MUA programs.
(From OE-Core rev: 9779bbfc047f62adedbdb5592389668220f7080e)
Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | scripts/patchtest.README | 84 |
1 files changed, 77 insertions, 7 deletions
diff --git a/scripts/patchtest.README b/scripts/patchtest.README index bfbe29a379..b321d8e47c 100644 --- a/scripts/patchtest.README +++ b/scripts/patchtest.README | |||
@@ -5,8 +5,7 @@ | |||
5 | Patchtest is a test framework for community patches based on the standard | 5 | Patchtest is a test framework for community patches based on the standard |
6 | unittest python module. As input, it needs three elements to work properly: | 6 | unittest python module. As input, it needs three elements to work properly: |
7 | 7 | ||
8 | - a patch in mbox format (either created with `git format-patch` or fetched | 8 | - one or more patches in separate, mbox-formated files |
9 | from 'patchwork') | ||
10 | - a test suite | 9 | - a test suite |
11 | - a target repository | 10 | - a target repository |
12 | 11 | ||
@@ -94,11 +93,15 @@ cmdline): | |||
94 | 93 | ||
95 | ### Obtaining Patches | 94 | ### Obtaining Patches |
96 | 95 | ||
97 | Patch files can be obtained directly from cloned repositories using `git | 96 | Separate, mbox-formatted patch files can be obtained in a number of |
98 | format-patch -N` (where N is the number of patches starting from HEAD to | 97 | ways: |
99 | generate). git-pw can also be used with filters for users, patch/series IDs, | 98 | |
100 | and timeboxes if specific patches are desired. For more information, see the | 99 | - using b4 to obtain patches from a lore server |
101 | git-pw [documentation](https://patchwork.readthedocs.io/projects/git-pw/en/latest/). | 100 | - using git-pw to obtain patches from a patchwork server |
101 | - using "git format-patch ..." to create patches from a git | ||
102 | repository | ||
103 | - using an email program, such as mutt or thunderbird, to obtain | ||
104 | patches from a mailing list | ||
102 | 105 | ||
103 | Alternatively, `scripts/patchtest-get-series` can be used to pull mbox files from | 106 | Alternatively, `scripts/patchtest-get-series` can be used to pull mbox files from |
104 | the Patchwork instance configured previously in .gitconfig. It uses a log file | 107 | the Patchwork instance configured previously in .gitconfig. It uses a log file |
@@ -109,6 +112,73 @@ the target project, but these parameters can be configured using the `--limit`, | |||
109 | `--interval`, and `--project` arguments respectively. For more information, run | 112 | `--interval`, and `--project` arguments respectively. For more information, run |
110 | `patchtest-get-series -h`. | 113 | `patchtest-get-series -h`. |
111 | 114 | ||
115 | #### git-pw | ||
116 | |||
117 | git-pw can be used with filters for users, patch/series IDs, and | ||
118 | timeboxes if specific patches are desired. For more information, see the | ||
119 | git-pw [documentation](https://patchwork.readthedocs.io/projects/git-pw/en/latest/). | ||
120 | |||
121 | For example, to download a single patch from the Yocto Project's | ||
122 | Patchwork server (and to demonstrate not having modified ~/.gitconfig): | ||
123 | |||
124 | (patchtest.venv) $ mkdir gawk | ||
125 | (patchtest.venv) $ git-pw --server https://patchwork.yoctoproject.org/api/1.2/ --project oe-core patch download --mbox 70101 gawk/ | ||
126 | |||
127 | To download a series, for example, try: | ||
128 | |||
129 | (patchtest.venv) $ mkdir clang | ||
130 | (patchtest.venv) $ git-pw --server https://patchwork.yoctoproject.org/api/1.2 --project oe-core series download --separate 38107 clang/ | ||
131 | |||
132 | #### git format-patch | ||
133 | |||
134 | Patch files can be obtained directly from a git repository using `git | ||
135 | format-patch -N` (where N is the number of patches starting from HEAD to | ||
136 | generate) or using any other way of specifying a range of commit SHAs to | ||
137 | git. | ||
138 | |||
139 | This method would be the most likely used when testing patches in local | ||
140 | mode before emailing them for review. | ||
141 | |||
142 | #### b4 | ||
143 | |||
144 | In order to use b4, it needs to be installed. Fortunately it is a Python | ||
145 | program that is hosted on pypi and can easily be installed into the same | ||
146 | Python virtual environment that was created to run patchwork: | ||
147 | |||
148 | (patchtest.venv) $ pip install b4 | ||
149 | (patchtest.venv) $ b4 --version | ||
150 | 0.14.2 | ||
151 | |||
152 | To fetch the same single patch using b4 that was fetched with git-pw | ||
153 | earlier, use: | ||
154 | |||
155 | (patchtest.venv) $ mkdir gawk-2 | ||
156 | (patchtest.venv) $ b4 am -o gawk-2 https://lore.kernel.org/openembedded-core/20250912200740.2873851-1-Randy.MacLeod@windriver.com | ||
157 | |||
158 | Fetching a patch series with b4 is a little more involved since b4 will | ||
159 | create one mbox file with all the patches in the series in it. Given an | ||
160 | mbox file with more than one patch in it, patchtest will only test the | ||
161 | first one. So there needs to be a separate step to break apart the | ||
162 | multiple patches into separate files: | ||
163 | |||
164 | (patchtest.venv) $ mkdir clang-2 | ||
165 | (patchtest.venv) $ b4 am -o ross https://lore.kernel.org/openembedded-core/20250914133258.2625735-1-ross.burton@arm.com | ||
166 | (patchtest.venv) $ cat clang-2/v2_20250914_ross_burton_clang_improve_opt_viewer_packageconfig.mbx | formail -ds sh -c 'cat > ross/msg.$FILENO' | ||
167 | |||
168 | NOTE: the formail utility is part of the procmail package for most Linux | ||
169 | distributions. | ||
170 | |||
171 | #### mail user agents (MUA) | ||
172 | |||
173 | Most email applications have a way of saving patch emails. Details for | ||
174 | each MUA is beyond the scope of this document, but it is possible in | ||
175 | most cases. The only catch is that each patch has to be saved in mbox | ||
176 | format in its own individual file. Some client applications prefer to | ||
177 | save emails in the Maildir format, and some programs will save a set of | ||
178 | patches into one mbox file. The formail program from the procmail | ||
179 | package is useful for manipulating and converting between formats and | ||
180 | storage formats. | ||
181 | |||
112 | ### Host Mode | 182 | ### Host Mode |
113 | 183 | ||
114 | To run patchtest on the host, do the following: | 184 | To run patchtest on the host, do the following: |