Indexing minicpan

[email protected] (Bennett Todd)
Newsgroups perl.fwp
Message-ID <[email protected]>
Just learned about CPAN::Mini on the Perl Advent Calendar
<URL:http://www.perladvent.org/>. What a _spiffy_ idea! Just sorta
blows me away, I never thought of taking that particular slice.

But once I had the latest versions of everything in CPAN sitting
nice and happy on my hard disk, I figured I had to index it, of
course. Hence the attached script. I use rc(1) for my shell
scripting and swish++ for my indexer, but the idea's simple enough
to rewrite in whatever language appeals.

-Bennett
index-minicpan (text/plain, 810 B)
#!/bin/rc

src=$home/archive/minicpan

tmp=/var/tmp/^`{basename $0}^.$pid
fn sigexit { rm -rf $tmp }

mkdir $tmp

for (f in `{find $src/authors/id -type f ! -name 'CHECKSUMS'}) {
    mkdir $tmp/_unpack
    switch($f) {
	case *.tar.gz
	    modname=`{basename $f .tar.gz}
	    @{cd $tmp/_unpack&&tar xzf $f}
	case *.tgz
	    modname=`{basename $f .tgz}
	    @{cd $tmp/_unpack&&tar xzf $f}
	case *.zip
	    modname=`{basename $f .zip}
	    @{cd $tmp/_unpack&&unzip $f}
	case *.pm.gz
	    modname=`{basename $f .pm.gz}
	    @cd $tmp/_unpack&&gzip -d <$f >`{basename $src .gz}
    }
    {
	find $tmp/_unpack -name README | xargs cat
	find $tmp/_unpack -type f|xargs grep -l '^=head1'|xargs -l pod2text
    } >$tmp/$modname
    rm -rf $tmp/_unpack
}

@{cd $tmp && ls|index -W100000 -I -}
mv $tmp/swish++.index $src/
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)

iD8DBQFBs0SAHZWg9mCTffwRAm+pAKDA3wl9ntq0VmcgFKamCyCqnY6SkgCg2DBN
jJ2XUc4NQ0SrSEh8rVBnL6s=
=hZT9
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.