OpenCores
URL https://opencores.org/ocsvn/socgen/socgen/trunk

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [workspace] - Rev 135

Compare with Previous | Blame | View Log

eval 'exec `which perl` -S $0 ${1+"$@"}'
   if 0;

#/****************************************************************************/
#/*                                                                          */
#/*   SOCGEN Design for Reuse toolset                                        */
#/*                                                                          */
#/*   Version 1.0.0                                                          */
#/*                                                                          */
#/*   Author(s):                                                             */
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
#/*                                                                          */
#/****************************************************************************/
#/*                                                                          */
#/*                                                                          */
#/*             Copyright 2016 John T Eaton                                  */ 
#/*                                                                          */
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
#/* you may not use this file except in compliance with the License.         */
#/* You may obtain a copy of the License at                                  */
#/*                                                                          */
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
#/*                                                                          */
#/* Unless required by applicable law or agreed to in writing, software      */
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
#/* See the License for the specific language governing permissions and      */
#/* limitations under the License.                                           */
#/*                                                                          */
#/*                                                                          */
#/****************************************************************************/


use Getopt::Long;
use English;
use File::Basename;
use Cwd;
use XML::LibXML;
use lib './tools';
use sys::lib;
use yp::lib;

$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.




#/*********************************************************************************************/
#/ We never generate files into a RCS database.                                               */
#/                                                                                            */
#/ A special work area is created that is the image of the database using symbolic links      */
#/                                                                                            */
#/*********************************************************************************************/

my $home    = cwd();




my $prefix   =  yp::lib::get_workspace();
   $prefix   =  "/${prefix}";

my $child_dir   =  yp::lib::get_child_dir;


my $path = "${home}${prefix}";

mkdir $path,0755          unless( -e $path );


my    $vendor     = $ARGV[0];
my    $library    = $ARGV[1];

chomp($vendor);
chomp($library);


$_ = $vendor;

if(/(\S+)\/(\S+)/) 
     { 
     $vendor         = $1;
     $library        = $2;
     }



my $repo  = yp::lib::find_library_repo($vendor,$library);
my $root  = ".${repo}/${vendor}/${library}/";


unless ( -e $root )
     { 
     print "ERROR: Library   $vendor $library  does not exist \n";
     exit(0);
     }









$path    = "${home}${prefix}/${vendor}__${library}";
mkdir $path,0755          unless( -e $path );

my $vendor_status    =  yp::lib::get_vendor_status($vendor);
my $library_status   =  yp::lib::get_library_status($vendor,$library);


print "Building Workspace ${prefix}/${vendor}__${library} from   .${repo}/${vendor}/${library}/  $vendor_status  $library_status      \n";




$vendor_status   =  yp::lib::set_vendor_status($vendor,"active");
$vendor_status   =  yp::lib::get_vendor_status($vendor);

$library_status   =  yp::lib::set_library_status($vendor,$library,"active");
$library_status   =  yp::lib::get_library_status($vendor,$library);


print "Vendor $vendor_status  Library  $library_status        \n";

&link_sub( $root,$root, ".${prefix}/${vendor}__${library}" );


my $path  = "${home}/${child_dir}";
mkdir $path,0755          unless( -e $path );

my @components =       yp::lib::find_components($vendor,$library);
foreach my $component (@components) 
   {
   my $parser = XML::LibXML->new();
   print " $vendor,$library,$component  \n";


   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
   if($socgen_filename)
   {
   my $socgen_file     = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
   my @versions =       yp::lib::find_component_versions($vendor,$library,$component);

   foreach $comp_version (@versions)
     {
     $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor $vendor -library $library  -component $component -version $comp_version  \n";
     if (system($cmd)) {}
     }

   print "Linking simulations for  $vendor  $library  $component      \n";

   foreach  my   $i_name ($socgen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
      {

      my($tb_version)  = $i_name ->findnodes('./text()')->to_literal ;

      $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor ${vendor}  -library $library  -component $component       -version $tb_version    \n";
      if (system($cmd)) {}
      }



 

   }

   }
   




#/*********************************************************************************************/
#/   recursively map directory information                                                    */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/                                                                                            */
#/*********************************************************************************************/
 

sub link_sub {
    my $root = shift;
    my $path = shift;
    my $dest = shift;
    return unless( -e $path );
 
    my $dest_path = $path;
      $dest_path =~ s/$root/$dest/;

    if( -d $path ) 
      {
      mkdir $dest_path,0755;

      my @contents = (  );
      opendir( DIR, $path );
      while( my $item = readdir( DIR )) 
           {
           next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
           push( @contents, $item );
           }
      closedir( DIR );
 
      # recurse on items in the directory
      foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
 

      } 
    else 
      {
       symlink( "${home}/${path}", $dest_path);
      }
}


Compare with Previous | Blame | View Log

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.