[dpdk-dev] [PATCH v4] devtools: add new SPDX license compliance checker

Thomas Monjalon thomas at monjalon.net
Fri Jun 12 17:42:13 CEST 2020


12/06/2020 16:53, Stephen Hemminger:
> On Thu, 11 Jun 2020 23:39:55 +0200
> Thomas Monjalon <thomas at monjalon.net> wrote:
> 
> > 24/02/2020 22:01, Stephen Hemminger:
> > > +tmpfile=$(mktemp)  
> > 
> > Please check how other temp files are created in other scripts
> > for consitency.
> > 
> > > +    git grep -L SPDX-License-Identifier -- \
> > > +	':^.git*' ':^.ci/*' ':^.travis.yml' \
> > > +	':^README' ':^MAINTAINERS' ':^VERSION' ':^ABI_VERSION' \
> > > +	':^*/Kbuild' ':^*/README' \
> > > +	':^license/' ':^doc/' ':^config/' ':^buildtools/' \  
> > 
> > I think doc/ should be part of the license check,
> > same for buildtools/.
> > 
> > > +	':^*.cocci' ':^*.abignore' \
> > > +	':^*.def' ':^*.map' ':^*.ini' ':^*.data' ':^*.cfg' ':^*.txt' \
> > > +	> $tmpfile
> > > +
> > > +    errors=0
> > > +    while read -r line
> > > +    do $quiet || echo $line
> > > +       errors=$((errors + 1))  
> > 
> > I'm surprised this works for you.
> > In general, "while" creates a subshell which makes impossible
> > updating a variable.
> > I recommend using "for" with IFS=$'\n'.
> > 
> > > +    done < $tmpfile
> > > +}
> > > +
> > > +check_boilerplate() {
> > > +    if $verbose ; then
> > > +	echo
> > > +	echo "Files with redundant license text"
> > > +	echo "---------------------------------"
> > > +    fi
> > > +
> > > +    git grep -l Redistribution -- \
> > > +	':^license/' ':^/devtools/check-spdx-tag.sh' |
> > > +	while read line
> > > +	do $quiet || echo $line
> > > +	   warnings=$((warnings + 1))
> > > +	done  
> > 
> > Same comment about "while" subshell.
> > 
> > > +
> > > +    warnings=0
> > > +    while read -r line
> > > +    do $quiet || echo $line
> > > +       warnings=$((errors + 1))  
> > 
> > Here too
> > 
> > > +    done < $tmpfile
> > > +}  
> > 
> > [...]
> > > +Each file must begin with a special comment containing the
> > > +`Software Package Data Exchange (SPDX) License Identfier <https://spdx.org/using-spdx-license-identifier>`_.  
> > 
> > Typo: Identifier
> > 
> > > +
> > > +Generally this is the BSD License, except for code granted special exceptions.  
> > 
> > Is a verb missing?
> > 
> > > +The SPDX licences identifier is sufficient, a file should not contain
> > > +an additional text version of the license (boilerplate).  
> 
> Thanks for the feedback.
> Text processing is simpler in python, will rewrite in next version?

I don't see a need for rewrite.
I think addressing the comments is simpler.




More information about the dev mailing list