Skip to content

Commit

Permalink
Support for local cpan directory
Browse files Browse the repository at this point in the history
  • Loading branch information
Graham Barr authored and abh committed Aug 8, 2008
1 parent fc6cb09 commit 27690d9
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 5 deletions.
39 changes: 39 additions & 0 deletions bin/cbcpan
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- cperl -*-
eval 'exec $CBROOT/bin/perl -w $0 ${1+"$@"}'
if my $running_under_some_shell;
use strict;
use warnings;
use File::Path qw(mkpath);
use Config;

my $root = $ENV{CBROOTLOCAL} or die "Need CBROOTLOCAL\n";
my $base = $root . q[/cpan];

my $arch_dir = $base . "/lib/perl5/" . $Config::Config{archname};
unless (-d $arch_dir) {
mkpath($arch_dir) || die "Cannot create $arch_dir: $!\n";
# Restart ourselves to get PERL5LIB setup
exec($0,@ARGV);
}

die "$base does not exists" unless -d $base;

require CPAN::MyConfig;
require CPAN::FirstTime;

$CPAN::Config->{makepl_arg} = q[INSTALL_BASE=] . $base . q[ INSTALLBASE=] . $base;
$CPAN::Config->{mbuildpl_arg} = q[--install_base ] . $base;

# Should get this from config
$CPAN::Config->{urllist} = [
'http://mirror.uta.edu/CPAN',
'ftp://mirrors.kernel.org/pub/CPAN',
'http://cpan.mirrorgeek.com'
];

CPAN::FirstTime::init("/dev/null",
autoconfig => 1,
);
warn Data::Dumper::Dumper($CPAN::Config);
require CPAN;
CPAN::shell();
27 changes: 22 additions & 5 deletions bin/perl
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,39 @@ ROOT=${CBROOTLOCAL:-$CBROOT}

CONFIGFILE=${CBCONFIG:-$ROOT/combust.conf}


if [ ! -f $CONFIGFILE ]; then
echo Could not find configuration file $CONFIGFILE 1>&2
exit 2
fi

MYPERL=`grep ^perl $CONFIGFILE | cut -d= -f2 | sed 's/[[:space:]]//g'`
MYPERL=`awk '/^ *perl *=/ { print $3 }' $CONFIGFILE`

if [ -z $MYPERL ]; then
echo Could not find "perl =" line in the combust.conf 1>&2
echo Could not find "perl =" line in $CONFIGFILE 1>&2
exit 2
fi

if [ ! -z $CBROOTLOCAL ]; then
LLIB=-I$CBROOTLOCAL/lib
mylib=$CBROOT/lib
if [ ! -z "$CBROOTLOCAL" ]; then
if [ -d $CBROOTLOCAL/lib ]; then
mylib=$CBROOTLOCAL/lib:$mylib
fi
if [ -d $CBROOTLOCAL/cpan/lib/perl5 ]; then
mylib=$mylib:$CBROOTLOCAL/cpan/lib/perl5
fi
fi

exec $MYPERL -I$CBROOT/lib $LLIB ${1+"$@"}
if [ -d $CBROOT/cpan/lib/perl5 ]; then
mylib=$mylib:$CBROOT/cpan/lib/perl5
fi

if [ -z "$PERL5LIB" ] ; then
PERL5LIB=$mylib
else
# perhaps we should just replace it to prevent it growing from recursive calls
PERL5LIB=$mylib:$PERL5LIB
fi
export PERL5LIB

exec $MYPERL ${1+"$@"}
57 changes: 57 additions & 0 deletions lib/CPAN/MyConfig.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package CPAN::MyConfig;

$CPAN::Config = {
'cpan_home' => '/tmp/cpan',
'show_unparsable_versions' => 0,
'show_upload_date' => 0,
'mbuild_install_build_command' => './Build',
'lynx' => '',
'yaml_load_code' => 0,
'ncftp' => '',
'urllist' => [
'http://mirror.uta.edu/CPAN',
'ftp://mirrors.kernel.org/pub/CPAN',
'http://cpan.mirrorgeek.com'
],
'ncftpget' => '',
'prefer_installer' => 'MB',
'yaml_module' => 'YAML',
'build_requires_install_policy' => 'ask/yes',
'getcwd' => 'cwd',
'no_proxy' => '',
'build_cache' => 100,
'make_arg' => '',
'wget' => '',
'auto_commit' => 0,
'patch' => '/usr/bin/patch',
'ftp_proxy' => '',
'ftp_passive' => 1,
'tar' => '/usr/bin/tar',
'inactivity_timeout' => 0,
'use_sqlite' => 0,
'scan_cache' => 'atstart',
'cache_metadata' => 1,
'show_zero_versions' => 0,
'term_ornaments' => 1,
'build_dir_reuse' => 1,
'shell' => '/bin/bash',
'prerequisites_policy' => 'ask',
'mbuild_arg' => '',
'applypatch' => '',
'inhibit_startup_message' => 0,
'load_module_verbosity' => 'v',
'commandnumber_in_prompt' => 1,
'mbuild_install_arg' => '',
'index_expire' => 1,
'check_sigs' => 0,
'test_report' => 0,
'tar_verbosity' => 'v',
'term_is_latin' => 1,
'make_install_arg' => '',
'histsize' => 100,
'colorize_output' => 0,
'http_proxy' => ''
};


1;

0 comments on commit 27690d9

Please sign in to comment.