Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Wondering how to manage cpan modules from within svn projects

by dekimsey (Sexton)
on Dec 21, 2007 at 23:45 UTC ( #658579=perlquestion: print w/ replies, xml ) Need Help??
dekimsey has asked for the wisdom of the Perl Monks concerning the following question:

Most of the projects, if not all, that I work on are web related tools that have various module dependencies and the like. I'm curious how others have dealt with the problem of maintaining a source repository whose projects have certain module dependencies from CPAN. The problem is, a source repository is great for keeping track of the changes to ones own project but I haven't found a way of connecting a repos project to various cpan modules that might need a specific version and/or configuration to work properly.

I could compile the modules myself and create a sort of vendor distribution of these third-party modules in my repository, it doesn't cleanly deal with dependencies at all. Just start needing more an one module, and one oculd end up with multiple copies of the same module all over the place. This solution doesn't seem right.

So I considered another method, that is having a way to create module distributions from cpan and store them in the repository as almost an 'svn:external' kind of concept. Where a build script can examine the project and extract the appropriate pre-built (or sources) needed for the project. This is technically what cpan tries to do when building any given module but the problem I have with simply leaving this to cpan to handle and make everything into large modules is that in many cases cpan has trouble compiling the various modules or they may point to versions that do not exist or whatnot that need to be dealt with by hand.

The idea is almost importing cpan modules into a repository so they can be linked to ones projects properly. Thereby allowing the normal repository processes like tagging and branching to also keep these third party modules in check.

The furthest I've thought is to perhaps create a CPANPLUS distribution module (CPANPLUS::Dist::Base) too in essence 'cpan2svn'.

Any thoughts or ideas about tackling this issue would be greatly appreciated as I'm certain there must be a good solution for the problem. Many thanks!


--
Danny.

Edit: Title lacked proper grammar.

Comment on Wondering how to manage cpan modules from within svn projects
Re: Wondering how to manage cpan modules from within svn projects
by sh1tn (Priest) on Dec 22, 2007 at 02:54 UTC
    Yes INC. Some of the most successful frameworks tend to heavily rely on this principle, Perl IMHO should be no exception.


Re: Wondering how to manage cpan modules from within svn projects
by perrin (Chancellor) on Dec 22, 2007 at 04:37 UTC
    I don't understand your objection to checking compiled modules into svn. Are you concerned that separate projects in the same repository might put in the same module? So what? We're talking about a few cents worth of hard disk here.

    There are other solutions of course. For the Krang CMS project, we check in the module source and build it at install time. This is a good solution when you need to support multiple platforms. You're welcome to steal any code you find useful there.

Re: Wondering how to manage cpan modules from within svn projects
by CountZero (Bishop) on Dec 22, 2007 at 09:26 UTC
    If your project requires a very specific version of a CPAN-module (such that it would really breakdown if an other (newer) module is installed in your general Perl-module tree) then just add this version of the module into your svn-repository and make sure that your scripts/modules adjust the @INC path: use lib "$ENV{HOME}/myown_perllib_for_this_project"; for instance.

    CountZero

    A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

Re: Wondering how to manage cpan modules from within svn projects
by hsinclai (Deacon) on Dec 22, 2007 at 14:11 UTC
    I followed this philosophy for the past year building a platform:

    The parts break down into three major categories:
  • our code
  • modules/classes (written in-house, not offered by our OS vendor)
  • 3rdparty items (written outside of our shop, not offered by OS vendor, language independent)

    And this was guided by:
  • our repo containing code should never be mixed with other OPC (other people's code:)
  • our in-house libs/classes should be kept in a dedicated repository easing our ability to release these tools publicly back out into the community
  • addition of 3rdparty or modules would be approved by the Sr Architect after rounds of testing/approval

    Therefore what I came up with was that each of these categories would have its own Subversion repo, and that the group of 3 repos make up the entire "project". There are also requirements for modules (not written in-house, installable in the OS via packaging system), which are kept in a Name/Version list; these are not in a repo.

    My build and deployment system tracks/deploys these parts together for a "release" whose manifest includes the current revision number from each repo.

    -Harold



Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://658579]
Approved by pKai
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-09-16 04:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (155 votes), past polls