[PATCH v2] tools: use $(PYTHON) to call cppcheck tools

Bertrand Marquis posted 1 patch 1 year, 7 months ago
Test gitlab-ci failed
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/708f00303d1c370622707866d41a868425a17324.1659527529.git.bertrand.marquis@arm.com
xen/Makefile                   | 4 ++--
xen/tools/convert_misra_doc.py | 0
2 files changed, 2 insertions(+), 2 deletions(-)
mode change 100644 => 100755 xen/tools/convert_misra_doc.py
[PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Bertrand Marquis 1 year, 7 months ago
When calling python tools to convert misra documentation or merge
cppcheck xml files, use $(PYTHON).
While there fix misra document conversion script to be executable.

Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
---
Changes in v2:
- use $(PYTHON) in Makefile to call convert misra doc script
- use $(PYTHON) in Makefile to call merge cppcheck script
- change title as mode change is only a small part
- add "fixes" for the merge change
 xen/Makefile                   | 4 ++--
 xen/tools/convert_misra_doc.py | 0
 2 files changed, 2 insertions(+), 2 deletions(-)
 mode change 100644 => 100755 xen/tools/convert_misra_doc.py

diff --git a/xen/Makefile b/xen/Makefile
index 3d926e1015..69b4dc960f 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -703,7 +703,7 @@ cmd_cppcheck_xml = $(CPPCHECK) -v -q --xml $(CPPCHECKFLAGS) \
                    --output-file=$@ $<
 
 quiet_cmd_merge_cppcheck_reports = CPPCHECK-MERGE $@
-cmd_merge_cppcheck_reports = $(srctree)/tools/merge_cppcheck_reports.py $^ $@
+cmd_merge_cppcheck_reports = $(PYTHON) $(srctree)/tools/merge_cppcheck_reports.py $^ $@
 
 quiet_cmd_cppcheck_html = CPPCHECK-HTML $<
 cmd_cppcheck_html = $(CPPCHECK_HTMLREPORT) --file=$< --source-dir=$(srctree) \
@@ -742,7 +742,7 @@ cppcheck-version:
 # cppcheck in json format including the list of rules to ignore.
 #
 cppcheck-misra.txt: $(XEN_ROOT)/docs/misra/rules.rst $(srctree)/tools/convert_misra_doc.py
-	$(Q)$(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
+	$(Q)$(PYTHON) $(srctree)/tools/convert_misra_doc.py -i $< -o $@ -j $(@:.txt=.json)
 
 # convert_misra_doc is generating both files.
 cppcheck-misra.json: cppcheck-misra.txt
diff --git a/xen/tools/convert_misra_doc.py b/xen/tools/convert_misra_doc.py
old mode 100644
new mode 100755
-- 
2.25.1
Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Jan Beulich 1 year, 7 months ago
On 03.08.2022 13:57, Bertrand Marquis wrote:
> When calling python tools to convert misra documentation or merge
> cppcheck xml files, use $(PYTHON).
> While there fix misra document conversion script to be executable.
> 
> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules

Nit: These two titles would want expressing consistently. If I
end up committing this, I'll try to remember to adjust.

> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Bertrand Marquis 1 year, 7 months ago

> On 3 Aug 2022, at 13:05, Jan Beulich <jbeulich@suse.com> wrote:
> 
> On 03.08.2022 13:57, Bertrand Marquis wrote:
>> When calling python tools to convert misra documentation or merge
>> cppcheck xml files, use $(PYTHON).
>> While there fix misra document conversion script to be executable.
>> 
>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
> 
> Nit: These two titles would want expressing consistently. If I
> end up committing this, I'll try to remember to adjust.

Right I forgot the () here.
> 
>> Signed-off-by: Bertrand Marquis <bertrand.marquis@arm.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 

Thanks

> Jan
Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Julien Grall 1 year, 7 months ago
Hi,

On 03/08/2022 13:05, Jan Beulich wrote:
> On 03.08.2022 13:57, Bertrand Marquis wrote:
>> When calling python tools to convert misra documentation or merge
>> cppcheck xml files, use $(PYTHON).
>> While there fix misra document conversion script to be executable.
>>
>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
> 
> Nit: These two titles would want expressing consistently. If I
> end up committing this, I'll try to remember to adjust.

There are actually a few issues with the Fixes tags. From the doc [1] :
   - the sha1 should be 12 characters (rather than 10)
   - the format should be:
       Fixes: <comidid> ("Commit title")

Cheers,

[1] docs/process/sending-patches.pandoc

-- 
Julien Grall
Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Bertrand Marquis 1 year, 7 months ago

> On 3 Aug 2022, at 13:10, Julien Grall <julien@xen.org> wrote:
> 
> Hi,
> 
> On 03/08/2022 13:05, Jan Beulich wrote:
>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>> When calling python tools to convert misra documentation or merge
>>> cppcheck xml files, use $(PYTHON).
>>> While there fix misra document conversion script to be executable.
>>> 
>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>> Nit: These two titles would want expressing consistently. If I
>> end up committing this, I'll try to remember to adjust.
> 
> There are actually a few issues with the Fixes tags. From the doc [1] :
>  - the sha1 should be 12 characters (rather than 10)
>  - the format should be:
>      Fixes: <comidid> ("Commit title")

You want me to resend and fix that ?

On the 12 chars one, I must admit I used git log —oneline and did not count.
Any particular reason to use 12 instead of the 10 that git log is giving ?
Should we suggest how to get this properly in a simple manner ?

Cheers
Bertrand

> 
> Cheers,
> 
> [1] docs/process/sending-patches.pandoc
> 
> -- 
> Julien Grall

Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Bertrand Marquis 1 year, 7 months ago

> On 3 Aug 2022, at 13:55, Bertrand Marquis <Bertrand.Marquis@arm.com> wrote:
> 
> 
> 
>> On 3 Aug 2022, at 13:10, Julien Grall <julien@xen.org> wrote:
>> 
>> Hi,
>> 
>> On 03/08/2022 13:05, Jan Beulich wrote:
>>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>>> When calling python tools to convert misra documentation or merge
>>>> cppcheck xml files, use $(PYTHON).
>>>> While there fix misra document conversion script to be executable.
>>>> 
>>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>>> Nit: These two titles would want expressing consistently. If I
>>> end up committing this, I'll try to remember to adjust.
>> 
>> There are actually a few issues with the Fixes tags. From the doc [1] :
>> - the sha1 should be 12 characters (rather than 10)
>> - the format should be:
>> Fixes: <comidid> ("Commit title")
> 
> You want me to resend and fix that ?
> 
> On the 12 chars one, I must admit I used git log —oneline and did not count.
> Any particular reason to use 12 instead of the 10 that git log is giving ?
> Should we suggest how to get this properly in a simple manner ?

Meaning without changing the git config :-)

Cheers
Bertrand

> 
> Cheers
> Bertrand
> 
>> 
>> Cheers,
>> 
>> [1] docs/process/sending-patches.pandoc
>> 
>> -- 
>> Julien Grall

Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Julien Grall 1 year, 7 months ago
Hi Bertrand,

On 03/08/2022 13:56, Bertrand Marquis wrote:
> 
> 
>> On 3 Aug 2022, at 13:55, Bertrand Marquis <Bertrand.Marquis@arm.com> wrote:
>>
>>
>>
>>> On 3 Aug 2022, at 13:10, Julien Grall <julien@xen.org> wrote:
>>>
>>> Hi,
>>>
>>> On 03/08/2022 13:05, Jan Beulich wrote:
>>>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>>>> When calling python tools to convert misra documentation or merge
>>>>> cppcheck xml files, use $(PYTHON).
>>>>> While there fix misra document conversion script to be executable.
>>>>>
>>>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>>>> Nit: These two titles would want expressing consistently. If I
>>>> end up committing this, I'll try to remember to adjust.
>>>
>>> There are actually a few issues with the Fixes tags. From the doc [1] :
>>> - the sha1 should be 12 characters (rather than 10)
>>> - the format should be:
>>> Fixes: <comidid> ("Commit title")
>>
>> You want me to resend and fix that ?

If Jan doesn't want to fix it on commit. Then I would be happy to do it.

>>
>> On the 12 chars one, I must admit I used git log —oneline and did not count.
>> Any particular reason to use 12 instead of the 10 that git log is giving ?

10 characters will often result to clash. 12 is known to be sufficient 
and also used by Linux.

>> Should we suggest how to get this properly in a simple manner ?
> 
> Meaning without changing the git config :-)

You could use

42sh> git log --abbrev=<N> --abbrev-commit

where N is the number of characters.

Cheers,

-- 
Julien Grall

Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Bertrand Marquis 1 year, 7 months ago

> On 3 Aug 2022, at 14:01, Julien Grall <julien@xen.org> wrote:
> 
> Hi Bertrand,
> 
> On 03/08/2022 13:56, Bertrand Marquis wrote:
>>> On 3 Aug 2022, at 13:55, Bertrand Marquis <Bertrand.Marquis@arm.com> wrote:
>>> 
>>> 
>>> 
>>>> On 3 Aug 2022, at 13:10, Julien Grall <julien@xen.org> wrote:
>>>> 
>>>> Hi,
>>>> 
>>>> On 03/08/2022 13:05, Jan Beulich wrote:
>>>>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>>>>> When calling python tools to convert misra documentation or merge
>>>>>> cppcheck xml files, use $(PYTHON).
>>>>>> While there fix misra document conversion script to be executable.
>>>>>> 
>>>>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>>>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>>>>> Nit: These two titles would want expressing consistently. If I
>>>>> end up committing this, I'll try to remember to adjust.
>>>> 
>>>> There are actually a few issues with the Fixes tags. From the doc [1] :
>>>> - the sha1 should be 12 characters (rather than 10)
>>>> - the format should be:
>>>> Fixes: <comidid> ("Commit title")
>>> 
>>> You want me to resend and fix that ?
> 
> If Jan doesn't want to fix it on commit. Then I would be happy to do it.

Thanks a lot

> 
>>> 
>>> On the 12 chars one, I must admit I used git log —oneline and did not count.
>>> Any particular reason to use 12 instead of the 10 that git log is giving ?
> 
> 10 characters will often result to clash. 12 is known to be sufficient and also used by Linux.

Ok

> 
>>> Should we suggest how to get this properly in a simple manner ?
>> Meaning without changing the git config :-)
> 
> You could use
> 
> 42sh> git log --abbrev=<N> --abbrev-commit

It might make sense to add this to the doc ?
I am happy to add this if other think it makes sense.

Cheers
Bertrand

> 
> where N is the number of characters.
> 
> Cheers,
> 
> -- 
> Julien Grall

Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Julien Grall 1 year, 7 months ago
Hi Bertrand,

On 03/08/2022 14:29, Bertrand Marquis wrote:
> 
> 
>> On 3 Aug 2022, at 14:01, Julien Grall <julien@xen.org> wrote:
>>
>> Hi Bertrand,
>>
>> On 03/08/2022 13:56, Bertrand Marquis wrote:
>>>> On 3 Aug 2022, at 13:55, Bertrand Marquis <Bertrand.Marquis@arm.com> wrote:
>>>>
>>>>
>>>>
>>>>> On 3 Aug 2022, at 13:10, Julien Grall <julien@xen.org> wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> On 03/08/2022 13:05, Jan Beulich wrote:
>>>>>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>>>>>> When calling python tools to convert misra documentation or merge
>>>>>>> cppcheck xml files, use $(PYTHON).
>>>>>>> While there fix misra document conversion script to be executable.
>>>>>>>
>>>>>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>>>>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>>>>>> Nit: These two titles would want expressing consistently. If I
>>>>>> end up committing this, I'll try to remember to adjust.
>>>>>
>>>>> There are actually a few issues with the Fixes tags. From the doc [1] :
>>>>> - the sha1 should be 12 characters (rather than 10)
>>>>> - the format should be:
>>>>> Fixes: <comidid> ("Commit title")
>>>>
>>>> You want me to resend and fix that ?
>>
>> If Jan doesn't want to fix it on commit. Then I would be happy to do it.
> 
> Thanks a lot

I have committed with the adjustments discussed.

Cheers,

-- 
Julien Grall
Re: [PATCH v2] tools: use $(PYTHON) to call cppcheck tools
Posted by Jan Beulich 1 year, 7 months ago
On 03.08.2022 14:10, Julien Grall wrote:
> On 03/08/2022 13:05, Jan Beulich wrote:
>> On 03.08.2022 13:57, Bertrand Marquis wrote:
>>> When calling python tools to convert misra documentation or merge
>>> cppcheck xml files, use $(PYTHON).
>>> While there fix misra document conversion script to be executable.
>>>
>>> Fixes: 57caa53753 (xen: Add MISRA support to cppcheck make rule)
>>> Fixes: 43aa3f6e72 xen/build: Add cppcheck and cppcheck-html make rules
>>
>> Nit: These two titles would want expressing consistently. If I
>> end up committing this, I'll try to remember to adjust.
> 
> There are actually a few issues with the Fixes tags. From the doc [1] :
>    - the sha1 should be 12 characters (rather than 10)

Oh, I didn't even pay attention to that.

>    - the format should be:
>        Fixes: <comidid> ("Commit title")

Right, this was the adjustment I was meaning to make.

Jan