Commit Graph

2373 Commits

Author SHA1 Message Date
Simon Glass
dc4b2a9770 patman: Support listing comments from patchwork
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-05 09:11:31 -07:00
Simon Glass
6b3252e230 patman: Support parsing of review snippets
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-05 09:11:31 -07:00
Simon Glass
8f9ba3ab56 patman: Support updating a branch with review tags
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>
2020-11-05 09:11:31 -07:00
Simon Glass
dc6df972c9 patman: Support checking for review tags in patchwork
Before sending out a new version of a series for review, it is important
to add any review tags (e.g. Reviewed-by, Acked-by) collected by
patchwork. Otherwise people waste time reviewing the same patch
repeatedly, become frustrated and stop reviewing your patches.

To help with this, add a new 'status' subcommand that checks patchwork
for review tags, showing those which are not present in the local branch.

This allows users to see what new review tags have been received and then
add them.

Sample output:
   $ patman status
     1 Subject 1
       Reviewed-by: Joe Bloggs <joe@napierwallies.co.nz>
     2 Subject 2
       Tested-by: Lord Edmund Blackaddër <weasel@blackadder.org>
       Reviewed-by: Fred Bloggs <f.bloggs@napier.net>
     + Reviewed-by: Mary Bloggs <mary@napierwallies.co.nz>
   1 new response available in patchwork

The '+' indicates a new tag. Colours are used to make it easier to read.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
be051c0c77 patman: Detect missing upstream in CountCommitsToBranch
At present if we fail to find the upstream then the error output is piped
to wc, resulting in bogus results. Avoid the pipe and check the output
directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
b3348522b7 patman: Improve handling of files
Sometimes warnings are associated with a file and sometimes with the
patch as a whole. Update the regular expression to handle both cases,
even in emacs mode. Also add support for detecting new files.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
a12ad7c940 patman: Allow showing a Commit as a string
Use the subject of the Commit object when printing it out.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
b5e188131f patman: Don't ignore lines starting with hash
These lines can indicate a continuation of an error and should not be
ignored. Fix this.

Fixes: 666eb15e92 ("patman: Handle checkpatch output with notes and code")

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
9994baadc0 patman: Fix spelling of plural for warning
Tidy up the extra 's' when there is only a single warning. Fix the empty
print statement also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
8c17f8c5d2 patman: Convert testBasic() to use an interator
On balance it is easier to use an iterator here, particularly if we need
to insert lines due to new functionality. The only niggle is the need to
keep the previous iterator value around in one case.

Convert this test to use iter().

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
4af9987456 patman: Add some tests for warnings
Add tests that check that warnings are generated when expected.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
7457051e41 patman: Add a test for PatchStream tags
The current functional tests run most of patman. Add a smaller test that
just checks tag handling with the PatchStream class.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
47f62952cc patman: Drop unused signoff member
This is not used. Drop it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
dffa42c3ef patman: Convert 'Series-xxx' tag errors into warnings
If the Series-xxx tag is not recognised patman currently reports a fatal
error. This is inconvenient if a new feature is later added to patman that
an earlier version does not support.

Report a warning instead, to allow the user to take action if needed, but
still allow operation to proceed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
313ef5f897 patman: Attach warnings to individual patches
At present warnings are produced across the whole set of patches when
parsing them. It is more useful to associate each warning with the patch
(or commit) that generated it.

Attach warnings to the Commit object and move them out of PatchStream.
Also avoid generating duplicate warnings for the same commit.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
b5cc399053 patman: Move warning collection to a function
Add a new function in PatchStream to collect the warnings generated while
parsing the stream. This will allow us to adjust the logic, such as
dealing with per-commit warnings.

Two of the warnings are in fact internal errors, so change them to raise
and exception.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
1cb1c0fc8d patman: Fix up argument/return docs in patchstream
Add missing documentation and type information. Fix up some missing docs
on exceptions also.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
e3a816b9f4 patman: Drop unused args in patchstream
Drop a few arguments that are not used in functions.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
dd147eda10 patman: Rename variables in patchstream
Some variables are too short or shadow other variables or types. Fix these
to keep pylint3 happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
d93720e138 patman: Rename functions in patchstream
Rename these functions to lower case as per PEP8.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
5769904082 patman: Fix constant style in patchstream
These constants should use upper case. Update them to keep pylint3 happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
d06e55a7c6 patman: Fix indenting in patchstream
Update the indenting to keep pylint3 happy.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
f9e428489b patman: Allow linking a series with patchwork
Add a new Series-links tag to tell patman how to find the series in
patchwork. Each item is the series ID optionally preceded by the series
version that the link refers to. An empty version indicates this is the
latest series.

For example:

   Series-links: 209816 1:203302

Documentation is added in a later patch.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
fca99117a5 patman: Fix remaining pylint3 warnings in func_test
This fixes all but the ones about too many variables/statements.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
366954fdd7 patman: Use capture_sys_output() consistently
One test still uses its own function for capturing output. Modify it to
use the standard one in test_util

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
427b028aeb patman: Fix whitespace errors in func_test
Fix up various indentation and other minor things to make pylint3 happier.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
e21c515817 patman: Update how tests are run
The current instructions are out-of-date. Fix them.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
4a9e578138 patman: Correct operation of -n
This operation was unfortunately broken by a recent change. It is now
necessary to use -i in addition to -n, if there are errors or warnings in
the patches.

Correct this by always showing the summary information.

Fixes: f365375975 ("patman: Move main code out to a control module")
Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
08594d4986 binman: Correct calculation for image-pos
A recent change removed the base offset from the calculation. This is
used on coral to find the FSP-S binary. Fix it.

Fixes: a9fad07d4b ("binman: Avoid reporting image-pos with compression")

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Simon Glass
271a083806 binman: Update intel_ifwi to store padded section
With a recent change this entry stores only part of the section data,
leaving out the padding at the end. Fix this by using GetPaddedData() to
get the data. Add this function to the base Entry class also.

Fixes: d1d3ad7d1f ("binman: Move section padding to the parent")

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-11-05 09:11:31 -07:00
Tom Rini
2c31d7e746 Merge tag 'u-boot-rockchip-20201031' of https://gitlab.denx.de/u-boot/custodians/u-boot-rockchip
- New PX30 board: Engicam PX30.Core;
- Fix USB HID support for rock960;
- Remove host endianness dependency for rockchip mkimage;
- dts update for rk3288-tinker;
- Enable console MUX for some ROCKPi boards;
- Add config-based ddr selection for px30;
2020-10-30 23:13:13 -04:00
Samuel Holland
29ef48efe1 rockchip: mkimage: Remove host endianness dependency
The Rockchip boot ROM expects little-endian values in the image header.
When running mkimage on a big-endian machine, these values need to be
byteswapped before writing or verifying the header.

This change fixes cross-compiling U-Boot SPL for the RK3399 SoC from a
big-endian ppc64 host machine.

Signed-off-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Kever Yang<kever.yang@rock-chips.com>
2020-10-30 23:09:56 +08:00
Simon Glass
2424057b2a binman: Avoid calculated section data repeatedly
Refactor the implementation slightly so that section data is not
rebuilt when it is already available.

We still have GetData() set up to rebuild the section, since we don't
currently track when things change that might affect a section. For
example, if a blob is updated within a section, we must rebuild it.
Tracking that would be possible but is more complex, so it left for
another time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
8f5ef89f00 binman: Support compression of sections
With the previous changes, it is now possible to compress entire
sections. Add some tests to check that compression works correctly,
including updating the metadata.

Also update the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
0ff83da634 binman: Use the actual contents in CheckSize()
At present this function adds up the total size of entries to work out the
size of a section's contents. With compression this is no-longer enough.

We may as well bite the bullet and build the section contents instead.
Call _BuildSectionData() to get the (possibly compressed) contents and
GetPaddedData() to get the same but with padding added.

Note that this is inefficient since the section contents is calculated
twice. Future work will improve this.

This affects testPackOverlapMap() since the error is reported with a
different section size now (enough to hold the contents). Update that at
the same time.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
b004bf3906 binman: Update CheckEntries() for compressed sections
At present this function assumes that the size of a section is at least as
large as its contents. With compression this is often not the case. Relax
this constraint by using the uncompressed size, if available.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
0b65769c2e binman: Drop CheckEntries()
This method introduces a separation between packing and checking that is
different for sections. In order to handle compression properly, we need
to be able to deal with a section's size being smaller than the
uncompressed size of its contents. It is easier to make this work if
everything happens in the Pack() method.

The only real user of CheckEntries() is entry_Section and it can call it
directly. Drop the call from 'control' and handle it locally.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
93f3c2ea14 binman: Call CheckSize() from the section's Pack() method
At present CheckSize() is called from the function that packs the entries.
Move it up to the main Pack() function so that _PackEntries() can just
do the packing.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
601b69aa8a binman: Drop the Entry.CheckSize() method
This is only used by entry_Section and that class already calls it. Avoid
calling it twice. Also drop it from the documentation.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
c1af7a86b3 binman: Move sort and expand to the main Pack() function
At present sorting and expanding entries are side-effects of the
CheckEntries() function. This is a bit confusing, as 'checking' would
not normally involve making changes.

Move these steps into the Pack() function instead.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
6ddd61131f binman: Drop Entry.CheckOffset()
This function just calls CheckEntries() in the only non-trivial
implementation. Drop it and use CheckEntries() directly.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
a9fad07d4b binman: Avoid reporting image-pos with compression
When a section is compressed, all entries within it are grouped together
into a compressed block of data. This obscures the start of each
individual child entry.

Avoid reporting bogus 'image-pos' properties in this case, since it is
not possible to access the entry at the location provided. The entire
section must be decompressed first.

CBFS does not support compressing whole sections, only individual files,
so needs no special handling here.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
63e7ba6c18 binman: Set section contents in GetData()
Section contents is not set up when ObtainContents() is called, since
packing often changes the layout of the contents. Ensure that the contents
are correctly recorded by making this function regenerate the section. It
is normally only called by the parent section (when packing) or by the
top-level image code, when writing out the image. So the performance
impact is fairly small.

Now that sections have their contents in their 'data' property, update
testSkipAtStartSectionPad() to check it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
97c3e9a6fa binman: Store the original data before compression
When compressing an entry, the original uncompressed data is overwritten.
Store it so it is available if needed.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
7d398bb1c7 binman: Make section padding consistent with other entries
At present padding of sections is inconsistent with other entry types, in
that different pad bytes are used.

When a normal entry is padded by its parent, the parent's pad byte is
used. But for sections, the section's pad byte is used.

Adjust logic to always do this the same way.

Note there is still a special case in entry_Section.GetPaddedData() where
an image is padded with the pad byte of the top-level section. This is
necessary since otherwise there would be no way to set the pad byte of
the image, without adding a top-level section to every image.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
d1d3ad7d1f binman: Move section padding to the parent
Each section is padded up to its size, if the contents are not large
enough. Move this logic from _BuildSectionData() to
GetPaddedDataForEntry() so that all the padding is in one place.

With this, the testDual test is working again, so enable it.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
4a655c9bd7 binman: Refactor _BuildSectionData()
At present this function does the padding needed around an entry. It is
easier to understand what is going on if we have a function that returns
the contents of an entry, with padding included.

Refactor the code accordingly, adding a new GetPaddedData() method.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
17ea9f35e7 binman: Move section-building code into a function
Create a new _BuildSectionData() to hold the code that is now in
GetData(), so that it is clearly separated from entry.GetData() base
function.

Separate out the 'pad-before' processing to make this easier to
understand.

Unfortunately this breaks the testDual test. Rather than squash several
patches into an un-reviewable glob, disable the test for now.

This also affects testSkipAtStartSectionPad(), although it still not
quite what it should be. Update that temporarily for now.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
4eec34c91f binman: Expand docs and test for alignment
Alignment does form part of the entry once the image is written out, but
within binman the entry contents does not include the padding. Add
documentation to make this clear, as well as a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00
Simon Glass
f90d906a27 binman: Expand docs and test for padding
Padding becomes part of the entry once the image is written out, but
within binman the entry contents does not include the padding. Add
documentation to make this clear, as well as a test.

Signed-off-by: Simon Glass <sjg@chromium.org>
2020-10-29 14:42:59 -06:00