Cleaning up your DarkPAN
In a previous entry I blogged about creating your own DarkPAN. This is convenient when you're offline as you can still use 'cpanm' to install your modules and dependencies.
Now of course, if you're a diligent CPAN author (or a lazy worker finding ways to goof off and do busy work by writing and releasing CPAN modules), your DarkPAN will add up and need cleaning from time to time.
To delete older releases, I use this script. Just give it the path to your DarkPAN as an argument. After that you'll need to reindex your DarkPAN (I use orepan_index.pl from OrePAN, OrePAN2 is much slower).
To find distributions that have been deleted from CPAN but still linger in my DarkPAN, I cobbled up something like this:
#!/bin/bash setop --diff \ <(list-xpan-dists ~/darkpan-cpan --author sharyanto) \ <(list-xpan-dists http://www.cpan.org/ --author sharyanto) > /tmp/old-dists.txt for dist in `cat /tmp/old-dists.txt`; do mv ~/darkpan-cpan/authors/id/S/SH/SHARYANTO/$dist-* \ ~/dackpan-cpan/authors/id/S/SH/SHARYANTO/$dist-* done
The setop command is from App-setop. It can perform set operations (union, intersection, difference) on lines of files. Here I want to show all the dists that are in darkpan-cpan but no longer exist on a real CPAN mirror. list-xpan-dists is from App-XPANQueryUtils.
After I get the list, I just move the tarballs to "my own BackPAN": ~/dackpan-cpan (notice the one letter difference, dackpan is an amalgamation of DarkPAN and BackPAN, genius huh?)
Leave a comment