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

Subversion Repositories socgen

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

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
my $parser = XML::LibXML->new();
91 134 jt_eaton
my $workspace_xml    = $parser->parse_file("${home}/workspace.xml");
92 131 jt_eaton
my @repos =();
93
my $repo;
94
 
95
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace/socgen:external/socgen:repo'))
96
                  {
97
                  my $repo_name  = $repo->findnodes('./socgen:name/text()')->to_literal ;
98
                  my $repo_path  = $repo->findnodes('./socgen:path/text()')->to_literal ;
99
                  print "cleaning $repo_name    \n";
100
                  if(-e  $repo_name)
101
                   {
102
                   print "Removing $repo_name  \n";
103
                   my $cmd = "rm -r $repo_name  \n";
104
                   if(system($cmd)){};
105
                   }
106
                  }
107
 
108
 
109
 
110
my $build_dir;
111
my $yp_dir;
112
my $doc_dir;
113
 
114
 
115
 
116
foreach my $repo ($workspace_xml->findnodes('//socgen:workspace'))
117
                  {
118
                  $build_dir       = $repo->findnodes('./socgen:build_dir/text()')->to_literal ;
119
                  $yp_dir          = $repo->findnodes('./socgen:yp_dir/text()')->to_literal ;
120
                  $doc_dir         = $repo->findnodes('./socgen:doc_dir/text()')->to_literal ;
121
                  }
122
 
123
 
124
if(-e $build_dir)
125
  {
126
  print "Removing $build_dir  \n";
127
  my $cmd = "rm -r ./${build_dir}  \n";
128
  if(system($cmd)){};
129
  }
130
 
131
 
132
if(-e $yp_dir)
133
  {
134
  print "Removing $yp_dir  \n";
135
  my $cmd = "rm -r ./${yp_dir}  \n";
136
  if(system($cmd)){};
137
  }
138
 
139
 
140
if(-e $doc_dir)
141
  {
142
  print "Removing $doc_dir  \n";
143
  my $cmd = "rm -r ./${doc_dir}  \n";
144
  if(system($cmd)){};
145
  }
146
 
147
 
148
1

powered by: WebSVN 2.1.0

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