All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] checkpatch: Fix spdxcheck.py
@ 2019-05-22 13:27 Vincenzo Frascino
  2019-05-22 13:48 ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Vincenzo Frascino @ 2019-05-22 13:27 UTC (permalink / raw)
  To: linux-arch; +Cc: akpm, tglx, jcline, vincenzo.frascino

The LICENSE directory has recently changed structure and this makes
spdxcheck fails as per below:

FAIL: "Blob or Tree named 'other' not found"
Traceback (most recent call last):
  File "scripts/spdxcheck.py", line 240, in <module>
spdx = read_spdxdata(repo)
  File "scripts/spdxcheck.py", line 41, in read_spdxdata
for el in lictree[d].traverse():
[...]
KeyError: "Blob or Tree named 'other' not found"

Fix the script to restore the correctness on checkpatch License
checking.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jeremy Cline <jcline@redhat.com>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
---
 scripts/spdxcheck.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 4fe392e507fb..6374e078a5f2 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -32,7 +32,8 @@ class SPDXdata(object):
 def read_spdxdata(repo):
 
     # The subdirectories of LICENSES in the kernel source
-    license_dirs = [ "preferred", "other", "exceptions" ]
+    # Note: exceptions needs to be parsed as last directory.
+    license_dirs = [ "preferred", "dual", "deprecated", "exceptions" ]
     lictree = repo.head.commit.tree['LICENSES']
 
     spdx = SPDXdata()
@@ -58,13 +59,13 @@ def read_spdxdata(repo):
                 elif l.startswith('SPDX-Licenses:'):
                     for lic in l.split(':')[1].upper().strip().replace(' ', '').replace('\t', '').split(','):
                         if not lic in spdx.licenses:
-                            raise SPDXException(None, 'Exception %s missing license %s' %(ex, lic))
+                            raise SPDXException(None, 'Exception %s missing license %s' %(exception, lic))
                         spdx.exceptions[exception].append(lic)
 
                 elif l.startswith("License-Text:"):
                     if exception:
                         if not len(spdx.exceptions[exception]):
-                            raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %excid)
+                            raise SPDXException(el, 'Exception %s is missing SPDX-Licenses' %exception)
                         spdx.exception_files += 1
                     else:
                         spdx.license_files += 1
-- 
2.21.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: Fix spdxcheck.py
  2019-05-22 13:27 [PATCH] checkpatch: Fix spdxcheck.py Vincenzo Frascino
@ 2019-05-22 13:48 ` Geert Uytterhoeven
  2019-05-22 14:32   ` Vincenzo Frascino
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-05-22 13:48 UTC (permalink / raw)
  To: Vincenzo Frascino; +Cc: Linux-Arch, Andrew Morton, Thomas Gleixner, jcline

Hi Vincenzo,

On Wed, May 22, 2019 at 3:28 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
> The LICENSE directory has recently changed structure and this makes
> spdxcheck fails as per below:
>
> FAIL: "Blob or Tree named 'other' not found"
> Traceback (most recent call last):
>   File "scripts/spdxcheck.py", line 240, in <module>
> spdx = read_spdxdata(repo)
>   File "scripts/spdxcheck.py", line 41, in read_spdxdata
> for el in lictree[d].traverse():
> [...]
> KeyError: "Blob or Tree named 'other' not found"
>
> Fix the script to restore the correctness on checkpatch License
> checking.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Jeremy Cline <jcline@redhat.com>
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>

Thanks for your patch!

Looks the issue is already fixed in linux-next:
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/scripts/spdxcheck.py

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: Fix spdxcheck.py
  2019-05-22 13:48 ` Geert Uytterhoeven
@ 2019-05-22 14:32   ` Vincenzo Frascino
  2019-05-22 15:07     ` Geert Uytterhoeven
  0 siblings, 1 reply; 5+ messages in thread
From: Vincenzo Frascino @ 2019-05-22 14:32 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux-Arch, Andrew Morton, Thomas Gleixner, jcline

Hi Geert,

On 22/05/2019 14:48, Geert Uytterhoeven wrote:
> Hi Vincenzo,
> 
> On Wed, May 22, 2019 at 3:28 PM Vincenzo Frascino
> <vincenzo.frascino@arm.com> wrote:
>> The LICENSE directory has recently changed structure and this makes
>> spdxcheck fails as per below:
>>
>> FAIL: "Blob or Tree named 'other' not found"
>> Traceback (most recent call last):
>>   File "scripts/spdxcheck.py", line 240, in <module>
>> spdx = read_spdxdata(repo)
>>   File "scripts/spdxcheck.py", line 41, in read_spdxdata
>> for el in lictree[d].traverse():
>> [...]
>> KeyError: "Blob or Tree named 'other' not found"
>>
>> Fix the script to restore the correctness on checkpatch License
>> checking.
>>
>> Cc: Andrew Morton <akpm@linux-foundation.org>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Jeremy Cline <jcline@redhat.com>
>> Cc: linux-kernel@vger.kernel.org
>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> 
> Thanks for your patch!
> 
> Looks the issue is already fixed in linux-next:
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/scripts/spdxcheck.py
> 

Thank you for pointing this out, I missed it.

I had a look at the patch in linux-next and seems that the problem is not
completely solved by the patch you are referring to, in fact:
 - For how the code it is written, exceptions directory needs to be parsed as
   last. The only reason why it seems ok at the moment in linux-next it is
   because there is no "dual" license appears in SPDX-Licenses field of any
   "exception". A simple test that consists in adding Apache-2.0 to the SPDX-
   Licenses of Linux-syscall-note generates still an exception.
 - The SPDXException calls in the case of "SPDX-Licenses" and "License-Text" use
   undefined parameters.

My patch addresses both the issues, if it helps, I can rebase it on linux-next.

Please let me know.


> Gr{oetje,eeting}s,
> 
>                         Geert
> 

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: Fix spdxcheck.py
  2019-05-22 14:32   ` Vincenzo Frascino
@ 2019-05-22 15:07     ` Geert Uytterhoeven
  2019-05-22 15:19       ` Vincenzo Frascino
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2019-05-22 15:07 UTC (permalink / raw)
  To: Vincenzo Frascino; +Cc: Linux-Arch, Andrew Morton, Thomas Gleixner, jcline

Hi Vincenzo,

On Wed, May 22, 2019 at 4:32 PM Vincenzo Frascino
<vincenzo.frascino@arm.com> wrote:
> On 22/05/2019 14:48, Geert Uytterhoeven wrote:
> > On Wed, May 22, 2019 at 3:28 PM Vincenzo Frascino
> > <vincenzo.frascino@arm.com> wrote:
> >> The LICENSE directory has recently changed structure and this makes
> >> spdxcheck fails as per below:
> >>
> >> FAIL: "Blob or Tree named 'other' not found"
> >> Traceback (most recent call last):
> >>   File "scripts/spdxcheck.py", line 240, in <module>
> >> spdx = read_spdxdata(repo)
> >>   File "scripts/spdxcheck.py", line 41, in read_spdxdata
> >> for el in lictree[d].traverse():
> >> [...]
> >> KeyError: "Blob or Tree named 'other' not found"
> >>
> >> Fix the script to restore the correctness on checkpatch License
> >> checking.
> >>
> >> Cc: Andrew Morton <akpm@linux-foundation.org>
> >> Cc: Thomas Gleixner <tglx@linutronix.de>
> >> Cc: Jeremy Cline <jcline@redhat.com>
> >> Cc: linux-kernel@vger.kernel.org
> >> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
> >
> > Thanks for your patch!
> >
> > Looks the issue is already fixed in linux-next:
> > https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/scripts/spdxcheck.py
> >
>
> Thank you for pointing this out, I missed it.
>
> I had a look at the patch in linux-next and seems that the problem is not
> completely solved by the patch you are referring to, in fact:
>  - For how the code it is written, exceptions directory needs to be parsed as
>    last. The only reason why it seems ok at the moment in linux-next it is
>    because there is no "dual" license appears in SPDX-Licenses field of any
>    "exception". A simple test that consists in adding Apache-2.0 to the SPDX-
>    Licenses of Linux-syscall-note generates still an exception.
>  - The SPDXException calls in the case of "SPDX-Licenses" and "License-Text" use
>    undefined parameters.
>
> My patch addresses both the issues, if it helps, I can rebase it on linux-next.
>
> Please let me know.

Rebasing against linux-next is the right thing to do.
Thanks!

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] checkpatch: Fix spdxcheck.py
  2019-05-22 15:07     ` Geert Uytterhoeven
@ 2019-05-22 15:19       ` Vincenzo Frascino
  0 siblings, 0 replies; 5+ messages in thread
From: Vincenzo Frascino @ 2019-05-22 15:19 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: Linux-Arch, Andrew Morton, Thomas Gleixner, jcline

Hi Geert,

On 22/05/2019 16:07, Geert Uytterhoeven wrote:
> Hi Vincenzo,
> 
> On Wed, May 22, 2019 at 4:32 PM Vincenzo Frascino
> <vincenzo.frascino@arm.com> wrote:
>> On 22/05/2019 14:48, Geert Uytterhoeven wrote:
>>> On Wed, May 22, 2019 at 3:28 PM Vincenzo Frascino
>>> <vincenzo.frascino@arm.com> wrote:
>>>> The LICENSE directory has recently changed structure and this makes
>>>> spdxcheck fails as per below:
>>>>
>>>> FAIL: "Blob or Tree named 'other' not found"
>>>> Traceback (most recent call last):
>>>>   File "scripts/spdxcheck.py", line 240, in <module>
>>>> spdx = read_spdxdata(repo)
>>>>   File "scripts/spdxcheck.py", line 41, in read_spdxdata
>>>> for el in lictree[d].traverse():
>>>> [...]
>>>> KeyError: "Blob or Tree named 'other' not found"
>>>>
>>>> Fix the script to restore the correctness on checkpatch License
>>>> checking.
>>>>
>>>> Cc: Andrew Morton <akpm@linux-foundation.org>
>>>> Cc: Thomas Gleixner <tglx@linutronix.de>
>>>> Cc: Jeremy Cline <jcline@redhat.com>
>>>> Cc: linux-kernel@vger.kernel.org
>>>> Signed-off-by: Vincenzo Frascino <vincenzo.frascino@arm.com>
>>>
>>> Thanks for your patch!
>>>
>>> Looks the issue is already fixed in linux-next:
>>> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/scripts/spdxcheck.py
>>>
>>
>> Thank you for pointing this out, I missed it.
>>
>> I had a look at the patch in linux-next and seems that the problem is not
>> completely solved by the patch you are referring to, in fact:
>>  - For how the code it is written, exceptions directory needs to be parsed as
>>    last. The only reason why it seems ok at the moment in linux-next it is
>>    because there is no "dual" license appears in SPDX-Licenses field of any
>>    "exception". A simple test that consists in adding Apache-2.0 to the SPDX-
>>    Licenses of Linux-syscall-note generates still an exception.
>>  - The SPDXException calls in the case of "SPDX-Licenses" and "License-Text" use
>>    undefined parameters.
>>
>> My patch addresses both the issues, if it helps, I can rebase it on linux-next.
>>
>> Please let me know.
> 
> Rebasing against linux-next is the right thing to do.
> Thanks!
> 

Done! I put you in Cc of the v2 of this patch.

Please let me know if I can do anything else.

> Gr{oetje,eeting}s,
> 
>                         Geert
> 

-- 
Regards,
Vincenzo

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-22 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-22 13:27 [PATCH] checkpatch: Fix spdxcheck.py Vincenzo Frascino
2019-05-22 13:48 ` Geert Uytterhoeven
2019-05-22 14:32   ` Vincenzo Frascino
2019-05-22 15:07     ` Geert Uytterhoeven
2019-05-22 15:19       ` Vincenzo Frascino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.