From b002bc4e2bed7f49f6c3877339bf58c7d95eba10 Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Wed, 6 May 2015 16:18:29 -0400 Subject: Updated list tasks --- git_taskrepo/taskrepo.py | 41 ++++++++++++++--------------------------- 1 file changed, 14 insertions(+), 27 deletions(-) (limited to 'git_taskrepo/taskrepo.py') diff --git a/git_taskrepo/taskrepo.py b/git_taskrepo/taskrepo.py index 9028101..b53d782 100644 --- a/git_taskrepo/taskrepo.py +++ b/git_taskrepo/taskrepo.py @@ -4,18 +4,11 @@ import os import commands # Keys from testinfo to populate with -keys = ("test_archs", - "releases", - "runfor", +keys = ("runfor", "types", "bugs", ) -singles = ("test_name", - "test_description", - "owner", - ) - class TaskRepoException(Exception): pass @@ -43,30 +36,24 @@ def _update_taskrepo(taskrepo, taskname, testinfo): cur.execute("INSERT INTO tasks(name) VALUES (?)", (taskname,)) taskid = cur.lastrowid; - # Clear old values - cur.execute("DELETE FROM key_value_inc WHERE task_id=?", (taskid,)) - cur.execute("DELETE FROM key_value_exc WHERE task_id=?", (taskid,)) + # Update description and owner + cur.execute("UPDATE tasks SET description = ?, owner = ? WHERE id = ? ", + (only_ascii(testinfo.test_description), + only_ascii(testinfo.owner), + taskid)) - # Populate with new values for key in keys: + # Clear old values + cur.execute("DELETE FROM %s WHERE task_id=?" % key, (taskid,)) + # Populate with new values for value in getattr(testinfo, key): - if value and type(value) == type(str()) and value[0] == '-': - table = "key_value_exc" - value = value[1:] - else: - table = "key_value_inc" - cur.execute("INSERT INTO %s VALUES (?,?,?)" % table, (taskid, key, value)) - for key in singles: - value = only_ascii(getattr(testinfo, key)) - cur.execute("INSERT INTO key_value_inc VALUES (?,?,?)", (taskid, key, value)) + cur.execute("INSERT INTO %s VALUES (?,?)" % key, (taskid, value)) def update_taskrepo(repo, taskrepo, taskpath): - if os.path.exists(os.path.join(taskpath, "Makefile")): - (status, output) = commands.getstatusoutput("make -C %s -q testinfo.desc" % taskpath) - if status == 1: - os.system("make -C %s testinfo.desc" % taskpath) - if os.path.exists(os.path.join(taskpath, "testinfo.desc")): - taskname = taskpath.split(repo.working_tree_dir)[1] + if os.path.isfile(os.path.join(taskpath, "Makefile")): + os.system("make -ki -C %s testinfo.desc >/dev/null 2>&1" % taskpath) + if os.path.isfile(os.path.join(taskpath, "testinfo.desc")): + taskname = taskpath.split("%s/" % repo.working_tree_dir)[1] try: testinfo = parse_testinfo(os.path.join(taskpath, "testinfo.desc")) except ParserError: -- cgit