summaryrefslogtreecommitdiff
path: root/tools/patman
AgeCommit message (Collapse)Author
2025-05-27patman: Provide an option to run in single-threaded modeSimon Glass
Patman normally sends multiple concurrent requests to the patchwork server, as this is faster. Provide an option to disable this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Switch over to asyncioSimon Glass
Now that all the pieces are in place, switch over from using an executor to using asyncio. While we are here, import defaultdict to avoid needing to specify its module. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use defaultdict directlySimon Glass
Import defaultdict to avoid needing to specify its module in multiple places. Fix an extra blank line while here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add more information to PatchSimon Glass
The cover letter has some information on each patch, so allow this to be stored in the Patch object. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Show patches in yellowSimon Glass
When comments are shown below patches it can be hard to see the patch subject. Use yellow instead of blue, since it stands out better. Pass the colour object into show_responses() rather than creating a new one, since that is tidier. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Simplify test_find_new_responses()Simon Glass
This test uses the find_new_responses() function which combines accessing patchwork and processing the results. Since the test is aimed at testing processing, adjust it to call process_reviews() instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Adjust how the fake request() function is providedSimon Glass
Instead of passing the URL and function to each call, put the fake into the Patchwork object instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Split out the processing of find_new_responses()Simon Glass
This function does patchwork calls and then processes the results. Move the processing out so we can (later) test it separately. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Split up check_and_show_status()Simon Glass
This function has three phases: - collecting things from patchwork - doing some processing - showing the results to the user / creating a branch Refactor into two functions so we can eventually have the patchwork part fully separated out. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Rename check_patchwork_status()Simon Glass
This function actually shows the status and does some other things. Rename it to better reflect its purpose. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add reading of series and patch statusSimon Glass
Expand the patchwork module so that it can match the current requirements of the 'patman status' command, i.e. reading the state of a series and the patches associated with it. Since the format of each patchwork response is a little tricky to understand, add examples in comments at the top of each function. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move Patch and Review to patchwork moduleSimon Glass
These relate to information obtained from the patchwork server, so move their definition into the new patchwork module. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Create a module for handling patchworkSimon Glass
At present the patchwork implementation is very simple, just consisting of a function which calls the REST API. We want to create a fake patchwork for use in tests. So start a new module to encapsulate communication with the patchwork server. Use asyncio since it is easier to handle lots of concurrent requests from different parts of the code. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27CI: Add a dependency file for patmanSimon Glass
Now that patman has an unusual dependency, add a requirements.txt file and use it in CI Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move code for sending into its own moduleSimon Glass
The control module includes much of the implementation of patman's 'send' feature. As a first step to separating this out, move the sending code into its own file. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Support extra test featuresSimon Glass
Provide support for the -X flag, which preserves the working directory used by tests. Also support -N which shows captured output for tests. Finally, allow selection of a particular test to run. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Tidy up the start-up codeSimon Glass
Much of this was written before the other Python tools and they have evolved. Make a few updates: - Rather than calling sys.exit(), return the exit code from the control module and use it in __main__ - Set up tout as it is used in some places - We now have quite a few tests, so update the comment about that Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Rename test_basic() in test_checkpatchSimon Glass
This currently has the same name as a test in func_test.py so it isn't possible to select one or the other with 'patman test test_basic': both are executed. Rename this one to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Correct a stray quoteSimon Glass
A quote character was added a few years ago, but was not intended. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27tools: Plumb in capture controlSimon Glass
Add control of capturing output into u_boot_pylib and the tools which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move capture_sys_output() into terminal and renameSimon Glass
This function is sometimes useful outside tests. Also it can affect how terminal output is done, e.g. whether ANSI characters should be emitted or not. Move it out of the test_util package and into terminal. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move all non-test logic into control moduleSimon Glass
It is easier for tests if the top-level control logic is all in one module. Create a new do_patman() function to handle this. Move the existing code into it. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-10patman: Show base commit on each patch when no cover letterSimon Glass
If a series is sent without a cover letter, there is no indication of the base commit. Add support for this, since single patches of small series may not always have a cover letter. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-04-10patman: Show the base commit and branchSimon Glass
It is helpful to know which commit patches are based on, even if that commit might not be available to readers. Add a tag for this in the cover letter. Also add the local-branch name since that may be useful to the writer. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04Merge patch series "tools: Minor clean-ups for the command library"Tom Rini
Simon Glass <sjg@chromium.org> says: This series adds comments and fixes pylint warnings in the command library. It also introduces a new, simpler way of running a single command. Link: https://lore.kernel.org/r/20250203162704.627469-1-sjg@chromium.org
2025-03-04u_boot_pylib: Add a function to run a single commandSimon Glass
Add a helper to avoid needing to use a list within a list for this simple case. Update existing users of runpipe() to use this where possible. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-03-04u_boot_pylib: Add an exception-class for errorsSimon Glass
Throwing an Exception is not very friendly since it is the top-level class of all exceptions. Declare a new class instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-21tools/patman: Don't call a non-existent suiteTom Rini
With a newer pylint we get a warning that gitutil.RunTests does not exist, so remove the line. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-02-17u_boot_pylib: Move gitutil into the librarySimon Glass
Move this file into U-Boot's Python library, so that it is no-longer part of patman. This makes a start on: https://source.denx.de/u-boot/custodians/u-boot-dm/-/issues/35 Signed-off-by: Simon Glass <sjg@chromium.org>
2025-02-14python: Create requirements.txt files for each "project"Tom Rini
Rather than have a requirements.txt file that's shared between multiple python projects within U-Boot, create one for each using "pipreqs". Signed-off-by: Tom Rini <trini@konsulko.com>
2024-09-01patman: Resolve python string vs. regex escaping syntaxBrian Norris
Python strings have their own notion of backslash-escaping, and that can conflict with the intentions for strings passed to the 're' module. In particular, I get warnings like this: tools/patman/../patman/commit.py:9: SyntaxWarning: invalid escape sequence '\s' re_subject_tag = re.compile('([^:\s]*):\s*(.*)') We should use a raw string (r'...') so that all escaping is passed into the regex module, not interpreted within the string itself. Signed-off-by: Brian Norris <computersforpeace@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-26tools: patman: fix `pip install` with Python 3.12Brandon Maier
Installing patman with `cd ./tools/patman && pip install -e .` fails with the error below. As described in the error output below, the license line is not allowed to be only defined in the setup.py. We remove the 'license' field entirely, as the Python Packaging User Guide recommends using projects classifiers instead[1] and we already set the GPL-2.0+ classifier. > $ cd ./tools/patman && pip install -e . > Obtaining file:///.../u-boot/tools/patman > Installing build dependencies ... done > Checking if build backend supports build_editable ... done > Getting requirements to build editable ... error > error: subprocess-exited-with-error > > × Getting requirements to build editable did not run successfully. > │ exit code: 1 > ╰─> [61 lines of output] > /tmp/pip-build-env-mqjvnmz8/overlay/lib/python3.12/site-packages/setuptools/config/_apply_pyprojecttoml.py:76: > _MissingDynamic: `license` defined outside of `pyproject.toml` is ignored. > !! > > ******************************************************************************** > The following seems to be defined outside of `pyproject.toml`: > > `license = 'GPL-2.0+'` > > According to the spec (see the link below), however, setuptools CANNOT > consider this value unless `license` is listed as `dynamic`. > > https://packaging.python.org/en/latest/specifications/pyproject-toml/#declaring-project-metadata-the-project-table > > To prevent this problem, you can list `license` under `dynamic` or alternatively > remove the `[project]` table from your file and rely entirely on other means of > configuration. > ******************************************************************************** > > !! [1] https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license Signed-off-by: Brandon Maier <brandon.maier@collins.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03tools: patman: fix deprecated Python ConfigParser methodsBrandon Maier
The method `ConfigParser.readfp()` is marked deprecated[1]. In Python 3.12 this method have been removed, so replace it with `ConfigParser.read_file()`. [1] https://docs.python.org/3.11/library/configparser.html#configparser.ConfigParser.readfp Signed-off-by: Brandon Maier <brandon.maier@collins.com> CC: Simon Glass <sjg@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-07-03patman: Add a tag for when a patch gets added to a seriesSean Anderson
When a patch is added to a series after the initial version, there are no changes to note except that it is new. This is typically done to suppress the "(no changes in vN)" message. It's also nice to add a change to the cover letter so reviewers know there is an additional patch. Add a tag to automate this process a bit. There are two nits with the current approach: - It favors '-' as a bullet point, but some people may prefer '*' (or something else) - Tags (e.g. 'patman: ' in 'patman: foo bar') are not stripped. They are probably just noise in most series, but they may be useful for treewide series to distinguish 'gpio: frobnicate' from 'reset: frobnicate', so I've left them in. Suggestions for the above appreciated. Suggested-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2024-07-03patman: Add Commit-cc as an alias for Patch-ccSean Anderson
Most tags referring to commits (or patches) are named Commit-something. The exception is Patch-cc. Add a Commit-cc alias so we can use whichever one is convenient. Signed-off-by: Sean Anderson <seanga2@gmail.com>
2024-07-03patman: Fix tests if add_maintainers is set to FalseSean Anderson
If add_maintainers is set to False in the user's ~/.patman config, it will cause the custom_get_maintainer_script to fail since that test expects maintainers to be added. Set add_maintainer to True in the .patman config to prevent this. Fixes: 8c042fb7f9f ("patman: add '--get-maintainer-script' argument") Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2024-03-21patman: Properly document the patchwork_url settingDouglas Anderson
The "Series-patchwork-url:" tag description says that it overrides the settings file but doesn't specify the name of the setting. Elsewhere in the documentation about the "useful" settings we see a setting that sounds promising called "patchwork_server" that's actually not a valid setting. It should be "patchwork_url". Fix these problems so the doc is right and more useful. Signed-off-by: Douglas Anderson <dianders@chromium.org>
2024-01-13doc: fix three-dash references in reStructuredTextGrzegorz Szymaszek
The "Sending patches" and "Patman patch manager" documents refer to the three-dash, "---", that separates patch parts. The symbol is written in the documentation in the same form as it is in actual patches: as three U+002D HYPHEN-MINUS characters. When building the documentation, Sphinx converts this symbol to a U+2014 EM DASH, that is invalid in this case. Make the three-dash symbol a reStructuredText inline literal to prevent its conversion; that is, enclose it in a pair of double backquotes (`). Signed-off-by: Grzegorz Szymaszek <gszymaszek@short.pl> Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
2023-12-13tools: Move python tools to version 0.0.6Simon Glass
A new release has been done with this version, so update it. Use the version numbers in dependencies also. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-13patman: Update the run scriptSimon Glass
Patman now has its main program in a function, so update the toml file to match. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-12-13doc: Update documentation URLSimon Glass
Update to use the new docs.u-boot.org URL for documentation. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-14patman: Correct Python 3.6 behaviourSimon Glass
The importlib_resources import is not actually used. Fix this so that patman can run on Python 3.6 to some extent, once 'pip3 install importlib-resources' has been run. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-14patman: Avoid using func_test at top levelSimon Glass
Import this only when it is needed, since it is not present when installed via 'pip install'. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: https://source.denx.de/u-boot/u-boot/-/issues/26
2023-11-14patman: Correct easy pylint warnings in __main__Simon Glass
Tidy up the code a little to reduce the number of pylint warnings. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-14patman: Move the main program into a functionSimon Glass
Add a new run_patman() function to hold the main logic. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-14patman: Split out arg parsing into its own fileSimon Glass
Move this code into a separate cmdline module, as is done with the other tools. Use the same HAS_TESTS check as buildman Signed-off-by: Simon Glass <sjg@chromium.org>
2023-11-02buildman: Support upstream branch name containing /Simon Glass
Buildman assumes that branch names do not have a slash in them, since slash is used to delimit remotes, etc. This means that a branch called 'WIP/tryme' in remote dm ends up being 'tryme'. Adjust the logic a little, to try to accommodate this. For now, no tests are added for this behaviour. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
2023-11-02patman: Add a 'keep_change_id' settingMaxim Cournoyer
A Change-Id can be useful for traceability purposes, and some projects may wish to have them preserved. This change makes it configurable via a new 'keep_change_id' setting. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-10-24patman: Add a little documentation on the checkpatch testsSimon Glass
These texts lack comments. Add some so that it is clearer what is going on. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-10-24checkpatch.pl: Make common.h check boarderTom Rini
At this point in time we should not add common.h to any new files, so make checkpatch.pl complain. Signed-off-by: Tom Rini <trini@konsulko.com> Signed-off-by: Simon Glass <sjg@chromium.org>