#!/usr/bin/env python
-# Copyright (c) 2006 The Regents of The University of Michigan
+# Copyright (c) 2006-2007 The Regents of The University of Michigan
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
import re
import shutil
import sys
+import time
from glob import glob
from os import system
path = joinpath(*args)
os.mkdir(path)
-def touch(*args):
+def touch(*args, **kwargs):
+ when = kwargs.get('when', None)
path = joinpath(*args)
- os.utime(path, None)
+ os.utime(path, when)
def rmtree(*args):
path = joinpath(*args)
system('bk export -tplain -w -r+ %s' % release_dir)
+
+# move the time forward on some files by a couple of minutes so we can
+# avoid building things unnecessarily
+when = int(time.time()) + 120
+
# make sure scons doesn't try to run flex unnecessarily
-touch(release_dir, 'src/encumbered/eio/exolex.cc')
+touch(release_dir, 'src/encumbered/eio/exolex.cc', when=(when, when))
# get rid of non-shipping code
rmtree(release_dir, 'src/encumbered/dev')
rmtree(release_dir, 'configs/splash2')
rmtree(release_dir, 'tests/long/*/ref')
rmtree(release_dir, 'tests/old')
+rmtree(release_dir, 'src/dev/i8*')
# get rid of some of private scripts
remove(release_dir, 'util/chgcopyright')
remove(release_dir, 'util/make_release.py')
+def remove_sources(regex, subdir):
+ script = joinpath(release_dir, subdir, 'SConscript')
+ if isinstance(regex, str):
+ regex = re.compile(regex)
+ inscript = file(script, 'r').readlines()
+ outscript = file(script, 'w')
+ for line in inscript:
+ if regex.match(line):
+ continue
+
+ outscript.write(line)
+ outscript.close()
+
# fix up the SConscript to deal with files we've removed
-mem_expr = re.compile('.*mem/cache/(tags/split|prefetch/(ghb|stride)).*')
-inscript = file(joinpath(release_dir, 'src', 'SConscript'), 'r').readlines()
-outscript = file(joinpath(release_dir, 'src', 'SConscript'), 'w')
-for line in inscript:
- if mem_expr.match(line):
- continue
-
- outscript.write(line)
-outscript.close()
+remove_sources(r'.*split.*\.cc', 'src/mem/cache/tags')
+remove_sources(r'.*(ghb|stride)_prefetcher\.cc', 'src/mem/cache/prefetch')
+remove_sources(r'.*i8254xGBe.*', 'src/dev')
benches = [ 'bzip2', 'eon', 'gzip', 'mcf', 'parser', 'perlbmk',
'twolf', 'vortex' ]