lcpan - think whatever you want about it

Jerry Lundström prox at lunar-linux.org
Mon Sep 13 12:52:26 UTC 2004


Hey all,

1. About
2. Detailed information
3. LCPAN the program
4. Testing lcpan
5. Module prefix or not?
6. Depending on lcpan in other modules
7. Other things I'm going to add


1. About

   It's time for me to introduce mr lcpan to you all. This is a little 
tool I've been coding one last weekend that is a CPAN wrapper for lunar lin.

   My approch to the cpan problem has been to make a small perl program 
that intreacts with CPAN and make autogenerated lunar modules.
That means it will create a local module when you tell it to install for 
example Time::HiRes. The lunar module that will be created will be 
called Time-HiRes (:: is not friendly in shellscripts) and lcpan will 
ask lin to install it.
   lcpan also generates the module is such a way that lunar will handle 
downloading of the tarballs and verifing them (with sadly only md5sum's).

   The nice thing about having a lunar module of a cpan module is that 
everything gets tracked right and we dont have to make and maintain a 
module for each cpan module. lrm works better then cpan on removing 
modules also.



2. Detailed information

   Heres alittle more detailed info:

cpan_home = /var/state/lunar/cpan
histfile = /var/state/lunar/cpan/histfile

   The Metadata file is kept in cpan_home, this is CPAN's list of modules.

build_dir = /usr/src/cpan

   Everything will be built in this dir, all generated modules have this 
set as SOURCE_DIRECTORY so its removed after installation.

keep_source_where = /var/spool/cpan

   This is CPAN's spool, sources are not kept here but they are 
downloaded by lunar and put in /var/spool/lunar and then symlinked into 
this dir (with all the fuzzy pathnames cpan uses). Some other importent 
files are kept here among CHECKSUMS.



3. LCPAN the program

# lcpan

usage: lcpan COMMAND ARGUMENTS...

Commands:

   install       Installs the specified modules if they
                 are not already installed.

   update        Update specified modules, special argument
                 can be 'ALL' which will update all installed
                 cpan modules.

   status        Give a brief display on cpan module status
                 and what need to be updated.

Power tools commands:

   --install     Installs the specified cpan module.

   --get         Run post initialzing rutins after getting
                 the source tarball but before compiling.

   --generate    Generate lunar module files for the given
                 cpan modules.

   Do not use power tools commands if you don't know what they are for.


   Install/update/status is kinda selfexplained but the powertools are 
mostly used from within the generated lunar modules them self.

   The templates files for lcpan is in /var/lib/lunar/cpan and in short 
this is how it works.

   --get is used in PRE_BUILD to create the symlink from 
/var/spool/lunar to 
/var/spool/cpan/authors/id/FUZZYFUZZ/FUSDF/SDFUFS/tarball .

   --install is used in BUILD to compile and install. NOTE NOTE NOTE I 
have tried my best to have the make and test process before 
prepare_install but it just cant be done since cpan is has no easy way 
to just say install. If you think im wrong about this talk to me via 
mail or irc.

   --generate isnt used in the lunar module, I made this so you can just 
call the generation process manually.



4. Testing lcpan

   So how can you test lcpan, this is how:

cd /var/lib/lunar/moonbase/zlocal
wget http://kenny.it.su.se/lunar/lcpan/lcpan-module.tar.bz2
tar jxvf lcpan-module.tar.bz2
rm lcpan-module.tar.bz2
lin -c lcpan

   NOTE NOTE NOTE NOTE: DONT do this on systems you cant trash, this is 
very beta so far. It will reinstall theedge also because it needs to 
patch theedge for the new mooonbase section cpan which I put in to have 
prio over all other sections exept zlocal.

   If you want to relin lcpan do: lin -c lcpan

   After its installed you can run lcpan and if you want to see it work 
run: lcpan update all



5. Module prefix or not?

   I can be very good to have a prefix for lcpan, for example all 
modules names can begin with CPAN- so that you clearly see its a 
generated cpan module. But this is up for discussion.



6. Depending on lcpan modules

   I added a function to depends.lunar called depends_cpan() that will 
call lcpan --generate $MODULE and then call depends with the generated 
modules name.

   So in programs that need a CPAN modules you can insteed of making 
another module and depending on it just type:

depends_cpan Other::Cpan::Module

   in your DEPENDS file.



7. Other things I'm going to add

   The checksum code isnt done yet so that has to be completed because I 
want lunar to puke if the tarball doesn't match.
   One other things is 'lcpan list' which just lists all installed 
modules and if they have a lunar module tied to them and versions and 
stuff like that.


More information about the Lunar-dev mailing list