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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [yp/] [clean] - Blame information for rev 135

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 131 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3 135 jt_eaton
#/****************************************************************************/
4
#/*                                                                          */
5
#/*   SOCGEN Design for Reuse toolset                                        */
6
#/*                                                                          */
7
#/*   Version 1.0.0                                                          */
8
#/*                                                                          */
9
#/*   Author(s):                                                             */
10
#/*      - John Eaton, z3qmtr45@gmail.com                                    */
11
#/*                                                                          */
12
#/****************************************************************************/
13
#/*                                                                          */
14
#/*                                                                          */
15
#/*             Copyright 2016 John T Eaton                                  */
16
#/*                                                                          */
17
#/* Licensed under the Apache License, Version 2.0 (the "License");          */
18
#/* you may not use this file except in compliance with the License.         */
19
#/* You may obtain a copy of the License at                                  */
20
#/*                                                                          */
21
#/*    http://www.apache.org/licenses/LICENSE-2.0                            */
22
#/*                                                                          */
23
#/* Unless required by applicable law or agreed to in writing, software      */
24
#/* distributed under the License is distributed on an "AS IS" BASIS,        */
25
#/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
26
#/* See the License for the specific language governing permissions and      */
27
#/* limitations under the License.                                           */
28
#/*                                                                          */
29
#/*                                                                          */
30
#/****************************************************************************/
31 131 jt_eaton
 
32
 
33
############################################################################
34
# General PERL config
35
############################################################################
36
use Getopt::Long;
37
use English;
38
use File::Basename;
39
use Cwd;
40
use XML::LibXML;
41
use lib './tools';
42
use sys::lib;
43
use BerkeleyDB;
44
 
45
 
46
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
47
 
48
 
49
 
50
 
51
############################################################################
52
### Process the options
53
############################################################################
54
 
55
Getopt::Long::config("require_order", "prefix=-");
56
GetOptions("h","help"
57
) || die "(use '$program_name -h' for help)";
58
 
59
 
60
##############################################################################
61
## Help option
62
##############################################################################
63
if ( $opt_h or $opt_help  )
64
   {
65
   print "\n type clean  \n";
66
   exit 1;
67
   }
68
 
69
 
70
##############################################################################
71
##
72
##############################################################################
73
 
74
my $home           = cwd();
75
my $parser = XML::LibXML->new();
76 134 jt_eaton
my $workspace_xml    = $parser->parse_file("${home}/workspace.xml");
77 131 jt_eaton
my @repos =();
78
my $repo;
79
 
80
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace/socgen:external/socgen:repo'))
81
                  {
82
                  my $repo_name  = $repo->findnodes('./socgen:name/text()')->to_literal ;
83
                  my $repo_path  = $repo->findnodes('./socgen:path/text()')->to_literal ;
84
                  print "cleaning $repo_name    \n";
85
                  if(-e  $repo_name)
86
                   {
87
                   print "Removing $repo_name  \n";
88
                   my $cmd = "rm -r $repo_name  \n";
89
                   if(system($cmd)){};
90
                   }
91
                  }
92
 
93
 
94
 
95
my $build_dir;
96 135 jt_eaton
my $child_dir;
97
my $code_dir;
98
my $data_dir;
99 131 jt_eaton
my $yp_dir;
100 135 jt_eaton
my $ports_dir;
101 131 jt_eaton
my $doc_dir;
102
 
103
 
104
 
105
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace'))
106
                  {
107
                  $build_dir       = $repo->findnodes('./socgen:build_dir/text()')->to_literal ;
108 135 jt_eaton
                  $child_dir       = $repo->findnodes('./socgen:child_dir/text()')->to_literal ;
109
                  $code_dir        = $repo->findnodes('./socgen:code_dir/text()')->to_literal ;
110
                  $data_dir        = $repo->findnodes('./socgen:data_dir/text()')->to_literal ;
111 131 jt_eaton
                  $yp_dir          = $repo->findnodes('./socgen:yp_dir/text()')->to_literal ;
112 135 jt_eaton
                  $ports_dir       = $repo->findnodes('./socgen:ports_dir/text()')->to_literal ;
113 131 jt_eaton
                  $doc_dir         = $repo->findnodes('./socgen:doc_dir/text()')->to_literal ;
114
                  }
115
 
116
 
117
if(-e $build_dir)
118
  {
119
  print "Removing $build_dir  \n";
120
  my $cmd = "rm -r ./${build_dir}  \n";
121
  if(system($cmd)){};
122
  }
123
 
124 135 jt_eaton
if(-e $child_dir)
125
  {
126
  print "Removing $child_dir  \n";
127
  my $cmd = "rm -r ./${child_dir}  \n";
128
  if(system($cmd)){};
129
  }
130 131 jt_eaton
 
131 135 jt_eaton
 
132
if(-e $code_dir)
133
  {
134
  print "Removing $code_dir  \n";
135
  my $cmd = "rm -r ./${code_dir}  \n";
136
  if(system($cmd)){};
137
  }
138
 
139
 
140
if(-e $data_dir)
141
  {
142
  print "Removing $data_dir  \n";
143
  my $cmd = "rm -r ./${data_dir}  \n";
144
  if(system($cmd)){};
145
  }
146
 
147
 
148
 
149 131 jt_eaton
if(-e $yp_dir)
150
  {
151
  print "Removing $yp_dir  \n";
152
  my $cmd = "rm -r ./${yp_dir}  \n";
153
  if(system($cmd)){};
154
  }
155
 
156 135 jt_eaton
if(-e $ports_dir)
157
  {
158
  print "Removing $ports_dir  \n";
159
  my $cmd = "rm -r ./${ports_dir}  \n";
160
  if(system($cmd)){};
161
  }
162 131 jt_eaton
 
163 135 jt_eaton
 
164 131 jt_eaton
if(-e $doc_dir)
165
  {
166
  print "Removing $doc_dir  \n";
167
  my $cmd = "rm -r ./${doc_dir}  \n";
168
  if(system($cmd)){};
169
  }
170
 
171
 
172
1

powered by: WebSVN 2.1.0

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