diff options
-rw-r--r-- | populate-db.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/populate-db.py b/populate-db.py index 1fbd327..07b23bc 100644 --- a/populate-db.py +++ b/populate-db.py @@ -57,9 +57,20 @@ rats_tests = [ 'http://fedoraproject.org/wiki/QA:Yum_simple_update_test_case'), ] +treedata = [ +# These 3 items correspond to the Fedora 11 trees +{'arch':'i386', + 'compose_id':2009060201, 'tree_time':1243980101, 'repodata_time':1243979414}, +{'arch':'x86_64', + 'compose_id':2009060201, 'tree_time':1243980953, 'repodata_time':1243980178}, +{'arch':'ppc', + 'compose_id':2009060201, 'tree_time':1243981037, 'repodata_time':1243979681}, +] + def setup_database(): # Load the models from israwhidebroken import model + from sqlobject import AND # Add tests to the test table for (n, sd, u) in rats_tests: @@ -69,9 +80,19 @@ def setup_database(): test = model.Test(name=n, short_desc=sd, uri=u) else: print "Test(%s) already exists" % n + # Add example trees + for t in treedata: + exists = model.Tree.select(AND(model.Tree.q.arch == t['arch'], + model.Tree.q.compose_id == t['compose_id'])) + if exists.count() == 0: + print "adding Tree(%u-%s)" % (t['compose_id'], t['arch']) + tree = model.Tree(**t) + else: + print "Tree(%u-%s) already exists" % (t['compose_id'], t['arch']) + model.hub.commit() - # TODO: add a couple of example trees / results + # TODO: add a couple of example results print "Successfully setup" |