summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@gmail.com>2008-06-13 01:59:10 -0400
committerSteve Reinhardt <stever@gmail.com>2008-06-13 01:59:10 -0400
commitdace77dc4a9fd95650cb4fe967fe28179672d9a3 (patch)
tree76b4b2ac37d5e41d9a959e7839b9d5ed85952308
parentcaccbd1edcacc82a952429950fcd4314b86b5b89 (diff)
parent7e6728450fb7bb430f3fb96143cf3bc634407213 (diff)
downloadgem5-dace77dc4a9fd95650cb4fe967fe28179672d9a3.tar.xz
Automated merge with ssh://m5sim.org//repo/m5
-rw-r--r--configs/example/fs.py7
-rw-r--r--configs/example/se.py4
-rw-r--r--src/SConscript14
-rw-r--r--src/python/generate.py35
-rw-r--r--src/python/m5/main.py4
-rw-r--r--src/python/swig/core.i4
6 files changed, 62 insertions, 6 deletions
diff --git a/configs/example/fs.py b/configs/example/fs.py
index abfd3cc47..5b5d26c90 100644
--- a/configs/example/fs.py
+++ b/configs/example/fs.py
@@ -29,6 +29,10 @@
import optparse, os, sys
import m5
+
+if not m5.build_env['FULL_SYSTEM']:
+ m5.panic("This script requires full-system mode (*_FS).")
+
from m5.objects import *
m5.AddToPath('../common')
from FSConfig import *
@@ -37,9 +41,6 @@ from Benchmarks import *
import Simulation
from Caches import *
-if not m5.build_env['FULL_SYSTEM']:
- m5.panic("This script requires full-system mode (ALPHA_FS).")
-
# Get paths we might need. It's expected this file is in m5/configs/example.
config_path = os.path.dirname(os.path.abspath(__file__))
config_root = os.path.dirname(config_path)
diff --git a/configs/example/se.py b/configs/example/se.py
index 3d3f28a72..fa7959b99 100644
--- a/configs/example/se.py
+++ b/configs/example/se.py
@@ -31,6 +31,10 @@
# "m5 test.py"
import m5
+
+if m5.build_env['FULL_SYSTEM']:
+ m5.panic("This script requires syscall emulation mode (*_SE).")
+
from m5.objects import *
import os, optparse, sys
m5.AddToPath('../common')
diff --git a/src/SConscript b/src/SConscript
index 69c5b946d..e360611a0 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -332,6 +332,10 @@ env.Command('base/traceflags.hh', flags, generate.traceFlagsHH)
env.Command('base/traceflags.cc', flags, generate.traceFlagsCC)
Source('base/traceflags.cc')
+# Generate program_info.cc
+env.Command('base/program_info.cc',
+ Value(str(SCons.Node.FS.default_fs.SConstruct_dir)), generate.programInfo)
+
# Build the zip file
py_compiled = []
py_zip_depends = []
@@ -364,11 +368,19 @@ envList = []
# date.cc.
def make_objs(sources, env):
objs = [env.Object(s) for s in sources]
+
# make date.cc depend on all other objects so it always gets
# recompiled whenever anything else does
date_obj = env.Object('base/date.cc')
+
+ # Make the generation of program_info.cc dependend on all
+ # the other cc files and the compiling of program_info.cc
+ # dependent on all the objects but program_info.o
+ pinfo_obj = env.Object('base/program_info.cc')
+ env.Depends('base/program_info.cc', sources)
env.Depends(date_obj, objs)
- objs.append(date_obj)
+ env.Depends(pinfo_obj, objs)
+ objs.extend([date_obj,pinfo_obj])
return objs
# Function to create a new build environment as clone of current
diff --git a/src/python/generate.py b/src/python/generate.py
index eead6ff5d..f4d923870 100644
--- a/src/python/generate.py
+++ b/src/python/generate.py
@@ -31,8 +31,7 @@ import py_compile
import sys
import zipfile
-from os.path import basename
-from os.path import exists
+from os.path import basename, exists, isdir, join
class DictImporter(object):
'''This importer takes a dictionary of arbitrary module names that
@@ -527,3 +526,35 @@ extern const Flags *compoundFlags[];
'''
f.close()
+
+ def programInfo(self, target, source, env):
+ def gen_file(target, rev, node, date):
+ pi_stats = file(target, 'w')
+ print >>pi_stats, 'const char *hgRev = "%s:%s";' % (rev, node)
+ print >>pi_stats, 'const char *hgDate = "%s";' % date
+ pi_stats.close()
+
+ target = str(target[0])
+ scons_dir = eval(str(source[0]))
+ try:
+ import mercurial.demandimport, mercurial.hg, mercurial.ui
+ import mercurial.util, mercurial.node
+ if not exists(scons_dir) or not isdir(scons_dir) or \
+ not exists(join(scons_dir, ".hg")):
+ raise ValueError
+ repo = mercurial.hg.repository(mercurial.ui.ui(), scons_dir)
+ rev = mercurial.node.nullrev + repo.changelog.count()
+ changenode = repo.changelog.node(rev)
+ changes = repo.changelog.read(changenode)
+ date = mercurial.util.datestr(changes[2])
+
+ gen_file(target, rev, mercurial.node.hex(changenode), date)
+
+ mercurial.demandimport.disable()
+ except ImportError:
+ gen_file(target, "Unknown", "Unknown", "Unknown")
+
+ except:
+ print "in except"
+ gen_file(target, "Unknown", "Unknown", "Unknown")
+ mercurial.demandimport.disable()
diff --git a/src/python/m5/main.py b/src/python/m5/main.py
index 4bcca46d2..cbdd65492 100644
--- a/src/python/m5/main.py
+++ b/src/python/m5/main.py
@@ -268,6 +268,10 @@ def main():
print "M5 compiled %s" % internal.core.cvar.compileDate;
print "M5 started %s" % datetime.datetime.now().ctime()
print "M5 executing on %s" % socket.gethostname()
+
+ print "M5 revision %s" % internal.core.cvar.hgRev
+ print "M5 commit date %s" % internal.core.cvar.hgDate
+
print "command line:",
for argv in sys.argv:
print argv,
diff --git a/src/python/swig/core.i b/src/python/swig/core.i
index 770765ca4..567eff591 100644
--- a/src/python/swig/core.i
+++ b/src/python/swig/core.i
@@ -39,6 +39,8 @@
#include "sim/startup.hh"
extern const char *compileDate;
+extern const char *hgRev;
+extern const char *hgDate;
%}
%include "stdint.i"
@@ -51,6 +53,8 @@ void SimStartup();
void doExitCleanup();
char *compileDate;
+char *hgRev;
+char *hgDate;
void setClockFrequency(Tick ticksPerSecond);