CPAN::Mini::Inject Discoveries
pileofrogs
created: 2006-03-10 17:06:10

I've been working with CPAN::Mini::Inject and having some trouble. I finally figured it out, so I thought I'd write a meditation on it.

CPAN::Mini::Inject has two problems that I'd be happy to fix if the author agrees.

  1. If you're installing modules in your mini-cpan with a made-up user name, CPAN::Mini::Inject doesn't have a mechanism for including that author information. This can lead to some weird behavior.
  2. If you've got Module::Signature installed, CPAN will try to verify a signature on the CHECKSUMS files. CPAN::Mini::Inject doesn't have a mechanism to let you sign that CHECKSUMS file.

Until either I or the author provide the functionality to solve these problems, I found these work arounds.

  1. Manually add your made-up user information to authors/01mailrc.txt.gz. CPAN::Mini::Inject will overwrite this file when it discovers that it's been updated on the real CPAN, so you may have to do this step often. Luckily it's easy to automate.

  2. The module responsible for creating the CHECKSUMS file is CPAN::Checksums, and if you set $CPAN::Checksums::SIGNING_KEY to a valid key, it will create signed CHECKSUMS files.

    For this to work, you need to have a working signing key, and anyone who's going to install the modules off your mini-cpan needs to trust that key.

    To make mcpani use that, you can edit mcpani. The $CPAN::Checksums::SIGNING_KEY variable expects a value it can pass straight on to gpg. This signing key must be available to the user you're logged in as when you run mcpani. If my signing key's id is B150D12F, then I might edit mcpani to contain the following:

    ..
    
    use CPAN::Checksums;
    $CPAN::Checksums::SIGNING_KEY = "B150D12F";
    
    ..
    

    Now when I run mcpani --inject, if any of my personal modules have changed, it will prompt me for the password to my signing key and sign the CHECKSUMS file. It only prompts for the password if it has to create a new CHECKSUMS file, so you can still run "mcpani --mirror" from cron.

Hope that helps someone...
--Pileofrogs

Re: CPAN::Mini::Inject Discoveries
created: 2006-03-11 12:39:59
I was going to use CPAN::Mini::Inject for a current project, but decided that for our needs we would use a hacked version of the mkpackages script that comes with CPAN::Site (I submitted the more general changes I made to the author) - the mkpackages script walks through your local CPAN repository and builds the 02packages.details.txt.gz file, and extracts README's from the *.tar.gz files and creates the *.readme files in your local repository. This script does not fill in author info - it creates an empty 01mailrc.txt.gz if one doesn't exist.

In my hacked mkpackages script I use the CPAN::Checksums module to create the CHECKSUMS files - I wanted a script that I could point at our local CPAN repository and have it build the entire 02packages.details.txt.gz file and all the CHECKSUMS files based on whatever is in our local repository at that time.

In order to add specific version of CPAN modules to our local repository I wrote a separate fetch_and_inject.pl script that takes a CPAN file name, or list of names, e.g. S/SS/SSORICHE/CPAN-Mini-Inject-0.18.tar.gz and goes and fetches that specific file from a public CPAN repository, and puts it in our local repository, creating the authorid subdirectories if needed.

perlmonks.org content © perlmonks.org and matisse, pileofrogs

prlmnks.org © 2006 edmund von der burg (eccles & toad)

v 0.03