diff options
author | Rob Austein <sra@hactrn.net> | 2013-08-17 23:47:37 +0000 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2013-08-17 23:47:37 +0000 |
commit | 0672b56cb6894c4d0624f8247a4cbe62d41971d0 (patch) | |
tree | 9de95e9b77610b827348490f22f66c8d75bab361 | |
parent | c92f460d22062ef32bb7a1f7498123f86c6d5c5c (diff) |
Checkpoint.
svn path=/trunk/; revision=5456
-rwxr-xr-x | scripts/rcynic-lta | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/scripts/rcynic-lta b/scripts/rcynic-lta index 886b8868..515b5255 100755 --- a/scripts/rcynic-lta +++ b/scripts/rcynic-lta @@ -76,6 +76,9 @@ def main(): print "Processing targets" process_targets(rpdb) print + print "Processing ancestors" + process_ancestors(rpdb) + print print "Closing DB" rpdb.close() @@ -159,19 +162,39 @@ def process_targets(rpdb): if "sub" in y: new_resources = new_resources - rpki.resource_set.resource_bag.from_str(y["sub"]) - print "SKI:", obj.hSKI() - print "URI:", obj.uri - print "Old:", old_resources - print "New:", new_resources - print "Add:", new_resources - old_resources - print "Sub:", old_resources - new_resources + if False: + print "SKI:", obj.hSKI() + print "URI:", obj.uri + print "Old:", old_resources + print "New:", new_resources + print "Add:", new_resources - old_resources + print "Sub:", old_resources - new_resources obj.original = True obj.target = True rpdb.add_para(obj, new_resources) - # Continue from paragraph three of 4.2.2 ("target processing") +def process_ancestors(rpdb): + for target in rpdb.find_targets(): + target_resources = target.get_3779resources() + print + print "Target %r resources %s" % (target, target_resources) + child = target + while child.get_AKI() is not None: + parent = rpdb.find_parent(child) + print "Parent %r" % parent + if len(parent) > 1: + for p in parent: + print "nochain %s original %s para %s target %s" % (p.nochain, p.original, p.para, p.target) + #print p.get_POW().pprint() + parent = [p for p in parent if p.para] + print parent + assert len(parent) == 1 + parent = parent[0] + # ... + child = parent + class DER_object_mixin(object): """ @@ -243,6 +266,8 @@ class RPDB(object): mapfn2 = dict((v, k) for k, v in fn2map.iteritems()) + object_fields = " object.id, fn2, der, nochain, original, para, target " + def __init__(self, db_name = "rcynic-lta.db"): @@ -453,9 +478,6 @@ class RPDB(object): return self.find_by_id(rowid) - object_fields = " object.id, fn2, der, nochain, original, para, target " - - def find_by_id(self, rowid): return self._find_results(None, "SELECT" + self.object_fields + "FROM object WHERE id = ?", [rowid]) @@ -494,6 +516,15 @@ class RPDB(object): else: return self._find_results(fn2, "SELECT" + self.object_fields + "FROM object WHERE aki = ?", [buffer(aki)]) + def find_targets(self, fn2 = None): + return self._find_results(fn2, + "SELECT" + self.object_fields + "FROM object WHERE target <> 0 AND nochain = 0") + + def find_parent(self, child): + return self._find_results(None, + "SELECT" + self.object_fields + "FROM object WHERE subject = ? AND SKI = ?", + [child.getIssuer(), buffer(child.get_AKI())]) + def find_products(self, aki, issuer, fn2 = None): return self._find_results(fn2, |