aboutsummaryrefslogtreecommitdiff
path: root/tools/patman/settings.py
Commit message (Collapse)AuthorAgeFilesLines
* patman: additionally honor a local .patman config fileMaxim Cournoyer2023-01-051-4/+20
| | | | | | | | | | 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>
* patman: fail early in Setup when provided config file does not existMaxim Cournoyer2023-01-051-1/+5
| | | | | | | | 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>
* patman: set the default config_fname argument value to NoneMaxim Cournoyer2023-01-051-4/+5
| | | | | | | | 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>
* patman: import gitutil module where it is neededMaxim Cournoyer2023-01-051-3/+5
| | | | | | | 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>
* patman: replace deprecated SafeConfigParser with ConfigParserMaxim Cournoyer2023-01-051-14/+14
| | | | | | | | 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>
* patman: fix pep8 warnings in settings moduleMaxim Cournoyer2023-01-051-17/+21
| | | | | | | | 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>
* patman: By default don't pass "--no-tree" to checkpatch for linuxDouglas Anderson2022-07-261-1/+2
| | | | | | | | | | | | | | When you pass "--no-tree" to checkpatch it disables some extra checks that are important for Linux. Specifically I want checks like: warning: DT compatible string "boogie,woogie" appears un-documented check ./Documentation/devicetree/bindings/ Let's make the default for Linux to _not_ pass --no-tree. We'll have a config option and command line flag to override. Signed-off-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Fix defaults not propagating to subparsersSean Anderson2022-06-281-1/+6
| | | | | | | | | | | | | On python 3.8.10 (and 3.10), subparsers are not updated with defaults. I suspect this is related to [1]. Fix this by explicitly updating subparsers with settings. [1] https://github.com/python/cpython/issues/89398 Fixes: 3145b63513 ("patman: Update defaults in subparsers") Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Tested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
* patman: Correct pylint errorsSimon Glass2022-03-021-2/+2
| | | | | | | Fix pylint errors that can be fixed and mask those that seem to be incorrect. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Convert camel case in gitutil.pySimon Glass2022-02-091-2/+2
| | | | | | Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Add project-default for 'gcc'Philipp Tomsich2020-12-221-1/+6
| | | | | | | | Add defaults for FSF/GNU projects, such as gcc, that provide sensible settings for those projects. Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Reviewed-by: Simon Glass <sjg@chromium.org>
* patman: Drop unicode helper functionsSimon Glass2020-12-131-3/+2
| | | | | | | We don't need these now that everything uses Python 3. Remove them and the extra code in GetBytes() and ToBytes() too. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Update defaults in subparsersSimon Glass2020-11-141-6/+22
| | | | | | | | | | | | At present values from the settings file are only applied to the main parser. With the new parser structure this means that some settings are ignored. Update the implementation to set defaults across the main parser and all subparsers. Also fix up the comments, since ArgumentParser is being used now. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Convert to ArgumentParserSimon Glass2020-07-241-4/+6
| | | | | | | Convert from OptionParser to ArgumentParser to match binman. With this we can easily add sub-commands. Signed-off-by: Simon Glass <sjg@chromium.org>
* Revert "Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm"Tom Rini2020-07-241-6/+4
| | | | | | | | | | This reverts commit 5d3a21df6694ebd66d5c34c9d62a26edc7456fc7, reversing changes made to 56d37f1c564107e27d873181d838571b7d7860e7. Unfortunately this is causing CI failures: https://travis-ci.org/github/trini/u-boot/jobs/711313649 Signed-off-by: Tom Rini <trini@konsulko.com>
* patman: Convert to ArgumentParserSimon Glass2020-07-201-4/+6
| | | | | | | Convert from OptionParser to ArgumentParser to match binman. With this we can easily add sub-commands. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Avoid importing gitutil in settingsSimon Glass2020-07-091-4/+3
| | | | | | | Pass this module in so that settings does not need to import it. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Stefan Bosch <stefan_b@posteo.net>
* patman: Move to absolute importsSimon Glass2020-04-261-3/+3
| | | | | | | | | | | At present patman sets the python path on startup so that it can access the libraries it needs. If we convert to use absolute imports this is not necessary. Move patman to use absolute imports. This requires changes in tools which use the patman libraries (which is most of them). Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Drop Python 2 StringIO codeSimon Glass2020-04-261-4/+1
| | | | | | | We can rely on Python 3 now, so drop the workaround for importing StringIO. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Drop references to __future__Simon Glass2020-04-261-2/+0
| | | | | | We don't need these now that the tools using Python 3. Drop them. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use unicode for file I/OSimon Glass2019-11-041-2/+2
| | | | | | | At present patman test fail in some environments which don't use utf-8 as the default file encoding. Add this explicitly. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Avoid unicode type in settings unit testsSimon Glass2019-07-101-8/+8
| | | | | | | | | The unicode type does not exist in Python 3 and when displaying strings they do not have the 'u' prefix. Adjusts the settings unit tests to deal with this difference, by converting the comparison value to a string, thus dropping the 'u'. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Move unicode helpers to toolsSimon Glass2019-07-101-13/+3
| | | | | | | | Create helper functions in the tools module to deal with the differences between unicode in Python 2 (where we use the 'unicode' type) and Python 3 (where we use the 'str' type). Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Use items() instead of iteritems()Simon Glass2019-07-101-1/+1
| | | | | | | Python 3 requires this, and Python 2 allows it. Convert the code over to ensure compatibility with Python 3. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Handle unicode in _ProjectConfigParser testsSimon Glass2018-10-081-7/+20
| | | | | | | | | With Python 2.7.15rc1, ConfigParser.SafeConfigParser has unfortunately started returning unicode, for unknown reasons. Adjust the code to handle this by converting everything to unicode. We cannot convert things to ASCII since email addresses may be encoded with UTF-8. Signed-off-by: Simon Glass <sjg@chromium.org>
* patman: Split alias entries on arbitrary whitespaceAdam Sampson2018-07-261-1/+1
| | | | | | | | | Previously the first three words in a git-mailrc alias entry could only be separated by spaces. git-send-email and Mutt both allow arbitrary whitespace here. Signed-off-by: Adam Sampson <ats@offog.org> Reviewed-by: Simon Glass <sjg@chromium.org>
* SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini2018-05-071-2/+1
| | | | | | | | | | | | | | | | | | | | When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
* patman: Fix error when the email blacklist is missingSimon Glass2017-09-131-3/+25
| | | | | | | | | | | | | | This section of the settings file may be missing. Handle that gracefully rather than emitting an error. Also update patman to write this section when a new settings file is created. Fixes: e11aa602 (patman: add support for omitting bouncing addresses) Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Chris Packham <judge.pckham@gmail.com> Tested-by: Bin Meng <bmeng.cn@gmail.com>
* patman: add support for omitting bouncing addressesChris Packham2017-09-111-0/+18
| | | | | | | | | | Add support for reading a list of bouncing addresses from a in-tree file (doc/bounces) and from the ~/.patman config file. These addresses are stripped from the Cc list. Signed-off-by: Chris Packham <judge.packham@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com <mailto:philipp.tomsich@theobroma-systems.com>>
* patman: Fix doctest StringIO import for python 3.xPaul Burton2016-10-091-5/+8
| | | | | | | | | In python 3.x StringIO is no longer a module, and the class can instead be found in the io module. Adjust the code in the doctest input to account for both. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Use items() to iterate over dictionariesPaul Burton2016-10-091-1/+1
| | | | | | | | | | | In python 3.x the iteritems() method has been removed from dictionaries, and the items() method does effectively the same thing. On python 2.x using items() is a little less efficient since it involves copying data, but as speed isn't a concern in this code switch to using items() anyway for simplicity. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Import 'configparser' lower case to be python 3.x safePaul Burton2016-10-091-1/+5
| | | | | | | | | In python 3.x module names used in import statements are case sensitive, and the configparser module is named in all lower-case. Import it as such in order to avoid errors when running with python 3.x. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Make print statements python 3.x safePaul Burton2016-10-091-7/+9
| | | | | | | | | In python 3.x, print must be used as a function call. Convert all print statements to the function call style, importing from __future__ where we print with no trailing newline or print to a file object. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Read in the git-mailrc alias fileSimon Glass2015-02-151-0/+27
| | | | | | | | | | | We should read this file to obtain a set of aliases. This reduces the need to create them in the ~/.patman file. This feature did exist in some version of patman, and is mentioned in the help but it did not find its way upstream. Reported-by: Graeme Russ <gruss@tss-engineering.com> Signed-off-by: Simon Glass <sjg@chromium.org>
* Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk2013-07-241-17/+1
| | | | | | Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
* patman: Add the concept of multiple projectsDoug Anderson2013-01-311-3/+144
| | | | | | | | | | | | | | There are cases that we want to support different settings (or maybe even different aliases) for different projects. Add support for this by: * Adding detection for two big projects: U-Boot and Linux. * Adding default settings for Linux (U-Boot is already good with the standard patman defaults). * Extend the new "settings" feature in .patman to specify per-project settings. Signed-off-by: Doug Anderson <dianders@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
* patman: Add support for settings in .patmanDoug Anderson2013-01-311-4/+35
| | | | | | | | | | | | | | | | | | | | | | This patch adds support for a [settings] section in the .patman file. In this section you can add settings that will affect the default values for command-line options. Support is added in a generic way such that any setting can be updated by just referring to the "dest" of the option that is passed to the option parser. At the moment options that would make sense to put in settings are "ignore_errors", "process_tags", and "verbose". You could override them like: [settings] ignore_errors: True process_tags: False verbose: True The settings functionality is also used in a future change which adds support for per-project settings. Signed-off-by: Doug Anderson <dianders@chromium.org>
* patman: Handle creation of patman config fileVikram Narayanan2012-06-191-3/+34
| | | | | | | | | | | | | patman shouts when it couldn't find a $(HOME)/.patman file. Handle it in a sane way by creating a new one for the user. It looks for a user.name and user.email in the global .gitconfig file, waits for the user input if it can't find there. Update the same in the README Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de>
* patman: Change the location of patman config fileVikram Narayanan2012-06-191-1/+1
| | | | | | | | | | Move the config file from ~/.config/patman to ~/.patman as it is more appropriate to have it there. Update the same in the README. Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Simon Glass <sjg@chromium.org>
* Add 'patman' patch generation, checking and submission scriptSimon Glass2012-04-211-0/+81
What is this? ============= This tool is a Python script which: - Creates patch directly from your branch - Cleans them up by removing unwanted tags - Inserts a cover letter with change lists - Runs the patches through checkpatch.pl and its own checks - Optionally emails them out to selected people It is intended to automate patch creation and make it a less error-prone process. It is useful for U-Boot and Linux work so far, since it uses the checkpatch.pl script. It is configured almost entirely by tags it finds in your commits. This means that you can work on a number of different branches at once, and keep the settings with each branch rather than having to git format-patch, git send-email, etc. with the correct parameters each time. So for example if you put: in one of your commits, the series will be sent there. See the README file for full details. END Signed-off-by: Simon Glass <sjg@chromium.org>