Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:31:47

0001 #!/usr/bin/env perl 
0002 #____________________________________________________________________ 
0003 # File: BootNightlyArea.pl
0004 #____________________________________________________________________ 
0005 #  
0006 # Author: Shaun ASHBY <Shaun.Ashby@cern.ch>
0007 # Update: 2005-10-27 14:25:38+0200
0008 #
0009 # Shaun ASHBY
0010 #
0011 #--------------------------------------------------------------------
0012 use strict;
0013 use Cwd;
0014 $|=1;
0015 
0016 BEGIN
0017    {
0018    use Config;
0019    my $SCRAMINSTALLAREA = '/afs/cern.ch/cms/Releases/SCRAM/current/Installation/TT2/lib/perl5/site_perl';
0020    my $SCRAMSRC = $SCRAMINSTALLAREA."/".$Config{version}."/".$Config{archname};
0021    # Pick up the template toolkit from the current
0022    # version of SCRAM:
0023    unshift(@INC, $SCRAMSRC);
0024    }
0025 
0026 my ($name,$version,$toolbox)=@ARGV;
0027 my $templates=[ 'boot-nightly', 'requirements', 'BuildFile' ];
0028 
0029 # We need the template toolkit:
0030 use Template;
0031 
0032 # Set the template dir:
0033 my $templatedir='config';
0034 
0035 # Set where to put the processed files:
0036 my $outputdir='config';
0037 
0038 # Template toolkit parameters:
0039 my $template_config =
0040    {
0041    INCLUDE_PATH => $templatedir,
0042    EVAL_PERL    => 1 
0043       };
0044 
0045 # Prepare the data for the bootstrap file and requirements:
0046 my $template_engine = Template->new($template_config) || die $Template::ERROR, "\n";
0047 my $projectdata = {};
0048 my $packages = {};
0049 
0050 
0051 # The main block:
0052 if ($name ne '' && 
0053     $version ne '' && 
0054     $toolbox ne '')
0055    {
0056    # Check that the config directory is accessible in current dir:
0057    die "$0: Unable to find the config directory.","\n",unless (-d cwd()."/config");
0058    
0059    # The project data. This data is accessed by key in the template:
0060    $projectdata->{'PROJECT_NAME'} = $name;
0061    $projectdata->{'PROJECT_VERSION'} = $version;
0062    $projectdata->{'CONFIG_VERSION'} = $toolbox;
0063 
0064    # Process both files:
0065    foreach my $file (@$templates)
0066       {            
0067       $template_engine->process($file.".tmpl", $projectdata, $outputdir."/".$file)
0068      || die "Template error: ".$template_engine->error;      
0069       }
0070    }
0071 else
0072    {
0073    die "Usage: $0 <NAME> <VERSION> <TOOLBOX>","\n";
0074    }
0075