changeset 8ab6738c5f66 in /z/repo/gem5
details: http://repo.gem5.org/gem5?cmd=changeset;node=8ab6738c5f66
description:
sim: allow forward dependencies in checkpoint upgraders
The notion of forward dependencies is just expressing the same
dependency but at the other end of the dependency edge, i.e. at
the dependee rather than the depender. As there is no more
'power' here, it's strictly a convenience feature for handling
dependencies with tags that are not in the upstream repository.
Change-Id: Ic7c68de6aff4094aaa12de62cdf690a5dc65ccb5
Reviewed-by: Andreas Sandberg <[email protected]>
diffstat:
util/cpt_upgrader.py | 36 ++++++++++++++++++++++++++++++++++++
1 files changed, 36 insertions(+), 0 deletions(-)
diffs (60 lines):
diff -r 29f0d1d70282 -r 8ab6738c5f66 util/cpt_upgrader.py
--- a/util/cpt_upgrader.py Tue Feb 14 15:09:18 2017 -0600
+++ b/util/cpt_upgrader.py Tue Feb 14 15:09:18 2017 -0600
@@ -64,6 +64,14 @@
# its upgrader (or downgrader) can run. It is still the case that a tag
# can only be used once.
+# Dependencies between tags are expressed by two variables at the top-level
+# of the upgrader script: "depends" can be either a string naming another
+# tag that it depends upon or a list of such strings; and "fwd_depends"
+# accepts the same datatypes but it reverses the sense of the dependency
+# arrow(s) -- it expresses that that tag depends upon the tag of the current
+# upgrader. This can be especially valuable when maintaining private
+# upgraders in private branches.
+
import ConfigParser
import glob, types, sys, os
@@ -94,6 +102,20 @@
elif isinstance(self.depends, str):
self.depends = [self.depends]
+ if not isinstance(self.depends, list):
+ print "Error: 'depends' for %s is the wrong type" % self.tag
+ sys.exit(1)
+
+ if hasattr(self, 'fwd_depends'):
+ if isinstance(self.fwd_depends, str):
+ self.fwd_depends = [self.fwd_depends]
+ else:
+ self.fwd_depends = []
+
+ if not isinstance(self.fwd_depends, list):
+ print "Error: 'fwd_depends' for %s is the wrong type" % self.tag
+ sys.exit(1)
+
if hasattr(self, 'upgrader'):
if not isinstance(self.upgrader, types.FunctionType):
print "Error: 'upgrader' for %s is %s, not function" \
@@ -148,6 +170,20 @@
Upgrader.legacy[i].depends = [Upgrader.legacy[i-1].tag]
i = i + 1
+ # resolve forward dependencies and audit normal dependencies
+ for tag, upg in Upgrader.by_tag.items():
+ for fd in upg.fwd_depends:
+ if fd not in Upgrader.by_tag:
+ print "Error: '%s' cannot (forward) depend on "\
+ "nonexistent tag '%s'" % (fd, tag)
+ sys.exit(1)
+ Upgrader.by_tag[fd].depends.append(tag)
+ for dep in upg.depends:
+ if dep not in Upgrader.by_tag:
+ print "Error: '%s' cannot depend on "\
+ "nonexistent tag '%s'" % (tag, dep)
+ sys.exit(1)
+
def process_file(path, **kwargs):
if not osp.isfile(path):
import errno
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev