Em Tue, 8 May 2018 15:05:07 -0300
Mauro Carvalho Chehab <mchehab+sams...@kernel.org> escreveu:

> Em Tue, 08 May 2018 17:40:56 +0300
> Jani Nikula <jani.nik...@linux.intel.com> escreveu:
> 
> > On Mon, 07 May 2018, Andrea Parri <andrea.pa...@amarulasolutions.com> 
> > wrote:  
> > > On Mon, May 07, 2018 at 06:35:41AM -0300, Mauro Carvalho Chehab wrote:    
> > >> The cachetlb.txt is already in ReST format. So, move it to the
> > >> core-api guide, where it belongs.
> > >> 
> > >> Signed-off-by: Mauro Carvalho Chehab <mchehab+sams...@kernel.org>
> > >> ---
> > >>  Documentation/00-INDEX                                | 2 --
> > >>  Documentation/{cachetlb.txt => core-api/cachetlb.rst} | 0
> > >>  Documentation/core-api/index.rst                      | 1 +
> > >>  Documentation/memory-barriers.txt                     | 2 +-
> > >>  Documentation/translations/ko_KR/memory-barriers.txt  | 2 +-
> > >>  5 files changed, 3 insertions(+), 4 deletions(-)
> > >>  rename Documentation/{cachetlb.txt => core-api/cachetlb.rst} (100%)    
> > >
> > > I see a few "inline" references to the .txt file in -rc4 (see below):
> > > I am not sure if you managed to update them too.    
> > 
> > Side note, there's scripts/documentation-file-ref-check to grep the
> > kernel tree for things that look like file references to Documentation/*
> > and complain if they don't exist.
> > 
> > I get about 350+ hits with that, patches welcome! ;)  
> 
> This small script fixes a bunch of such errors:
> 
>       scripts/documentation-file-ref-check 2>broken_refs
>       for i in $(cat broken_refs|cut -d: -f 2|grep -v 
> devicetree|sort|uniq|grep \\.txt); do
>               rst=$(basename $i)
>               rst=${rst/.txt/.rst}
>               f=$(find . -name $rst)
>               f=${f#./}
>               if [ "$f" != "" ]; then
>                       echo "Replacing $i to $f"
>                       for j in $(git grep -l $i); do
>                               sed "s@$i@$f@g" -i $j
>                       done
>               fi
>       done

It follows an improvement to the above script that shows also what
it didn't find as a ReST file, and the ones that have common names
with multiple matches.

I guess we could integrate something like that at 
scripts/documentation-file-ref-check, in order to allow auto-correcting
renamed .txt files.

Regards,
Mauro


#!/bin/bash

scripts/documentation-file-ref-check 2>broken_refs
for i in $(cat broken_refs|cut -d: -f 2|grep -v devicetree|sort|uniq|grep 
\\.txt); do
        rst=$(basename $i)
        rst=${rst/.txt/.rst}
        f=$(find . -name $rst)

        if [ "$f" == "" ]; then
                echo "ERROR: Didn't find a .rst replacement for $i"
        elif [ "$(echo $f | grep ' ')" != "" ]; then
                echo "ERROR: Found multiple possible replacements for $i:"
                for j in $f; do
                        echo "    $j"
                done
        else
                echo "Replacing $i to $f"
                f=${f#./}
                for j in $(git grep -l $i); do
                        sed "s@$i@$f@g" -i $j
                done
        fi
done


Thanks,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-doc" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to