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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [sys/] [workspace] - Blame information for rev 135

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 94 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
 
4 135 jt_eaton
#/****************************************************************************/
5
#/*                                                                          */
6
#/*   SOCGEN Design for Reuse toolset                                        */
7
#/*                                                                          */
8
#/*   Version 1.0.0                                                          */
9
#/*                                                                          */
10
#/*   Author(s):                                                             */
11
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
12
#/*                                                                          */
13
#/****************************************************************************/
14
#/*                                                                          */
15
#/*                                                                          */
16
#/*             Copyright 2016 John T Eaton                                  */
17
#/*                                                                          */
18
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
19
#/* you may not use this file except in compliance with the License.         */
20
#/* You may obtain a copy of the License at                                  */
21
#/*                                                                          */
22
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
23
#/*                                                                          */
24
#/* Unless required by applicable law or agreed to in writing, software      */
25
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
26
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
27
#/* See the License for the specific language governing permissions and      */
28
#/* limitations under the License.                                           */
29
#/*                                                                          */
30
#/*                                                                          */
31
#/****************************************************************************/
32 94 jt_eaton
 
33 135 jt_eaton
 
34 117 jt_eaton
use Getopt::Long;
35
use English;
36
use File::Basename;
37 94 jt_eaton
use Cwd;
38
use XML::LibXML;
39 117 jt_eaton
use lib './tools';
40
use sys::lib;
41
use yp::lib;
42 94 jt_eaton
 
43 117 jt_eaton
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
44 94 jt_eaton
 
45
 
46 117 jt_eaton
 
47 119 jt_eaton
 
48 94 jt_eaton
#/*********************************************************************************************/
49
#/ We never generate files into a RCS database.                                               */
50
#/                                                                                            */
51
#/ A special work area is created that is the image of the database using symbolic links      */
52
#/                                                                                            */
53
#/*********************************************************************************************/
54
 
55 119 jt_eaton
my $home    = cwd();
56 100 jt_eaton
 
57
 
58
 
59
 
60 131 jt_eaton
my $prefix   =  yp::lib::get_workspace();
61
   $prefix   =  "/${prefix}";
62
 
63 135 jt_eaton
my $child_dir   =  yp::lib::get_child_dir;
64
 
65
 
66 131 jt_eaton
my $path = "${home}${prefix}";
67
 
68
mkdir $path,0755          unless( -e $path );
69
 
70
 
71
my    $vendor     = $ARGV[0];
72
my    $library    = $ARGV[1];
73
 
74
chomp($vendor);
75
chomp($library);
76
 
77
 
78
$_ = $vendor;
79
 
80
if(/(\S+)\/(\S+)/)
81 119 jt_eaton
     {
82 131 jt_eaton
     $vendor         = $1;
83
     $library        = $2;
84 119 jt_eaton
     }
85 100 jt_eaton
 
86 94 jt_eaton
 
87
 
88 131 jt_eaton
my $repo  = yp::lib::find_library_repo($vendor,$library);
89
my $root  = ".${repo}/${vendor}/${library}/";
90
 
91
 
92 119 jt_eaton
unless ( -e $root )
93
     {
94 131 jt_eaton
     print "ERROR: Library   $vendor $library  does not exist \n";
95 119 jt_eaton
     exit(0);
96
     }
97 117 jt_eaton
 
98 118 jt_eaton
 
99
 
100 119 jt_eaton
 
101
 
102 100 jt_eaton
 
103
 
104 131 jt_eaton
 
105
 
106
$path    = "${home}${prefix}/${vendor}__${library}";
107 100 jt_eaton
mkdir $path,0755          unless( -e $path );
108
 
109 131 jt_eaton
my $vendor_status    =  yp::lib::get_vendor_status($vendor);
110
my $library_status   =  yp::lib::get_library_status($vendor,$library);
111 100 jt_eaton
 
112 94 jt_eaton
 
113 131 jt_eaton
print "Building Workspace ${prefix}/${vendor}__${library} from   .${repo}/${vendor}/${library}/  $vendor_status  $library_status      \n";
114 94 jt_eaton
 
115
 
116 119 jt_eaton
 
117 131 jt_eaton
 
118
$vendor_status   =  yp::lib::set_vendor_status($vendor,"active");
119
$vendor_status   =  yp::lib::get_vendor_status($vendor);
120
 
121
$library_status   =  yp::lib::set_library_status($vendor,$library,"active");
122
$library_status   =  yp::lib::get_library_status($vendor,$library);
123
 
124
 
125
print "Vendor $vendor_status  Library  $library_status        \n";
126
 
127
&link_sub( $root,$root, ".${prefix}/${vendor}__${library}" );
128
 
129
 
130 135 jt_eaton
my $path  = "${home}/${child_dir}";
131 119 jt_eaton
mkdir $path,0755          unless( -e $path );
132 96 jt_eaton
 
133 131 jt_eaton
my @components =       yp::lib::find_components($vendor,$library);
134 119 jt_eaton
foreach my $component (@components)
135
   {
136
   my $parser = XML::LibXML->new();
137 131 jt_eaton
   print " $vendor,$library,$component  \n";
138 94 jt_eaton
 
139 131 jt_eaton
 
140
   my $socgen_filename     = yp::lib::find_componentConfiguration($vendor,$library,$component);
141
   if($socgen_filename)
142
   {
143
   my $socgen_file     = $parser->parse_file(yp::lib::find_componentConfiguration($vendor,$library,$component));
144
   my @versions =       yp::lib::find_component_versions($vendor,$library,$component);
145
 
146 119 jt_eaton
   foreach $comp_version (@versions)
147
     {
148 131 jt_eaton
     $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor $vendor -library $library  -component $component -version $comp_version  \n";
149 119 jt_eaton
     if (system($cmd)) {}
150
     }
151 99 jt_eaton
 
152 131 jt_eaton
   print "Linking simulations for  $vendor  $library  $component      \n";
153 94 jt_eaton
 
154 130 jt_eaton
   foreach  my   $i_name ($socgen_file->findnodes("//socgen:sim/socgen:testbenches/socgen:testbench/socgen:version"))
155 119 jt_eaton
      {
156 94 jt_eaton
 
157 119 jt_eaton
      my($tb_version)  = $i_name ->findnodes('./text()')->to_literal ;
158 94 jt_eaton
 
159 131 jt_eaton
      $cmd ="./tools/sys/soc_link_child -prefix $prefix -vendor ${vendor}  -library $library  -component $component       -version $tb_version    \n";
160 119 jt_eaton
      if (system($cmd)) {}
161
      }
162 117 jt_eaton
 
163
 
164 135 jt_eaton
 
165 119 jt_eaton
 
166 135 jt_eaton
 
167 119 jt_eaton
   }
168 131 jt_eaton
 
169
   }
170 119 jt_eaton
 
171 94 jt_eaton
 
172
 
173 118 jt_eaton
 
174
 
175 94 jt_eaton
#/*********************************************************************************************/
176 117 jt_eaton
#/   recursively map directory information                                                    */
177 94 jt_eaton
#/                                                                                            */
178
#/                                                                                            */
179
#/                                                                                            */
180
#/                                                                                            */
181
#/                                                                                            */
182
#/*********************************************************************************************/
183
 
184
 
185
sub link_sub {
186
    my $root = shift;
187
    my $path = shift;
188
    my $dest = shift;
189
    return unless( -e $path );
190
 
191
    my $dest_path = $path;
192
      $dest_path =~ s/$root/$dest/;
193
 
194 119 jt_eaton
    if( -d $path )
195
      {
196
      mkdir $dest_path,0755;
197 94 jt_eaton
 
198 119 jt_eaton
      my @contents = (  );
199
      opendir( DIR, $path );
200
      while( my $item = readdir( DIR ))
201
           {
202
           next if( $item eq '.' or $item eq '..'   or $item eq '.svn'    );
203
           push( @contents, $item );
204
           }
205
      closedir( DIR );
206 94 jt_eaton
 
207 119 jt_eaton
      # recurse on items in the directory
208
      foreach my $item ( @contents )          { &link_sub($root, "$path/$item", $dest );}
209 94 jt_eaton
 
210
 
211 119 jt_eaton
      }
212
    else
213
      {
214
       symlink( "${home}/${path}", $dest_path);
215
      }
216 94 jt_eaton
}
217
 
218
 

powered by: WebSVN 2.1.0

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