|
NAMEcpansite -- extend CPAN with private packagesSYNOPSIScpansite version cpansite [OPTIONS] index cpansite [OPTIONS] mirror PACKAGE OPTIONS: via %ENV: --verbose -v -vv -vvv --mode=DEBUG --no-lazy redo everything --cpan <url> some CPAN mirror CPANSITE_GLOBAL --env-proxy read additional proxy settings --site <dir> local archive directory CPANSITE_LOCAL --stand-alone no fallback to global CPAN --no-undefs do not include "undef" versions in index DESCRIPTIONWARNING: A lot has changed with the 1.01 release. Please read more about these changes in the file "explain_101.txt" included in the distribution.The "cpansite" script is used to create your own CPAN server. The logic is implemented in CPAN::Site::Index which you may use directly. You only need to install this module on one server in your network. There are two kinds of local CPANs which can be constructed with this software:
Indexing optionsThe following options are available with all actions:
DETAILSConfiguring the ClientsTo get in touch with your own cpan archive, you have to explicitly provide an url to it. Add this to your "CPAN.pm" configuration file (usually ~/.cpan/CPAN/MyConfig.pm) option "urllist". There is no need to install the CPAN::Site software on your clients since release 1.01.You probably also want to set the variable "index_expire" to very short: the clients need to reload your local index as soon as possible, and not wait a day; just after your new local release is put in your local index, it must get visible to your client. You may also consider to have the CPAN install cache to be cleaned by the system. Certainly when you set the cache size larger (required for more complex recursive installations) it is nice to have it removed after a (short) while. Set "keep_source_where" to a temporary directory. Example for ~/.cpan/CPAN/MyConfig.pm $CPAN::Config = { ... , index_expire => 1/600 # 5 minutes , urllist => [ $MYCPAN_URL, $BIGCPAN_MIRROR ] , keep_source_where => '/tmp/cpan-cache' , build_cache => 100 # MegaByte cache , ... }; To avoid manually editing the CPAN config file one can also set the MYCPAN_URL from the shell: cpan> o conf urllist unshift $MYCPAN_URL cpan> o conf index_expire 0.001 # 86 seconds cpan> o conf commit Configuring the ServerStarting your own CPANYou have to have a ftp or http server running. Create a directory where you will distribute the data from, here named $MYCPAN. With a web-server, it is adviced to create a virtual host like "cpan.example.com" which has $MYCPAN as DocumentRoot. Define a fake pause-id (here the demo is MYID), because if you use an existing pause-id you clients will start producing warnings about missing checksums on files retreived for the public archive. MYMODS=$MYCPAN/authors/id/M/MY/MYID mkdir -p $MYMODS Although CPAN.pm claims to support a directory format of "$MYCPAN/authors/id/MYID", experience shows that this does not work correctly with some recursively dependencies. Adding your own modules to the local archive Put your own modules in $MYMODS and then rerun the indexer. mv MyDist-1.00-tar.gz $MYMODS # local scp MyDist-1.00-tar.gz cpan.example.com:$MYMODS Generating an index with fallback Your own software probably depends on a lot of modules which are found on the global CPAN. And those modules require even more modules from CPAN. By default, your local CPAN index will know about all modules which you have yourself plus all module on the global CPAN. The index only contains the last (highest) version of each file (which means that each file must contain a version number otherwise the text "undef" is used for version) In any case, the local packages get preference over the global CPAN packages, even when they have a lower version number. With fallback: cpansite --site $MYCPAN index cpansite index # when CPANSITE_LOCAL=$MYCPAN The script traverses $MYCPAN/authors/id and merges this with the $MYCPAN/global/02packages.details.txt.gz data, a copy from the original CPAN. It creates a "CHECKSUMS" file. The result is a private $MYCPAN/modules/02packages.details.txt.gz file. The files $MYCPAN/authors/01mailrc.txt.gz and $MYCPAN/modules/03modlist.data.gz are downloaded from CPAN. This will reduce the number of failing retreivals when you start installing software. Be warned: the indexing scans the archive for the same VERSION patterns as pause does: do not make too complex expressions in those program lines. Only pm files are indexed, not other files, like scripts (pl files). Generating an index without fallback When you wish for a controled environment, where all your systems run the same versions of the modules, you should disable the fallback to the global CPAN. Without fallback: cpansite --site $MYCPAN --stand-alone index cpansite --stand-alone index # when CPANSITE_LOCAL=$MYCPAN The index is now very small. But when you start installing your software on systems, it will start complaining that the module cannot be found on CPAN. Now, add specific distribution versions from the global CPAN to your own archive. See next section. Adding distributions from global CPAN to your own When you want a fixed distribution version to be used on your systems, you can manually download them and insert them in the $MYCPAN tree. However, there is also a simple way to retrieve the most recent version. The next example shows how to insert the latest versions of the distributions which include the packages Mail::Box and Test::More into your local CPAN archive. cpansite --site $MYCPAN --cpan $GLOBAL mirror Mail::Box Test::More # when CPANSITE_LOCAL=$MYCPAN and CPANSITE_GLOBAL=$GLOBAL cpansite mirror Mail::Box Test::More AUTHORSMark Overmeer <markov@cpan.org<gt>.This project is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://dev.perl.org/licenses/>
Visit the GSP FreeBSD Man Page Interface. |