[Bio] / FigCommon / make_sandbox.pl Repository:
ViewVC logotype

View of /FigCommon/make_sandbox.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (download) (as text) (annotate)
Mon Dec 5 19:10:06 2005 UTC (14 years, 5 months ago) by olson
Branch: MAIN
CVS Tags: caBIG-05Apr06-00, caBIG-13Feb06-00
Changes since 1.4: +17 -0 lines
Added license words.

#
# Copyright (c) 2003-2006 University of Chicago and Fellowship
# for Interpretations of Genomes. All Rights Reserved.
#
# This file is part of the SEED Toolkit.
# 
# The SEED Toolkit is free software. You can redistribute
# it and/or modify it under the terms of the SEED Toolkit
# Public License. 
#
# You should have received a copy of the SEED Toolkit Public License
# along with this program; if not write to the University of Chicago
# at info@ci.uchicago.edu or the Fellowship for Interpretation of
# Genomes at veronika@thefig.info or download a copy from
# http://www.theseed.org/LICENSE.TXT.
#

use strict;

use File::Spec;
use File::Copy;
use File::Basename;

#
# Assemble a FIGdisk sandbox from the current release data.
#
# Create the base directory structure.
# Symlink to Data, env, and BLASTMAT.
# Download latest snapshot and install.
# Snapshot the postgres db for the current FIGdisk.
# Run configure.
#

my $username = (getpwuid($>))[0];
my $cvsroot = ":ext:$username\@biocvs.mcs.anl.gov:/disks/cvs/bio";
my $cvs_packages = "seed_base";

if (@ARGV != 1)
{
    print STDERR "Usage: $0 target-directory\n";
    exit;
}

my($target_dir) = @ARGV;
$target_dir = File::Spec->rel2abs($target_dir);

if (-e $target_dir)
{
    die "Target directory $target_dir already exists\n";
}

print "Create '$target_dir'\n";

mkdir($target_dir) or die "mkdir $target_dir: $!";

chdir($target_dir) or die;
mkdir("FIG") or die;
mkdir("FIG/Tmp") or die;
chmod(0777, "FIG/Tmp") or die;

mkdir("dist") or die;
mkdir("dist/releases") or die;

symlink("$FIG_Config::fig_disk/env", "env") or 
    die "symlink $FIG_Config::fig_disk/env failed";
symlink("$FIG_Config::fig_disk/BLASTMAT", "BLASTMAT") or 
    die "symlink $FIG_Config::fig_disk/BLASTMAT failed";
symlink("$FIG_Config::fig_disk/FIG/Data", "FIG/Data") or 
    die "symlink $FIG_Config::fig_disk/FIG/Data failed";

my $cvs_warn = 0;
if ($ENV{CVS_RSH} != "ssh")
{
    $cvs_warn = 1;
    $ENV{CVS_RSH} = "ssh";
}

chdir("dist/releases") or die;

my $rel;

my $makeCVS = 0;
if ($makeCVS)
{
    $rel = "dev";
    mkdir("dev") or die;
    chdir("dev") or die;
    system("cvs -d $cvsroot co $cvs_packages");
    if ($? != 0)
    {
	die "cvs checkout failed";
    }

}
else
{
    $rel = `curl http://www-unix.mcs.anl.gov/~olson/SEED/CURRENT_RELEASE`;
    chomp $rel;

    system("curl http://www-unix.mcs.anl.gov/~olson/SEED/code-$rel.tgz| tar xfz -");
    if ($? != 0)
    {
	warn "download of release failed\n";
    }
}
chdir($rel);
copy("FigCommon/configure", "$target_dir/configure") or die;
chmod(0755, "$target_dir/configure") or die;
copy("ReleaseTools/Makefile.top", "Makefile") or die;

open(F, ">$target_dir/DEFAULT_RELEASE") or die "open $target_dir/RELEASE failed: $!";
print F "$rel\n";
close(F);

#
# Determine arch name.
#

my $arch;
open(FH, "<$FIG_Config::fig_disk/config/fig-user-env.sh");
while (<FH>)
{
    chomp;
    if (/^RTARCH=\"(.*)\"/)
    {
        $arch = $1;
        last;
    }
}

if (!$arch)
{
    die "Couldn't determine FIG architecture name\n";
}

chdir($target_dir) or die;
$ENV{FIGCONFIG_DBNAME} = "fig_dev";
$ENV{FIGCONFIG_DBPORT} = 10000;
$ENV{FIGCONFIG_DBBUFS} = 300;
$ENV{FIGCONFIG_SANDBOX} = $username;
system("./configure $arch > config.out 2>&1");
if ($? != 0)
{
    print "configure failed\n";
}

# my $sedcmd =" -e '/temp_url/s,FIG-Tmp,$username/FIG-Tmp,' -e '/cgi_url/s,FIG,$username/FIG,' -e '/temp_base/s,FIG-Tmp,$username/FIG-Tmp,' -e '/cgi_base/s,FIG,$username/FIG,' -e '/dbuser/s,$username,fig,'";
# print "$sedcmd\n";

# chdir("config") or die;
# copy("FIG_Config.pm", "FIG_Config.pm.bak");
# copy("FIG_Config.py", "FIG_Config.py.bak");
# system("sed $sedcmd < FIG_Config.pm.bak > FIG_Config.pm");
# system("sed $sedcmd < FIG_Config.py.bak > FIG_Config.py");

print "Need to run :\n";
print "mkdir /var/www/html/$username\n";
print "ln -s $target_dir/FIG/CGI /var/www/html/$username/FIG\n";
print "ln -s $target_dir/FIG/Tmp /var/www/html/$username/FIG-Tmp\n";

exit;
__DATA__

open(F, ">DEFAULT_RELEASE");
print F "$code_version\n";
close(F);



(system("cd dist/releases; tar zxf $code_file") == 0) or die "Extract of code from $code_file failed: $!\n";

copy("dist/releases/$code_version/FigCommon/configure", "configure");
chmod(0755, "configure");

copy("dist/releases/$code_version/ReleaseTools/Makefile.top", "dist/releases/$code_version/Makefile");

MCS Webmaster
ViewVC Help
Powered by ViewVC 1.0.3