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

Subversion Repositories socgen

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

Go to most recent revision | 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
 
4
#/**********************************************************************/
5
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*                                                                    */
17
#/*  Author(s):                                                        */
18
#/*      - John Eaton, jt_eaton@opencores.org                          */
19
#/*                                                                    */
20
#/**********************************************************************/
21
#/*                                                                    */
22
#/*    Copyright (C) <2010-2011>                */
23
#/*                                                                    */
24
#/*  This source file may be used and distributed without              */
25
#/*  restriction provided that this copyright statement is not         */
26
#/*  removed from the file and that any derivative work contains       */
27
#/*  the original copyright notice and the associated disclaimer.      */
28
#/*                                                                    */
29
#/*  This source file is free software; you can redistribute it        */
30
#/*  and/or modify it under the terms of the GNU Lesser General        */
31
#/*  Public License as published by the Free Software Foundation;      */
32
#/*  either version 2.1 of the License, or (at your option) any        */
33
#/*  later version.                                                    */
34
#/*                                                                    */
35
#/*  This source is distributed in the hope that it will be            */
36
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
37
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
38
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
39
#/*  details.                                                          */
40
#/*                                                                    */
41
#/*  You should have received a copy of the GNU Lesser General         */
42
#/*  Public License along with this source; if not, download it        */
43
#/*  from http://www.opencores.org/lgpl.shtml                          */
44
#/*                                                                    */
45
#/**********************************************************************/
46
 
47
 
48
############################################################################
49
# General PERL config
50
############################################################################
51
use Getopt::Long;
52
use English;
53
use File::Basename;
54
use Cwd;
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use BerkeleyDB;
59
 
60
 
61
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
62
 
63
 
64
 
65
 
66
############################################################################
67
### Process the options
68
############################################################################
69
 
70
Getopt::Long::config("require_order", "prefix=-");
71
GetOptions("h","help"
72
) || die "(use '$program_name -h' for help)";
73
 
74
 
75
##############################################################################
76
## Help option
77
##############################################################################
78
if ( $opt_h or $opt_help  )
79
   {
80
   print "\n type clean  \n";
81
   exit 1;
82
   }
83
 
84
 
85
##############################################################################
86
##
87
##############################################################################
88
 
89
my $home           = cwd();
90
 
91
my $parser = XML::LibXML->new();
92
 
93
my    $workspace_xml    = $parser->parse_file("${home}/workspace.xml");
94
 
95
 
96
 
97
 
98
 
99
 
100
 
101
 
102
 
103
my @repos =();
104
my $repo;
105
 
106
 
107
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace/socgen:external/socgen:repo'))
108
                  {
109
                  my $repo_name  = $repo->findnodes('./socgen:name/text()')->to_literal ;
110
                  my $repo_path  = $repo->findnodes('./socgen:path/text()')->to_literal ;
111
                  print "cleaning $repo_name    \n";
112
                  if(-e  $repo_name)
113
                   {
114
                   print "Removing $repo_name  \n";
115
                   my $cmd = "rm -r $repo_name  \n";
116
                   if(system($cmd)){};
117
                   }
118
                  }
119
 
120
 
121
 
122
my $build_dir;
123
my $yp_dir;
124
my $ports_dir;
125
my $doc_dir;
126
 
127
 
128
 
129
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace'))
130
                  {
131
                  $build_dir       = $repo->findnodes('./socgen:build_dir/text()')->to_literal ;
132
                  $yp_dir          = $repo->findnodes('./socgen:yp_dir/text()')->to_literal ;
133
                  $ports_dir       = $repo->findnodes('./socgen:ports_dir/text()')->to_literal ;
134
                  $doc_dir         = $repo->findnodes('./socgen:doc_dir/text()')->to_literal ;
135
                  }
136
 
137
 
138
if(-e $build_dir)
139
  {
140
  print "Removing $build_dir  \n";
141
  my $cmd = "rm -r ./${build_dir}  \n";
142
  if(system($cmd)){};
143
  }
144
 
145
 
146
if(-e $yp_dir)
147
  {
148
  print "Removing $yp_dir  \n";
149
  my $cmd = "rm -r ./${yp_dir}  \n";
150
  if(system($cmd)){};
151
  }
152
 
153
 
154
if(-e $ports_dir)
155
  {
156
  print "Removing $ports_dir  \n";
157
  my $cmd = "rm -r ./${ports_dir}  \n";
158
  if(system($cmd)){};
159
  }
160
if(-e $doc_dir)
161
  {
162
  print "Removing $doc_dir  \n";
163
  my $cmd = "rm -r ./${doc_dir}  \n";
164
  if(system($cmd)){};
165
  }
166
 
167
 
168
1

powered by: WebSVN 2.1.0

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