Created
February 28, 2012 21:19
-
-
Save holybit/1935229 to your computer and use it in GitHub Desktop.
perl distributions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Passed a perlbrew perl it will setup the environment | |
# e.g. ./env.sh perl-5.12.4 | |
# By Perl convention the first three components are named 'revision', 'version' | |
# and 'subversion'. local::lib will use the 'version' to set the perl library | |
# path | |
# TODO | |
# ---- | |
# 1. add check for CLI perl version | |
# 2. match CLI arg against perlbrew list to determin if exists | |
export BASE_DIR=/usr/local/sscore/fbl-misc | |
export PERLBREW_HOME=${BASE_DIR}/perl-libs/.perlbrew | |
export PERLBREW_ROOT=/usr/local/perlbrew | |
export PERLLIBS_LIBS=${BASE_DIR}/perl-libs/libs | |
source ${PERLBREW_ROOT}/etc/bashrc | |
version=$(echo $1 | cut -d\. -f1-2) | |
perlbrew list | |
perlbrew switch $1 | |
perlbrew list | |
eval $(perl -Mlocal::lib=${PERLLIBS_LIBS}/${version}) | |
env | grep PERL |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Installs perl libs for each combination of perlbrew perl and the associated | |
# package details listing. Array elements pipe delimited each composed of | |
# three fields: # 1. perlbrew perl name - run 'perlbrew list' on:w the target machine if your | |
# not sure | |
# 2. perl lib name - relative path to be appended to PERLLIBS_LIBS, if you | |
# need more then one custom lib per a single installed | |
# perlbrew perl then use lib names like perl-5.12-l1, | |
# perl-5.12.l2, etc. | |
# 3. packages details - relative path to be appended to PERLLIBS_CONF | |
export BASE_DIR=/usr/local/sscore/fbl-misc | |
export PERLBREW_HOME=${BASE_DIR}/perl-libs/.perlbrew | |
export PERLBREW_ROOT=/usr/local/perlbrew | |
export PERLLIBS_CONF=${BASE_DIR}/perl-libs/conf | |
export PERLLIBS_DISTS=${BASE_DIR}/perl-libs/dists | |
export PERLLIBS_LIBS=${BASE_DIR}/perl-libs/libs | |
source ${PERLBREW_ROOT}/etc/bashrc | |
# perlbrew libs to be added here, see header notes on format and meaning | |
perllib[0]='perl-5.12.4|perl-5.12|packages.details.5.12.txt' | |
for i in "${perllib[@]}"; do | |
# break out element into vars | |
perl=$(echo $i | cut -d\| -f1) | |
lib_rel=$(echo $i | cut -d\| -f2) | |
lib_abs=${PERLLIBS_LIBS}/${lib_rel} | |
pack_rel=$(echo $i | cut -d\| -f3) | |
pack_abs=${PERLLIBS_CONF}/${pack_rel} | |
# perlbrew and local::lib env setup | |
perlbrew switch $perl | |
# STDOUT dump to indicate which perl is now in use | |
perlbrew list | |
eval $(perl -Mlocal::lib=$lib_abs) | |
# STDOUT dump to indicate which perl envs are set | |
env | grep -i perl | |
# install distributions | |
if [ -e $pack_abs ]; then | |
IFS=$'\n' | |
for details in $(cat $pack_abs); do | |
module=$(echo $details | awk '{print $1}') | |
version=$(echo $details | awk '{print $2}') | |
cpandist=$(echo $details | awk '{print $3}') | |
dist=$(echo $cpandist | cut -d\/ -f2) | |
cpanm ${PERLLIBS_DISTS}/${dist} | |
done | |
else | |
echo "no such file - $pack_abs" | |
exit 1 | |
fi | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
#=============================================================================== | |
# | |
# FILE: packages_details_gen.pl | |
# | |
# USAGE: ./packages_detals_gen.pl | |
# | |
# DESCRIPTION: given a file that list perl files like this: | |
# | |
# JMCNAMARA/OLE-Storage_Lite-0.19.tar.gz | |
# JTBRAUN/Parse-RecDescent-1.967006.tar.gz | |
# JMCNAMARA/Spreadsheet-WriteExcel-2.37.tar.gz | |
# | |
# will generate a verbose listing in three columns like this: | |
# | |
# OLE::Storage::Lite 0.19 JMCNAMARA/OLE-Storage_Lite-0.19.tar.gz | |
# Parse::RecDescent 1.967006 JTBRAUN/Parse-RecDescent-1.967006.tar.gz | |
# Spreadsheet::WriteExcel 2.37 JMCNAMARA/Spreadsheet-WriteExcel-2.37.tar.gz | |
# | |
#=============================================================================== | |
use strict; | |
use warnings; | |
use Data::Dumper; | |
while (<>) { | |
chomp; | |
# print Dumper($_); | |
if (!$_) { | |
print "\n"; | |
} | |
else { | |
# print Dumper($_); | |
my ($author, $dist) = split /\//; | |
$dist =~ s/\.tar\.gz//g; | |
# print Dumper($dist); | |
$dist =~ /([a-zA-Z_\-]+)([\d\.]+)/; | |
my $module = $1; | |
my $version = $2; | |
$module =~ s/\-$//; | |
$module =~ s/\-/::/; | |
print join(q{ }, $module, $version, $_), "\n"; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir -p perl-libs/bin | |
mkdir -p perl-libs/conf | |
mkdir -p perl-libs/dists | |
mkdir -p perl-libs/libs | |
mkdir -p perl-libs/.perlbrew | |
mkdir -p perl-libs/RP |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment