summaryrefslogtreecommitdiff
path: root/tools/patman
AgeCommit message (Collapse)Author
13 dayspatman: Update test for Anatolij's new email addressTom Rini
This test was failing due to matching on Anatolij's old email address. Switch to the new one. Signed-off-by: Tom Rini <trini@konsulko.com>
2025-07-18python: requirements.txt: Update a few modules for security issuesTom Rini
The GitHub dependabot tool has reported a number of issues recently with some modules that we use. While unlikely to be exploitable in the way we use them, update various libraries to the latest. Reported-by: GitHub dependabot Signed-off-by: Tom Rini <trini@konsulko.com>
2025-05-27patman: Add basic documentation for new featuresSimon Glass
Describe the new subcommands and how they should be used in a normal workflow. Note that the naming of branches is very rigid, or 'opinionated' in marketing terms. Patman can track a single branch for each version of a series and they must all be named the same, except for the version-number suffix. Version 1 series have no suffix. This description is fairly bare-bones but should be enough for some initial testing and comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add tests for CseriesSimon Glass
Add various tests for the Cseries functionality, including both direct and via-cmdline variants. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Implement the upstream subcommandSimon Glass
Add a command to allow managing the upstream tree. This is very basic so far, only allowing setting the name and URL. Further work may allow checking whether series apply cleaning on the upstream tree, etc. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Implement the series subcommandSimon Glass
Add a command to support management of series. These are local branches which may have been sent to the mailing list, so may appear on the patchwork server. The new functionality uses a database, stored in a local file. Various operations are supported: - add a new series - send a series and automatically link it with patchwork - 'increment' the version, to prepare to send an updated series - gather review/test tags from patchwork - check on progress, i.e. patches which are received new tags or comments - show comments on patches and cover letters Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Update send function to return whether it sentSimon Glass
Indicate whether 'git send-email' was actually called, so that we don't bother waiting for patchwork to receive our series if it wasn't. The 'git send-email' seems to always return a code of 0 even if nothing was sent, so we cannot use clues there. Ideally we would watch the output to determine which patches were sent and which not, but that is left for another day. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Support aliases for commands and subcommandsSimon Glass
It is laborious to type long commands, so add some aliases to speed up use of patman. For now, allow 'pw' for patchwork and 'st' for status. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Implement the patchwork subcommandSimon Glass
Add a command to allow setting and getting the patchwork project. This is needed so that patman can use the correct ID when talking to the patchwork server. To support testing, allow passing in the test database, patchwork object and Cseries object. Fake versions can then easily be provided for certain test cases. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Improve Series support for patchwork linksSimon Glass
Update Series with a way to better manage the Series-links lines in patches. Use this in the 'status' subcommand instead of the existing primitive method of expecting a link without a version prefix. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Introduce basic database support in SeriesSimon Glass
This class manages a series, i.e. a group of patches with a possible cover letter. Add some properties for recording basic patchwork info, including the database ID. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Support returning the parsers to useSimon Glass
The parsing tests need to be able to try invalid arguments to make sure that these are handled correctly. Provide a way to return the parsers being used, as well as to pass in the parsers to use. This feature is needed in test_series_no_subcmd(), for example. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use -c to show patch commentsSimon Glass
We chose -C as the flag to enable showing comments because -c was used in 'patman send' to specify the patch count. Now that the 'send' parser is separated we don't need to do this and it is OK to use the same flag in a different subcommand. We want to have a flag for cover-letter comments, so it makes most sense to have -C for that and -c for patch comments. Update the latter. Put this in a function since the new 'series' command will add this flag too. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Enhance implementation of file-based defaultsSimon Glass
Patman allows defaults for its command-line flags to be read from a file. The implementation of this does not fully work with subcommands, since we don't want a default for those. Also, it relies on being able to parse any sort of cmdline in order to figure out the options that are available. But in some cases, the cmdline may not parse, e.g. if there are required options, or conflicting options. Add a class which can be safely used to parse any cmdline, since it allows execution to continue even when errors are obtained. Use this to determine the defaults, being careful to skip sub/commands. Another way to handle all of this would be to maintain the defaults separately and insert them into the parser manually. For now, I'm not sure which is best. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Enhance patchwork interface to support CseriesSimon Glass
Add various new requests to the Patchwork class, so we can obtain the required information. This includes cover letters and comments. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Update status command support cover-letter infoSimon Glass
Add support to the status module for reading and supporting cover letters, including comments. Plumb this through to the patchwork module. The actual support in the latter is not yet integrated. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add a Cseries classSimon Glass
This is the main class for dealing with series, across branches and the database. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add a helper for managing cseriesSimon Glass
Add a module which includes helper functions for dealing with Cseries objects. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add a simple database implementationSimon Glass
For recording series information, patman needs a database. Add a module which uses sqlite3 for this. It has a basic schema, enough to support a series subcommand. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Avoid touching the system or local configSimon Glass
Set the git variables to ensure that any local gitconfig is not used or affected by the tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add a fourth series for testingSimon Glass
Create one more series to use for testing. This one has four separate patches. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move common test code into a new moduleSimon Glass
The func_test file is quite large. In order to allow new tests to be added to a separate file, move the common test code into a separate class, to be inherited by other classes. Drop unnecessary imports in func_test Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add a test for collecting a PATCH prefixSimon Glass
Add one more test for completeness, since this occurs commonly. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use python3 with /usr/bin/envSimon Glass
If python2 is available then we must specify python3 here. Update the test to handle this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Deal with git safe-directory warningSimon Glass
When running tests where the .git directory is not owned by the current user, various warnings are produced and the tests fail. This happens in CI. For patman itself, modify the gitutil.get_top_level() function to return None in this case. Ensure that the warning is not shown, since it creates about 1000 lines of output. For checkpatch, the same warning is produced even though --no-tree is given. Suppress that as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Support collecting all lines in the commit messageSimon Glass
In some cases we want to collect all lines in the commit message so that the commit can be recreated with the same message as before, or perhaps with light filtering. Add support for this. Series-to: u-boot Cover-letter: patman: Minor improvements to prepare for series handling This series includes a number of internal improvements to patman: - Tidy-up of parsing - Adjust how tests create the git tree - Support for creating patches in a different git directory - Faster determination of the upstream branch - Ability to collect the body of a commit message as a series of lines END Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Tidy up function comments in the series moduleSimon Glass
This module is missing some comments, so add them. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move -H out of the send commandSimon Glass
This is the help for the whole of patman, so move it to the start of the control function, rather than being inside 'patman send'. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Move arguments for sent into the correct parserSimon Glass
Most of the arguments for the main parser are actually arguments for the 'send' parser. Move them there, in a separate function. Fix a pylint warning for -D and the imports while here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Split subparsers into their own functionsSimon Glass
Simplify the main parser by moving subparser code into separate functions. Fix a few pylint warnings while here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add tests for helpSimon Glass
Add a few tests to make sure that help is provided when requested. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Split parser creation from parsingSimon Glass
Tests may want to parse their own arguments. Refactor the parser code to support this and allow settings to receive arguments as well. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Correct some pylint and asyncio issuesSimon Glass
Correct some pylint warnings in this file. Make use of the existing asyncio event loop, instead of creating a new one, since this also destroys it afterwards, making it unavailable for tests which want to share an event loop. Use tools.write_file() to avoid a warning about encoding. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use git to set up the test configSimon Glass
At present the branch information is dropped when writing the configuration. It is easier to get git to set up the config anyway, so update the test to do this. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Clean up creation of the git treeSimon Glass
The test starts with the HEAD pointing to the wrong place, so that the created files appear to be deleted. Fix this by resetting the tree before tests start. Add a check that the tree is clean. Update pygit2 so that the enums are available.
2025-05-27patman: Use variables for series ID and titleSimon Glass
Rather than hard-coding these values in the sample patches, use variables so that we can refer to these in tests. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use .git as the git directorySimon Glass
In tests, the 'git' directory is a subdirectory of the temporary directory. Rename it to '.git' so that git will automatically find it when git operations are done in the temporary directory. Set up the config before the first git operation, so that this works correctly. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use itr instead of lines for iteratorSimon Glass
The variables 'lines' is used to hold a list of output lines within a test, but also to hold an iterator through those lines. Use 'itr' for the latter, to avoid confusion. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Correct use of str in codeSimon Glass
Since str() is a reserved function we should not use it as a variable. Fix this in the send module. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Allow setting a git directory when sendingSimon Glass
Support specifying the git-directory when creating and sending patches. This will allow better testing of this functionality, since we can use a test directory. For count_commits_to_branch() support an end commit while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Allow setting the current directory when sendingSimon Glass
Plumb a current-working-directory (cwd) through from send all the way to the command gitutil libraries. This will allow better testing of this functionality, since we can use a test directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Add all files to __init__.pySimon Glass
Some files are missing from the __all__ list, so add then. Reformat the list to use more of the width of each line. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27u_boot_pylib: Tidy up quoting of cc and toSimon Glass
The current approach to calling 'git send-email' puts double quotes around each email address to ensure that it will pass the shell correctly. This is a bit cumbersome and requires using a shell to sort it all out. Drop the quotes and use command.run() instead, to simplify things. This will also make it possible to (later) set the current directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Update Series.ShowActions() to pass aliasSimon Glass
Instead of using settings.alias pass this value in. This allows tests to work without using settings.alias Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Pass aliases to Series.MakeCcFile()Simon Glass
Rather than accessing settings directly, pass the aliases in, so that we can do the same from tests. With further work this will allow the tests to work without using settings.alias Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Pass the alias dict into gitutil.email_patches()Simon Glass
Rather than accessing the settings module in this function, require the alias dict to be passed in. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Pass the alias dict into gitutil.build_email_list()Simon Glass
Rather than accessing the settings module in this function, require the alias dict to be passed in. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Untangle settings from gitutilSimon Glass
The gitutil module is supposed to be independent from patman but one piece was missed in the series which separated them. Move the settings setup out of gitutil Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Drop the old status codeSimon Glass
Now that we have the new asyncio implementation, drop the unused ThreadPoolExecutor code. Signed-off-by: Simon Glass <sjg@chromium.org>
2025-05-27patman: Use a pager when outputting statusSimon Glass
The pager makes it easier to review large number of comments. Add it around the output. 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>