bruce_sears has asked for the wisdom of the Perl Monks concerning the following question:

greetings,

first, i've searched about and found these resources, and they don't seem to address/mitigate my issue fully:

http://www.perlmonks.org/?node_id=747071
My general problem is that I want a defined set of cpan mods of set version numbers to install on several production machines so I can control when/if mod updates occur (we recently had a code collision with an update to Class::Accessor for example.) I'm attempting then to make a private local cpan "mirror" (more a cpan "picture-of-dorian-gray" i suppose). Here are a sample set of commands used:
[root@trowel root]# MCPANI_CONFIG=/root/.mcpani/config mcpani -v --add + --module Apache::DBI --authorid PGOLLUCCI --modversion 1.07 --file / +root/.cpan/sources/authors/id/P/PG/PGOLLUCCI/Apache-DBI-1.07.tar.gz
then
[root@trowel root]# MCPANI_CONFIG=/root/.mcpani/config mcpani --inject + -v Injecting modules from /root/epgysch_prod_CPAN_repos /var/www/epgysch-prod-CPAN/authors/id/P/PG/PGOLLUCCI/Apache-DBI-1.07.t +ar.gz ... injected
Then in the cpan shell, i have
o conf: urllist file:///var/www/epgysch-prod-CPAN/ ...
i would hope that then i could do
cpan> install Apache::DBI
and get the module (version 1.07!) that i injected into the "mirror" at /var/www/epgysch-prod-CPAN/, but instead, cpan looks for this (version 1.08 under a different author id):
cpan[1]> install Apache::DBI CPAN: Storable loaded ok (v2.21) Going to read '/root/.cpan/Metadata' Database was generated on Tue, 23 Feb 2010 15:04:12 GMT Running install for module 'Apache::DBI' Running make for A/AB/ABH/Apache-DBI-1.08.tar.gz CPAN: LWP::UserAgent loaded ok (v5.829) CPAN: Time::HiRes loaded ok (v1.9717) CPAN: URI::URL loaded ok (v5.03) Could not find '/var/www/epgysch-prod-CPAN/authors/id/A/AB/ABH/Apache- +DBI-1.08.tar.gz' Fetching with LWP: file:///var/www/epgysch-prod-CPAN/authors/id/A/AB/ABH/Apache-DBI-1.0 +8.tar.gz LWP failed with code[404] message[File `/var/www/epgysch-prod-CPAN/aut +hors/id/A/AB/ABH/Apache-DBI-1.08.tar.gz' does not exist]
This is not surprising I suppose, since cpan is parsing and using /root/.cpan/Metadata which likely stores info from when I was working with a public cpan repository, but I only want it to look at what is in the local repository I am setting up. I suppose I could fiddle about more with local cpan configs, but I would hope there is a better, easier way to just tell cpan to go to forget about any history and just go to my local repository and see/get what's there.

Perhaps I am on a fool's errand here (or more likely, a fool on an errand), are there any suggestions on how to go about doing what I want, even if it is off in some other direction? And is what I am trying to do a reasonable thing to do, even? I think it is...

Thanks for any help,

Bruce

Replies are listed 'Best First'.
Re: problem setting up local mod repository with mcpani
by proceng (Scribe) on Apr 20, 2010 at 20:37 UTC
    I would do it one of the following ways:
    • Set up a network drive with just the desired modules (this will take some work)
    • Take a snapshot of your desired directory (use autobundle to capture tbe current state)
    • Put your entire perl environment on a network drive - you will have to install the modules from each platform (32-bit, 64-bit, Linux, Solaris etc).
    Each option will take some work to create your desired environment, but if you then change the configuration modules, you will have a static environment to work with.

    Unfortunately, there is no clean way to do this without a significant amount of work, since some of the modules return 0 or 'undef' for the version numbers. Your best bet is to:

    1. Capture the current module library via rsync or CPAN::Mini.
    2. Upgrade a development machine using the captured library.
    3. Test the heck out of it in your known environment.
    4. Freeze the configuration and configure your production machines.
    You can then configure production to update to the current versions of your perl scripts immediately after upgrading the local images of the perl libraries.

    One caveat in storing the perl libraries and in-house scripts locally is that, if there is an issue, it takes local intervention to fix a problem or update to a new version. Networked installations (depending on network size) can often be much cleaner.

    HTH

    Update:
    I missed one point here:

    This is not surprising I suppose, since cpan is parsing and using /root/.cpan/Metadata which likely stores info from when I was working with a public cpan repository, but I only want it to look at what is in the local repository I am setting up.
    Also use "reload index" in CPAN or "x --update-source" in CPANPLUS to recreate the indices with your private repository information.
      Thanks for the reply proceng. I'm thinking about a different direction now. Perhaps I'll use backpan along with my list of tarballs to install just what I want.

      That, along with using Module::Dependency::Info could ensure that any prereq mods i need are first culled from my list before either wwarning me or automatically grabbing the latest cpan mod for that dependency. I'm liking this I think. It sounds reasonably simple and straightforward (though I might be missing something yet)...

      Thanks again,

      bruce