Re: PCI: Replace lkml.org, spinics, gmane with lore.kernel.org

Joe Perches
2020-07-02T20:19:26Z

On Tue, 2020-06-30 at 22:35 -0700, Joe Perches wrote:
> On Tue, 2020-06-30 at 14:04 -0600, Jonathan Corbet wrote:
> > On Tue, 30 Jun 2020 13:09:17 -0500
> > Bjorn Helgaas <helgaas@kernel.org> wrote:
> >
> > > PCI: Replace lkml.org, spinics, gmane with lore.kernel.org
> > >
> > > The lkml.org, spinics.net, and gmane.org archives are not very reliable
> > > and, in some cases, not even easily accessible. Replace links to them with
> > > links to lore.kernel.org, the archives hosted by kernel.org.
> > >
> > > I found the gmane items via the Wayback Machine archive at
> > > https://web.archive.org/.
> >
> > Heh...now *that* sounds like a project that could generate a lot of churn,
> > and perhaps even be worth it. Settling on a consistent (and working!)
> > email archive would improve the docs quite a bit. I'll add that to the
> > list...
>
> At least for the lkml.org/lkml links
> here's the current -next diff done by a
> script that looks at the message-id of
> each lkml.org link.

btw: if you want to run the script for specific
paths, here's the script.

You could run it using:

bash convert_lkml_to_lore.sh <path>

---
$ cat convert_lkml_to_lore.sh
#!/bin/bash

cvt_lkml_to_lore ()
{
tmpfile=$(mktemp ./.cvt_links.XXXXXXX)

header=$(echo $1 | sed 's@/lkml/@/lkml/headers/@')

wget -qO - $header > $tmpfile
if [[ $? == 0 ]] ; then
link=$(grep -i '^Message-Id:' $tmpfile | head -1 | \
sed -r -e 's/^\s*Message-Id:\s*<\s*//' -e 's/\s*>\s*$//' -e 's@^@https://lore.kernel.org/r/@')
# echo "testlink: $link"
if [ -n "$link" ] ; then
wget -qO - $link > /dev/null
if [[ $? == 0 ]] ; then
echo $link
fi
fi
fi

rm -f $tmpfile
}

git grep -P -o "\bhttps?://(?:www.)?lkml.org/lkml[\/\w]+" $@ |
while read line ; do
echo $line
file=$(echo $line | cut -f1 -d':')
link=$(echo $line | cut -f2- -d':')
newlink=$(cvt_lkml_to_lore $link)
if [[ -n "$newlink" ]] ; then
sed -i -e "s#\b$link\b#$newlink#" $file
fi
done