f1473483d4715fc1e92de5b06fe76ff7253b59ae
2 # Copyright (c) 2006-2007 The Regents of The University of Michigan
5 # Redistribution and use in source and binary forms, with or without
6 # modification, are permitted provided that the following conditions are
7 # met: redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer;
9 # redistributions in binary form must reproduce the above copyright
10 # notice, this list of conditions and the following disclaimer in the
11 # documentation and/or other materials provided with the distribution;
12 # neither the name of the copyright holders nor the names of its
13 # contributors may be used to endorse or promote products derived from
14 # this software without specific prior written permission.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
40 from os
.path
import basename
, dirname
, exists
, isdir
, isfile
, join
as joinpath
43 path
= joinpath(*args
)
46 def touch(*args
, **kwargs
):
47 when
= kwargs
.get('when', None)
48 path
= joinpath(*args
)
52 path
= joinpath(*args
)
53 for match
in glob(path
):
60 path
= joinpath(*args
)
61 for match
in glob(path
):
65 def movedir(srcdir
, destdir
, dir):
66 src
= joinpath(srcdir
, dir)
67 dest
= joinpath(destdir
, dir)
72 os
.makedirs(dirname(dest
))
73 shutil
.move(src
, dest
)
76 sys
.exit('Not in the top level of an m5 tree!')
78 usage
= '%s <destdir> <release name>' % sys
.argv
[0]
80 if len(sys
.argv
) != 3:
84 releasename
= sys
.argv
[2]
85 release_dest
= joinpath(destdir
, 'release')
86 #encumbered_dest = joinpath(destdir, 'encumbered')
87 release_dir
= joinpath(release_dest
, releasename
)
88 #encumbered_dir = joinpath(encumbered_dest, releasename)
91 if not isdir(destdir
):
92 raise AttributeError, '%s exists, but is not a directory' % destdir
96 if exists(release_dest
):
97 if not isdir(release_dest
):
98 raise AttributeError, \
99 '%s exists, but is not a directory' % release_dest
102 #if exists(encumbered_dest):
103 # if not isdir(encumbered_dest):
104 # raise AttributeError, \
105 # '%s exists, but is not a directory' % encumbered_dest
106 # rmtree(encumbered_dest)
109 #mkdir(encumbered_dest)
111 #mkdir(encumbered_dir)
114 system('rsync -av --exclude ".hg*" --exclude build . %s' % release_dir
)
115 # move the time forward on some files by a couple of minutes so we can
116 # avoid building things unnecessarily
117 when
= int(time
.time()) + 120
119 # make sure scons doesn't try to run flex unnecessarily
120 #touch(release_dir, 'src/encumbered/eio/exolex.cc', when=(when, when))
122 # get rid of non-shipping code
123 #rmtree(release_dir, 'src/encumbered/dev')
124 rmtree(release_dir
, 'src/cpu/ozone')
125 rmtree(release_dir
, 'src/arch/x86')
126 #rmtree(release_dir, 'src/mem/cache/tags/split*.cc')
127 #rmtree(release_dir, 'src/mem/cache/tags/split*.hh')
128 #rmtree(release_dir, 'src/mem/cache/prefetch/ghb_*.cc')
129 #rmtree(release_dir, 'src/mem/cache/prefetch/ghb_*.hh')
130 #rmtree(release_dir, 'src/mem/cache/prefetch/stride_*.cc')
131 #rmtree(release_dir, 'src/mem/cache/prefetch/stride_*.hh')
132 rmtree(release_dir
, 'configs/fullsys')
133 rmtree(release_dir
, 'configs/test')
134 rmtree(release_dir
, 'configs/splash2')
135 rmtree(release_dir
, 'tests/long/*/ref')
136 rmtree(release_dir
, 'tests/old')
137 rmtree(release_dir
, 'tests/quick/00.hello/ref/x86')
138 rmtree(release_dir
, 'tests/quick/02.insttest')
139 rmtree(release_dir
, 'tests/test-progs/hello/bin/x86')
140 rmtree(release_dir
, 'src/dev/x86')
142 remove(release_dir
, 'src/cpu/nativetrace.hh')
143 remove(release_dir
, 'src/cpu/nativetrace.cc')
144 remove(release_dir
, 'build_opts/X86_SE')
145 remove(release_dir
, 'build_opts/X86_FS')
147 # get rid of some of private scripts
148 remove(release_dir
, 'util/chgcopyright')
149 remove(release_dir
, 'util/make_release.py')
151 def remove_sources(regex
, subdir
):
152 script
= joinpath(release_dir
, subdir
, 'SConscript')
153 if isinstance(regex
, str):
154 regex
= re
.compile(regex
)
155 inscript
= file(script
, 'r').readlines()
156 outscript
= file(script
, 'w')
157 for line
in inscript
:
158 if regex
.match(line
):
161 outscript
.write(line
)
164 def remove_lines(s_regex
, e_regex
, f
):
165 f
= joinpath(release_dir
, f
)
166 if isinstance(s_regex
, str):
167 s_regex
= re
.compile(s_regex
)
168 if isinstance(e_regex
, str):
169 e_regex
= re
.compile(e_regex
)
170 inscript
= file(f
, 'r').readlines()
171 outscript
= file(f
, 'w')
173 for line
in inscript
:
174 if (not skipping
and s_regex
.match(line
)) or \
175 (e_regex
and skipping
and not e_regex
.match(line
)):
180 outscript
.write(line
)
183 def replace_line(s_regex
, f
, rl
):
184 f
= joinpath(release_dir
, f
)
185 if isinstance(s_regex
, str):
186 s_regex
= re
.compile(s_regex
)
187 inscript
= file(f
, 'r').readlines()
188 outscript
= file(f
, 'w')
189 for line
in inscript
:
190 if s_regex
.match(line
):
193 outscript
.write(line
)
197 # fix up the SConscript to deal with files we've removed
198 #remove_sources(r'.*split.*\.cc', 'src/mem/cache/tags')
199 #remove_sources(r'.*(ghb|stride)_prefetcher\.cc', 'src/mem/cache/prefetch')
200 remove_sources(r
'.*nativetrace.*', 'src/cpu')
202 remove_lines(r
'.*X86.*', None, 'src/arch/isa_specific.hh')
203 #remove_lines(r'.*X86.*', None, 'src/base/traceflags.py')
204 remove_lines(r
'.*X86.*', None, 'AUTHORS')
205 remove_lines(r
'.*X86.*', None, 'src/base/loader/object_file.hh')
206 remove_lines(r
'.*_X86_.*', '.*else.*', 'src/base/loader/elf_object.cc')
207 remove_lines(r
'.*X86_ISA.*', r
'^.el.*','src/sim/process.cc')
208 remove_lines(r
'.*x86.*', r
'.*mips.*','src/cpu/BaseCPU.py')
209 remove_lines(r
'.*X86_ISA.*', r
'^.*else.*','src/cpu/o3/dyn_inst.hh')
210 remove_lines(r
'.*X86_ISA.*', r
'.*stay.*','src/cpu/simple/base.cc')
211 remove_lines(r
'.*x86.*', r
'^if.*','src/cpu/SConscript')
213 remove_lines(r
'.*makeX86System.*', r
'.*makeDualRoot.*','configs/common/FSConfig.py')
214 remove_lines(r
'.*X86.*', None, 'configs/example/fs.py')
215 remove_lines(r
'.*x86.*', None, 'configs/example/fs.py')
217 replace_line(r
'.*X86_SE.*', 'util/regress', " 'SPARC_SE,SPARC_FS',")
218 benches
= [ 'bzip2', 'eon', 'gzip', 'mcf', 'parser', 'perlbmk',
220 for bench
in benches
:
221 rmtree(release_dir
, 'tests', 'test-progs', bench
)
223 #movedir(release_dir, encumbered_dir, 'src/encumbered')
224 rmtree(release_dir
, 'tests/test-progs/anagram')
225 rmtree(release_dir
, 'tests/quick/20.eio-short')
227 def taritup(directory
, destdir
, filename
):
228 basedir
= dirname(directory
)
229 tarball
= joinpath(destdir
, filename
)
230 tardir
= basename(directory
)
232 system('cd %s; tar cfj %s %s' % (basedir
, tarball
, tardir
))
234 taritup(release_dir
, destdir
, '%s.tar.bz2' % releasename
)
235 #taritup(encumbered_dir, destdir, '%s-encumbered.tar.bz2' % releasename)
237 print "release created in %s" % destdir
238 print "don't forget to tag the repository!"