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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [soc_link_child] - Diff between revs 118 and 119

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 118 Rev 119
Line 17... Line 17...
#/*  Author(s):                                                        */
#/*  Author(s):                                                        */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*      - John Eaton, jt_eaton@opencores.org                          */
#/*                                                                    */
#/*                                                                    */
#/**********************************************************************/
#/**********************************************************************/
#/*                                                                    */
#/*                                                                    */
#/*    Copyright (C) <2010-2011>                */
#/*    Copyright (C) <2010-2012>                */
#/*                                                                    */
#/*                                                                    */
#/*  This source file may be used and distributed without              */
#/*  This source file may be used and distributed without              */
#/*  restriction provided that this copyright statement is not         */
#/*  restriction provided that this copyright statement is not         */
#/*  removed from the file and that any derivative work contains       */
#/*  removed from the file and that any derivative work contains       */
#/*  the original copyright notice and the associated disclaimer.      */
#/*  the original copyright notice and the associated disclaimer.      */
Line 67... Line 67...
### Process the options
### Process the options
############################################################################
############################################################################
 
 
Getopt::Long::config("require_order", "prefix=-");
Getopt::Long::config("require_order", "prefix=-");
GetOptions("h","help",
GetOptions("h","help",
 
           "prefix=s" => \$prefix,
           "vendor=s" => \$vendor,
           "vendor=s" => \$vendor,
           "project=s" => \$project,
           "project=s" => \$project,
           "component=s" => \$component,
           "component=s" => \$component,
           "version=s" => \$version
           "version=s" => \$version
 
 
) || die "(use '$program_name -h' for help)";
) || die "(use '$program_name -h' for help)";
 
 
 
 
##############################################################################
##############################################################################
## Help option
## Help option
##############################################################################
##############################################################################
if ( $opt_h or $opt_help  )
if ( $opt_h or $opt_help  )
   {
   {
   print "\n type soc_link_child  -vendor vendor_name -project project_name  -component  component_name -version  version_name   ";
   print "\n type soc_link_child  -prefix /work -vendor vendor_name -project project_name  -component  component_name -version  version_name  projects_dir ";
   print "\n";
   print "\n";
   exit 1;
   exit 1;
   }
   }
 
 
 
 
##############################################################################
##############################################################################
##
##
##############################################################################
##############################################################################
 
 
$home              = cwd();
my $home              = cwd();
 
 
 
 
my $parser           = XML::LibXML->new();
my $parser           = XML::LibXML->new();
my $lib_comp_sep    = yp::lib::find_lib_comp_sep($vendor,$project);
 
 
 
 
 
 
my $projects_dir    = $ARGV[0];
 
chomp($projects_dir);
my $variant;
my $variant;
 
 
if($version) {$variant = "${component}_${version}";}
if($version) {$variant = "${component}_${version}";}
else         {$variant = "${component}";}
else         {$variant = "${component}";}
 
 
Line 116... Line 118...
 
 
my $socgen_ip_file     = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
my $socgen_ip_file     = $parser->parse_file(yp::lib::find_socgen("socgen:ip",$vendor,$project,$component));
 
 
 
 
 
 
foreach  my   $i_name ($socgen_ip_file->findnodes("//chips/chip[variant/text() = '$variant']"))
foreach  my   $i_name ($socgen_ip_file->findnodes("//socgen:chips/socgen:chip[socgen:name/text() = '$variant']"))
   {
   {
   my($chip)  = $i_name ->findnodes('name/text()')->to_literal ;
 
   my($replace_vendor)  = $i_name ->findnodes('socgen:target/socgen:vendor/text()')->to_literal ;
   my($replace_vendor)  = $i_name ->findnodes('socgen:target/socgen:vendor/text()')->to_literal ;
   my($replace_library)  = $i_name ->findnodes('socgen:target/socgen:library/text()')->to_literal ;
   my($replace_library)  = $i_name ->findnodes('socgen:target/socgen:library/text()')->to_literal ;
 
 
   my @replace_components = yp::lib::find_components("spirit:component",$replace_vendor,$replace_library);
   my @replace_components = yp::lib::find_components("spirit:component",$replace_vendor,$replace_library);
 
 
   foreach my $replace_component (@replace_components)
   foreach my $replace_component (@replace_components)
     {
     {
#      print " VVVVVV  $replace_vendor $replace_library $replace_component \n" ;
      &link_child($vendor, $project,$replace_component, $replace_library ,$replace_vendor);
      &link_child( $project,$replace_component, $replace_library );
 
     }
     }
   }
   }
 
 
 
 
 
 
Line 158... Line 158...
 
 
 
 
foreach $line (@filelist)
foreach $line (@filelist)
   {
   {
   $_ = $line;
   $_ = $line;
   if(/::(\S+)::(\S+)::/)
   if(/::(\S+)::(\S+)::(\S+)::/)
     {
     {
     $new_proj      = $1;
     $new_vendor      = $1;
     $new_comp      = $2;
     $new_proj        = $2;
     if($new_proj ne $project ) { &link_child( $project,$new_comp, $new_proj ); }
     $new_comp        = $3;
 
     if(($new_vendor ne $vendor ) or  ($new_proj ne $project ) )
 
 
 
       { &link_child( $vendor,$project,$new_comp, $new_proj ,$new_vendor); }
     }
     }
   }
   }
 
 
 
 
 
 
Line 183... Line 186...
#/*********************************************************************************************/
#/*********************************************************************************************/
 
 
 
 
 
 
sub link_child {
sub link_child {
                 my $project      = shift;
                 my $parent_vendor      = shift;
                 my $child_parent = shift;
                 my $parent_library      = shift;
                 my $child_family = shift;
                 my $child_component = shift;
                 my $path  = "work/${project}/children";
                 my $child_library = shift;
                 mkdir $path,0755             unless( -e $path );
                 my $child_vendor = shift;
                 my $path  = "work/${project}/children/${child_family}";
 
                 mkdir $path,0755             unless( -e $path );
 
                 my $path  = "work/${project}/children/${child_family}/bin";
 
                 mkdir $path,0755             unless( -e $path );
 
                 $root = "${home}/projects/${vendor}/${child_family}/bin";
 
                 $dest = "${home}/work/${project}/children/${child_family}/bin";
 
                 &link_dir( "$root", "$dest"  );
 
                 symlink( "${home}/tools/bin/Makefile.root", "${home}/work/${project}/children/${child_family}/bin/Makefile.root");
 
                 symlink( "${home}/tools/bin/Makefile",      "${home}/work/${project}/children/${child_family}/bin/Makefile");
 
                 my $path  = "work/${project}/children/${child_family}/sw";
 
                 mkdir $path,0755             unless( -e $path );
 
                 $root = "${home}/projects/${vendor}/${child_family}/sw";
 
                 $dest = "${home}/work/${project}/children/${child_family}/sw";
 
                 &link_dir( "$root", "$dest"  );
 
                 my $path  = "work/${project}/children/${child_family}/ip";
 
                 mkdir $path,0755             unless( -e $path );
 
                 my $path  = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}";
 
                 mkdir $path,0755             unless( -e $path );
 
 
 
                 my $path  = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/rtl";
                 my $lib_comp_sep    = yp::lib::find_lib_comp_sep($child_vendor,$child_library);
                 mkdir $path,0755             unless( -e $path );
 
                 $root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/rtl";
 
                 $dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/rtl";
 
                 &link_dir( "$root", "$dest"  );
 
 
 
 
 
                 my $path  = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children";
                 mkdir $path,0755             unless( -e $path );
                 mkdir $path,0755             unless( -e $path );
                 $root = "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}";
                 $dest = "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/ip-xact";
 
                 &link_dir( "$root", "$dest"  );
 
 
 
 
 
 
 
                 my $path  = "work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/doc";
 
                 mkdir $path,0755             unless( -e $path );
                 mkdir $path,0755             unless( -e $path );
 
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/bin";
                 symlink( "${home}/projects/${vendor}/${child_family}${lib_comp_sep}/${child_parent}/doc/copyright.v", "${home}/work/${project}/children/${child_family}${lib_comp_sep}/${child_parent}/doc/copyright.v");
                 mkdir $path,0755             unless( -e $path );
 
                 $root = "${home}/${projects_dir}/${child_vendor}/${child_library}/bin";
               }
                 $dest = "${home}${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/bin";
 
                 &sys::lib::link_dir( "$root", "$dest"  );
 
                 symlink( "${home}/tools/bin/Makefile.root", "${home}${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/bin/Makefile.root");
 
                 symlink( "${home}/tools/bin/Makefile",      "${home}${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/bin/Makefile");
 
 
 
 
#/*********************************************************************************************/
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/sw";
#/                                                                                            */
                 mkdir $path,0755             unless( -e $path );
#/                                                                                            */
                 $root = "${home}/${projects_dir}/${child_vendor}/${child_library}/sw";
#/                                                                                            */
                 $dest = "${home}${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}/sw";
#/                                                                                            */
                 &sys::lib::link_dir( "$root", "$dest"  );
#/                                                                                            */
 
#/                                                                                            */
 
#/*********************************************************************************************/
 
 
 
# recursively map directory information
 
 
 
sub link_dir {
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}${lib_comp_sep}";
    my $src  = shift;
 
    my $dest = shift;
 
    return unless( -e $src );
 
 
 
    if( -d $src )
#  only works for simple single item paths
        {
 
 
 
        mkdir $dest,0755;
                 mkdir $path,0755             unless( -e $path );
        my @contents = (  );
 
        opendir( DIR, $src );
 
        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
                 my $path  = ".${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}${lib_comp_sep}/${child_component}";
        foreach my $item ( @contents )          { &link_dir("$src/$item", "$dest/$item" );}
                 mkdir $path,0755             unless( -e $path );
 
                 $root = "${home}/${projects_dir}/${child_vendor}/${child_library}${lib_comp_sep}/${child_component}";
 
                 $dest = "${home}${prefix}/${parent_vendor}__${parent_library}/children/${child_vendor}__${child_library}${lib_comp_sep}/${child_component}";
 
                 &sys::lib::link_dir( "$root", "$dest"  );
 
 
 
 
       }
       }
       else  {symlink( "${src}", "${dest}") unless( -e "${dest}" ); }
 
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Line 292... Line 253...
   my $project    = pop(@params);
   my $project    = pop(@params);
   my $vendor     = pop(@params);
   my $vendor     = pop(@params);
 
 
   $home = cwd();
   $home = cwd();
 
 
   push(@filelist_hier,"::${project}::${component}::");
   push(@filelist_hier,"::${vendor}::${project}::${component}::");
 
 
   my $spirit_design_file = yp::lib::find_ipxact_design_file($vendor,$project,$component,$version );
   my $spirit_design_file = yp::lib::find_ipxact_design_file($vendor,$project,$component,$version );
   my $spirit_padring_design_file = yp::lib::find_ipxact_padring_design_file($vendor,$project,$component,$version );
   my $spirit_padring_design_file = yp::lib::find_ipxact_padring_design_file($vendor,$project,$component,$version );
 
 
   #/*********************************************************************************************/
   #/*********************************************************************************************/

powered by: WebSVN 2.1.0

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