[Chicago-talk] h2xs & subversion equal looong paths

James Keenan jkeen at verizon.net
Tue May 24 19:26:51 PDT 2005


On May 24, 2005, at 10:00 PM, Jay Strauss wrote:

> Hi,
>
> I was hoping someone here had a better structure or method to pass on 
> to
> me.  I'm using subversion and when I build a module with h2xs I end up
> with gigantic paths.
>
> Subversion "red book" recommends the:
>
> project
>     -trunk
>     -branch
>     -tag
>
> structure
>
> add that to what h2xs creates for my module Finance::Quote::CBOE.  And 
> I
> end up having to cd to:
>
> ~/sandbox/Finance-Quote-CBOE/trunk/lib/Finance/Quote
>
> just to edit my file CBOE.pm file (as well as having to add
> ~/sandbox/Finance-Quote-CBOE/trunk/lib to my PERL5LIB for testing)
>
> If I'm building a couple of modules, I end up jumping around the
> filesystem like a mad-man.
>

I've been using Subversion since Andy set that up as the vcs for the 
Phalanx project.  So some of my work goes into the Phalanx repository, 
but I have one set up on my own disk for non-Phalanx projects.  I found 
the initial set-up confusing and, in one case, ended up with a 
directory structure as deep as the one you presented.

I ended up having to write a little set of instructions for myself, 
which I now quote:

****** start jimk's instructions:  use at your own risk *****

Assuming I have created a tree of directories and files like this:

     ~/tmp/tmp/branches
              /tags
              /trunk/Changes
                     mymodule.pm
                     MANIFEST
                     Makefile.PL
                     README
                     t/01.t

and assuming I want to call this part of the repository

     newmod

the initial import is done like this:

     svn import /Users/jimk/tmp/tmp file:///Users/jimk/repository/newmod 
-m "initial import of newmod"

I should now see the files and directories being added:

     Adding    /Users/jimk/tmp/tmp/trunk
     Adding    /Users/jimk/tmp/tmp/trunk/Changes
     ....

The initial checkout is then done like this:

     cd ~/work
     svn checkout file:///Users/jimk/repository/newmod/trunk newmod

where directory ~/work/newmod has NOT previously existed.  (It's 
created by the checkout.)

I then

     cd newmod

and proceed to work.  It is from ~/work/newmod that svn commits are 
made.

****** end jimk's instructions *****

Comments:

1.  I now keep tmp/tmp/branches tags trunk around permanently.  When I 
start a new project, I cd to tmp/tmp/trunk, delete its contents, use 
'modulemaker' (where you would use 'h2xs') and thereby create the 
structure I need.  But I do *no* work there.  It's simply a location 
for the initial import into the repository.

2.  All work on a project is done underneath ~/work.	If you follow the 
model above, ~/work/newmod is the working directory for the 'newmod' 
project, i.e., the place from which commits are made.

3.  Now, granted that the current preferred CPAN style is for .pm files 
to be located beneath a lib directory, that does mean that to edit such 
a file from the project's working directory, you'll have to say 
something like:

     vi lib/Finance/Quote/CBOE.pm

But that's due to current Perl practice and has nothing to do with 
Subversion.

4.  Assuming my instructions to myself are correct, I think it's the 
'trunk' directory in 
~/sandbox/Finance-Quote-CBOE/trunk/lib/Finance/Quote
that you could have avoided.

HTH

jimk



More information about the Chicago-talk mailing list