aboutsummaryrefslogtreecommitdiff
path: root/tools/patman
AgeCommit message (Collapse)AuthorFilesLines
2022-02-09patman: Convert camel case in tools.pySimon Glass3-39/+39
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-08patman: Update test_util to run doc testsSimon Glass2-22/+15
At present this function does not run the doctests. Allow the caller to pass these modules in as strings. Update patman to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Move compression into binmanSimon Glass1-79/+0
The compression functions are not actually used by patman, so we don't need then in the tools module. Also we want to change them to use bintools, which patman will not support. Move these into a new comp_util module, within binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25binman: Convert to using the ifwitool bintoolSimon Glass1-31/+0
Update the ifwi entry type to use this bintool, instead of running ifwitool directly. This simplifies the code and provides more consistency as well as supporting missing bintools. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25patman: Add a function to find a tool on the pathSimon Glass1-0/+23
The Run() function automatically uses the PATH variable to locate a tool when running it. Add a function that does this manually, so we don't have to run a tool to find out if it is present. This is needed by the new Bintool class, which wants to check which tools are present. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25patman: Tidy up the download function a littleSimon Glass1-6/+10
Reverse the order of the return tuple, so that the filename is first. This seems more obvious than putting the temporary directory first. Correct a bug that leaves a space on the final line. Allow the caller to control the name of the temporary directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25buildman: Move the download function to toolsSimon Glass1-0/+45
This function is handy for binman as well. Move it into the shared 'tools' module. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-25patman: Allow running a tool and returning the full resultSimon Glass1-10/+46
Add a new function which returns the entire result from running a tool, not just stdout. Update Run() to use this and to return stdout on error, if stderr is empty, since some unfortunate tools write their error output to stdout rather than stderr. Move building of the PATH to a separate function. Make the exception catching more specific, to catch just ValueError, since broad exceptions are a pain to debug. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-24patman: Update the list of modulesSimon Glass1-3/+6
Update the __init__ file to include recently added files. Add a license header while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-13patman: Support absolute and ~user-relative alias filesBrian Norris1-3/+8
Python doesn't naturally support tilde (~) as a user-home marker in paths, but git-config does. So we need to resolve it before continuing. We also shouldn't blindly join the top-level tree with the aliasesfile path, because it might be an absolute path. This resolves warnings like the following: Warning: Cannot find alias file '/path/to/source/tree/~/.git-email' Seen when git-config is like: $ git config sendemail.aliasesfile ~/.git-email Signed-off-by: Brian Norris <briannorris@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Otavio Salvador <otavio@ossystems.com.br>
2021-11-13patman: Use a ValueError exception if tools.Run() failsSimon Glass1-1/+1
The Exception base class is a very vague and could be confusing to the test system. Use the more specific ValueError exception instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-10-31patman: Add "postfix" support to patch subjectsSean Anderson5-4/+19
In some communities, it may be necessary to append something after PATCH in the subject line. For example, the Linux networking subsystem expects [1] patch subject prefixes like [RFC PATCH net-next 0/99]. This adds support for such "postfix"s to patman. Although entirely cosmetic, it is still nice to have. [1] https://www.kernel.org/doc/html/latest/networking/netdev-FAQ.html#how-do-i-indicate-which-tree-net-vs-net-next-my-patch-should-be-in Signed-off-by: Sean Anderson <sean.anderson@seco.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-10-20buildman: Detect Kconfig loopsSimon Glass2-4/+13
Hex and int Kconfig options are supposed to have defaults. This is so we can configure U-Boot without having to enter particular values for the items that don't have specific values in the board's defconfig file. If this rule is not followed, then introducing a new Kconfig can produce a loop like this: Break things (BREAK_ME) [] (NEW) Error in reading or end of file. Break things (BREAK_ME) [] (NEW) Error in reading or end of file. The continues forever since buildman passes /dev/null to 'conf', and the build system just tries again. Eventually there is so much output that buildman runs out of memory. We can detect this situation by looking for a symbol (like 'BREAK_ME') which has no default (the '[]' above) and is marked as new. If this appears multiple times in the output, we know something is wrong. Add a filter function for the output which detects this situation. Allow it to return True to terminate the process. Implement this termination in cros_subprocess. With this we get a nice message: buildman --board sandbox -T0 Building current source for 1 boards (0 threads, 32 jobs per thread) sandbox: w+ sandbox +.config:66:warning: symbol value '' invalid for BREAK_ME + +Error in reading or end of file. +make[3]: *** [scripts/kconfig/Makefile:75: syncconfig] Terminated +make[2]: *** [Makefile:569: syncconfig] Terminated +make: *** [Makefile:177: sub-make] Terminated +(** did you define an int/hex Kconfig with no default? **) Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-30WS cleanup: remove trailing white spaceWolfgang Denk1-10/+10
Signed-off-by: Wolfgang Denk <wd@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-09-24tools: Handle PAGER containing argumentsPaul Barker1-4/+6
When printing full help output from a tool, we should be able to handle a PAGER variable which includes arguments, e.g. PAGER='less -F'. Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2021-09-24tools: Refactor full help printingPaul Barker2-8/+17
Collect the code for printing the full help message of patman, buildman and binman into a single function in patman.tools. Signed-off-by: Paul Barker <paul.barker@sancloud.com>
2021-08-08patman: Avoid blank lines between tagsSimon Glass2-2/+28
In some cases 'patman status' leaves a blank line between the sign-off and the tags it collects from patchwork. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-01patman: add warning for invalid tagPatrick Delaunay2-0/+20
Add a error in patman tool when the commit message contents an invalid tag "Serie-.*" instead of "Series-.*". Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-07-21patman: Use bytearray instead of stringSimon Glass1-3/+3
If the process outputs a lot of data on stdout this can be quite slow, since the bytestring is regenerated each time. Use a bytearray instead. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-21binman: Put compressed data into separate filesSimon Glass1-2/+7
At present compression uses the same temporary file for all invocations. With multithreading this causes the data to become corrupted. Use a different filename each time. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-07-06tools: Fix default target compile tools in Python toolsAlper Nebi Yasak1-2/+0
In commit 1e4687aa47ed ("binman: Use target-specific tools when cross-compiling"), a utility function was implemented to get preferred compilation tools using environment variables like CC and CROSS_COMPILE. Although it intended to provide custom default tools (same as those in the global Makefile) when no relevant variables were set (for example using "gcc" for "cc"), it is only doing so when CROSS_COMPILE is set and returning the literal name of the tool otherwise. Remove the check for an empty CROSS_COMPILE, which makes the function use it as an empty prefix to the custom defaults and return the intended executables. Fixes: 1e4687aa47ed ("binman: Use target-specific tools when cross-compiling") Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2021-04-29patman: Parse checkpatch by message instead of by lineEvan Benn1-84/+134
Parse each empty-line-delimited message separately. This saves having to deal with all the different line content styles, we only care about the header ERROR | WARNING | NOTE... Also make checkpatch print line information for a uboot specific warning. Signed-off-by: Evan Benn <evanbenn@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-29patman: Assume we always have pygit2 for testsTom Rini1-17/+2
Given that we have tests that require pygit2 and it can be installed like any other python module, fail much more loudly if it is missing. Cc: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2021-04-12checkpatch: Add warnings for using strn(cat|cpy)Sean Anderson1-1/+13
strn(cat|cpy) has a bad habit of not nul-terminating the destination, resulting in constructions like strncpy(foo, bar, sizeof(foo) - 1); foo[sizeof(foo) - 1] = '\0'; However, it is very easy to forget about this behavior and accidentally leave a string unterminated. This has shown up in some recent coverity scans [1, 2] (including code recently touched by yours truly). Fortunately, the guys at OpenBSD came up with strl(cat|cpy), which always nul-terminate strings. These functions are already in U-Boot, so we should encourage new code to use them instead of strn(cat|cpy). [1] https://lists.denx.de/pipermail/u-boot/2021-March/442888.html [2] https://lists.denx.de/pipermail/u-boot/2021-January/438073.html Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-04-06patman: Continue on if warnings are found outside a commitSimon Glass1-2/+2
While we cannot know which commit the warning relates to, this should not be fatal. Print the warning and carry on. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-26binman: Use standard filenames for SPL/TPL devicetreeSimon Glass1-2/+6
At present, before any entry expansion is done (such as a 'files' entry expanding out to individual entries for each file it contains), we check the binman definition (i.e. '/binman' node) to find out what devicetree files are used in the images. This is a pain, since the definition may change during expansion. For example if there is no u-boot-spl-dtb entry in the definition at the start, we assume that the SPL devicetree is not used. But if an entry later expands to include this, then we don't notice. In fact the flexibility provided by the current approach of checking the definition is not really useful. We know that we can have SPL and TPL devicetrees. We know the pathname to each, so we can simply check if the files are present. If they are present, we can prepare them and update them regardless of whether they are actually used. If they are not present, we cannot prepare/update them anyway, i.e. an error will be generated. Simplify state.Prepare() so it uses a hard-coded list of devicetree files. Note that state.PrepareFromLoadedData() is left untouched, since in that case we have a complete definition from the loaded file, but cannot of course rely on the devicetree files that created it still being present. So in that case we still check the image defitions. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-22patman: Use less for help file, if availableNicolas Boichat1-0/+3
It's convenient to be able to scroll up in `patman -H`. Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-03-22patman: Quieten down the alias checkingSimon Glass4-32/+31
When a tag is used in a patch subject (e.g. "tag: rest of message") and it cannot be found as an alias, patman currently reports a fatal error, unless -t is provided, in which case it reports a warning. Experience suggest that the fatal error is not very useful. Instead, default to reporting a warning, with -t tell patman to ignore it altogether. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-22patman: Update documentation to match new usageSimon Glass1-7/+7
With the subcommands some of the documentation examples are no-longer correct. Fix all of them, so it is consistent. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-03-03fix patman --limit-cc optionBernhard Kirchen1-1/+1
patman's --limit-cc option parses its argument to an integer and uses that to trim the list of CC recipients to a particular maximum. but that only works if the cc variable is a list, which it is not. Signed-off-by: Bernhard Kirchen <bernhard.kirchen@mbconnectline.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2021-01-30patman: Correct lz4 compression parametersSimon Glass1-1/+2
At present on large files, lz4 uses a larger block size (e.g. 256KB) than the 64KB supported by the U-Boot decompression implementation. Also it is optimised for maximum compression speed, producing larger output than we would like. Update the parameters to correct these problems. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-01-05Merge tag 'dm-pull-5jan21' of git://git.denx.de/u-boot-dm into nextWIP/05Jan2021-nextTom Rini1-0/+8
Driver model: make some udevice fields private Driver model: Rename U_BOOT_DEVICE et al. dtoc: Tidy up and add more tests ns16550 code clean-up x86 and sandbox minor fixes for of-platdata dtoc prepration for adding build-time instantiation
2021-01-05Merge tag 'v2021.01-rc5' into nextTom Rini1-0/+1
Prepare v2021.01-rc5 Signed-off-by: Tom Rini <trini@konsulko.com>
2021-01-05dtoc: Add an 'all' commandSimon Glass1-0/+8
With upcoming changes, dtoc will output several files for different of-platdata components. Add a way to output all ava!ilable files at once ('all'), to the appropriate directories, without needing to specify each one invidually. This puts the commands in alphabetical order, so update the tests accordingly. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-22patman: Add project-default for 'gcc'Philipp Tomsich1-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>
2020-12-22patman: Add --no-signoff to suppress adding signoffsPhilipp Tomsich4-8/+12
To enable use of patman with FSF/GNU projects, such as GCC or Binutils, no Signed-off-by may be added. This adds a command line flag '--no-signoff' to suppress adding signoffs in patman when processing commits. Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu> Reviewed-by: Simon Glass <sjg@chromium.org> Fix patman testBranch() test: Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13checkpatch: Add warnings for unexpected struct namesSimon Glass1-0/+28
As a way of keeping the driver declarations more consistent, add a warning if the struct used does not end with _priv or _plat. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13patman: Drop tools.ToChar() and ToChars()Simon Glass1-23/+0
This is useful anymore, since we always want to call chr() in Python 3. Drop it and adjust callers to use chr(). Also drop ToChars() which is no-longer used. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13patman: Drop tools.ToByte()Simon Glass1-15/+0
This is not needed in Python 3. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-12-13patman: Drop unicode helper functionsSimon Glass5-59/+13
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>
2020-11-30binman: Handle tool paths containing '~' correctlySimon Glass1-0/+1
At present if CROSS_COMPILE contains a tilde, such as ~/.buildman-toolchains/gcc-7.3.0-nolibc/i386-linux/bin/i386-linux-gcc then binman gives a confusing error: binman: Error 255 running '~/..buildman-toolchains/gcc-7.3.0- ... Fix this by expanding it out before running the tool. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-14patman: Add a Series-patchwork-url optionSimon Glass3-2/+13
Add a commit tag to allow the Patchwork URL to be specified in a commit. This can be handy for when you submit code to multiple projects but don't want to use the -p option. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-14patman: Add a setting for the Patchwork URLSimon Glass2-2/+5
Add an argument to allow specifying the the patchwork URL. This also adds this feature to the settings file, either globally, or on a per-project basis. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-14patman: Allow specifying the patchwork URLSimon Glass4-27/+48
Add a new argument to allow the URL of the patchwork server to be speciified. For now this is hard-coded in the main file, but future patches will move it to the settings file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-14patman: Update defaults in subparsersSimon Glass1-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>
2020-11-14patman: Correct Change-Ids error message argsSimon Glass1-2/+2
The arguments of this error are incorrectly formatted. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-14patman: Refactor how the default subcommand worksSimon Glass3-33/+38
At present patman tries to assume a default subcommand of 'send', to maintain backwards compatibility. However it does not cope with arguments added to the default command, so for example 'patman -t' does not work. Update the logic to handle this. Also update the CC command to use 'send' explicitly, since otherwise patman gets confused with the patch-filename argument. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05patman: Support listing comments from patchworkSimon Glass6-36/+268
While reviewing feedback it is helpful to see the review comments on the command line to check that each has been addressed. Add an option to support that. Update the workflow documentation to describe the new features. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05patman: Support parsing of review snippetsSimon Glass2-0/+168
Add support for parsing the contents of a patchwork 'patch' web page containing comments received from reviewers. This allows patman to show these comments in a simple 'snippets' format. A snippet is some quoted code plus some unquoted comments below it. Each review is from a unique person/email and can produce multiple snippets, one for each part of the code that attracts a comment. Show the file and line-number info at the top of each snippet if available. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05patman: Support updating a branch with review tagsSimon Glass6-16/+289
It is tedious to add review tags into the local branch and errors can sometimes be made. Add an option to create a new branch with the review tags obtained from patchwork. Signed-off-by: Simon Glass <sjg@chromium.org>