aboutsummaryrefslogtreecommitdiff
path: root/tools/patman
AgeCommit message (Collapse)Author
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>
2023-09-23patman: Respect include directive on Git config lookupFei Shao
People may put their user name and email in a local config file and reference it by the include.* directives, however `git config --global` doesn't look up the included configs by default. Enable the --includes option explicitly to support such use cases. Signed-off-by: Fei Shao <fshao@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-09-23tools: Fix patman launcher script.Maxim Cournoyer
There is no "run_patman" procedure in patman's __main__.py file, which would cause the following error at execution: "AttributeError: module 'patman.__main__' has no attribute 'run_patman'" Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28tools: Fall back to importlib_resources on Python 3.6Jan Kiszka
importlib.resources became part of 3.7 only. Allow using distros with 3.6 and the importlib_resources backport. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-28patman: fix class TestFunctionalHeinrich Schuchardt
Variable orig_dir cannot be used in the finally block if it has not be assigned outside of the try block. tools/patman/func_test.py:523:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) tools/patman/func_test.py:691:21: E0601: Using variable 'orig_dir' before assignment (used-before-assignment) Fixes: fd70986a62af ("patman: Add a test that uses gitpython") Fixes: be051c0c7741 ("patman: Detect missing upstream in CountCommitsToBranch") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-04-23patman: Declare the future Series memorySimon Glass
This member is used in series.MakeCcFile() so should be declared in the Series class. Add a declaration to silence the warning. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08patman: Check patches in parallelSimon Glass
For large series this can take a while. Run checkpatch in parallel to try to reduce the time. The checkpatch information is still reported in sequential order, so a very slow patch at the start can still slow things down. But overall this gives good results. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2023-03-08patman: Run get_maintainer.pl in parallelSimon Glass
This script can take ages on some series. Try to limit the time by using threads. If a few stubborn patches remain, show progress so the user has some idea what is going on. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2023-03-08patman: Refactor MakeCcFile() into two functionsSimon Glass
This function is quite long. Moving the handling of a commit into a separate function. This will make it easier to do the work in parallel. Update function comments while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2023-03-08patman: Drop an incorrect comment about git amSimon Glass
Patman does not do this anymore, as of this commit: 7428dc14b0f ("patman: Remove the -a option") Drop the comment. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org>
2023-03-08doc: Add notes on how to install patman and binmanSimon Glass
These can be installed with 'pip' now. Add the details for those who are interested. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08patman: Add support for building a patman PyPi packageSimon Glass
Create the necessary files to build this new package. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08patman: Avoid importing test_checkpatch before it is neededSimon Glass
Tests are not packaged with patman so this file will not be accessible when installing with pip. Move the import later in the file, when we know the file is present. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08patman: Move library functions into a library directorySimon Glass
The patman directory has a number of modules which are used by other tools in U-Boot. This makes it hard to package the tools using pypi since the common files must be copied along with the tool that uses them. To address this, move these files into a new u_boot_pylib library. This can be packaged separately and listed as a dependency of each tool. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08Remove concurrencytestSimon Glass
While our version is better, it is tricky to use it when we are trying to package things with pip. Drop it. Somewhat reduced functionality is provided by the upstream version[1], along with a rather annoying message each time it is used[2] [3]. [1] pip install concurrencytest [2] https://github.com/cgoldberg/concurrencytest/issues/12 [3] https://github.com/cgoldberg/concurrencytest/pull/14 Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08Revert "patman: test_util: Print test stdout/stderr within test summaries"Simon Glass
Unfortunately this adds a new feature to concurrencytest and it has not made it upstream to the project[1]. Drop it for now so we can use the upstream module. Once it is applied we can bring this functionality back. [1] https://github.com/cgoldberg/concurrencytest This reverts commit ebcaafcded40da8ae6cb4234c2ba9901c7bee644. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14checkpatch: Add a warning for pre-schema driver model tagsSimon Glass
Help ensure that these don't creep into development by adding a check in checkpatch for them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18patman: symlink top level .checkpatch.confMaxim Cournoyer
This makes it possible to run the patman test suite simply by invoking 'pytest' from the patman sub-directory: $ cd tools/patman $ pytest Otherwise, the top level .checkpatch.conf would be ignored and multiple test_checkpatch.py tests would fail. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-18Revert "patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'"Maxim Cournoyer
This reverts commit 648d8186dd7f9c444fb07f355090d275dcdd4de4, because it broke usage of patman on Linux, whose check script doesn't know about '--strict' or '--u-boot'. Reported-by: Sjoerd Simons <sjoerd@collabora.com> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org> Tested-by: Sjoerd Simons <sjoerd@collabora.com>
2023-01-05patman: add '--get-maintainer-script' argumentMaxim Cournoyer
This makes it possible to configure a project to use some other location or script than the default scripts/get_maintainer.pl one used in the U-Boot and Linux projects. It can be configured via a .patman configuration file and accepts arguments, as documented. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2023-01-05patman: additionally honor a local .patman config fileMaxim Cournoyer
This enables versioning a project specific patman configuration file. It also makes it possible to declare the project name, which is not a useful thing to do in $HOME/.patman. A new test is added, along updated documentation. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: fail early in Setup when provided config file does not existMaxim Cournoyer
Rationale: if the user explicitly provide this argument, they probably intend for it to be used. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: set the default config_fname argument value to NoneMaxim Cournoyer
This better matches Python conventions, allowing to easily test whether the optional argument is provided. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: import gitutil module where it is neededMaxim Cournoyer
Instead of propagating it from the module entry point (main script). Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: replace deprecated SafeConfigParser with ConfigParserMaxim Cournoyer
The SafeConfigParser class has been renamed in Python 3.2 to ConfigParser, and the old alias has been deprecated since. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: fix pep8 warnings in settings moduleMaxim Cournoyer
Remove extraneous imports, variables and comply to PEP 8 maximum line width, among other PEP 8 changes suggested by Pyflake. Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: document default 'send' commandMaxim Cournoyer
Document that this command is the default and what it's intended for. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2023-01-05patman: document how to run test suite via pytestMaxim Cournoyer
Pytest offers useful features such as selecting tests by means of a regular expression, or running the pdb debugger upon encountering a test failure. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2023-01-05patman: hide the 'test' command unless test data is availableMaxim Cournoyer
Some tests would fail when the test data is not available, so it doesn't make much sense to expose the action when patman is running outside of the u-boot git checkout. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2023-01-05patman: add pytest configuration fileMaxim Cournoyer
With this change, a user can run the patman test suite using Pytest the same as when using 'patman test': $ cd tools/patman && pytest [...] 44 passed, 8 warnings in 8.87s $ ./patman test Ran 44 tests in 8.460s Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
2023-01-05patman: rename main script to __main__.pyMaxim Cournoyer
This allows running the package as a Python module, like e.g.: $ python -m patman It also prevents Pytest from attempting to parse main.py, which would cause errors. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com> Fix up main.py in __init__.py: Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-05patman: invoke the checkpatch.pl script with '--u-boot' and '--strict'Maxim Cournoyer
This resolves 10 out of 11 test failures seen when running './patman test' from the 'tools/patman' subdirectory. This was caused by the .checkpatch.conf configuration file at the root of the project not being picked up. Make the test suite of patman independent from it by always invoking the checkpatch.pl script with the minimally required arguments for the test suite to pass. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>