[dpdk-dev] [PATCH 01/19] devtools: add simple script to find duplicate includes

Thomas Monjalon thomas at monjalon.net
Tue Jul 11 22:33:55 CEST 2017


Hi Stephen,

11/07/2017 20:55, Stephen Hemminger:
> This is just a simple check script to find obvious duplications.
> 
> Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
> ---
>  devtools/dup_include.pl | 64 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
>  create mode 100755 devtools/dup_include.pl

Thank you for this script, but... it is written in Perl!
I don't think it is a good idea to add yet another language to DPDK.
We already have shell and python scripts.
And I am not sure a lot of (young) people are able to parse it ;)

I would like to propose this shell script:

dirs='app buildtools drivers examples lib test'
pattern='^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*'

for file in $(git ls $dirs) ; do
    dups=$(sed -rn "s,$pattern,\1,p" $file | sort | uniq -d)
    [ -n "$dups" ] || continue
    echo "$file"
    echo "$dups" | sed 's,^,\t,'
done


More information about the dev mailing list