diff options
author | 2013-07-30 01:38:23 +0300 | |
---|---|---|
committer | 2013-07-30 01:38:23 +0300 | |
commit | 7ba5f957c082545a9eb097839fdc7eba826a7d80 (patch) | |
tree | cb10b75ef04167ea7ac127f5fb882b11fdc4cfe5 /portage_processor.py | |
parent | Add hostname to schema (diff) | |
download | log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.tar.gz log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.tar.bz2 log-analysis-7ba5f957c082545a9eb097839fdc7eba826a7d80.zip |
Implement additional metadata storage for logs received from Portage
Flags like 'pkg_failed', 'test_failed', etc. are stored once per group.
This is a discussion item, as it might make sense to store some data
once per file instead.
Diffstat (limited to 'portage_processor.py')
-rw-r--r-- | portage_processor.py | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/portage_processor.py b/portage_processor.py index 32ca9c4..252209e 100644 --- a/portage_processor.py +++ b/portage_processor.py @@ -1,4 +1,5 @@ import os, re, StringIO, time +from portage_database import PortageDatabaseConnection class PortageProcessor: _r = { @@ -14,16 +15,17 @@ class PortageProcessor: self.storage = storage def process(self, request, source, db): + db = PortageDatabaseConnection(db) group_id = db.insert_group(source, request.group_name, 'portage', int(time.time())) - for f in request.files: - matches = 0 - pkg_failed = False - test_failed = False - collision = False - bug_assignee = 'bug-wranglers@gentoo.org' - bug_cc = '' + matches = 0 + pkg_failed = False + test_failed = False + collision = False + bug_assignee = 'bug-wranglers@gentoo.org' + bug_cc = '' + for f in request.files: # TODO: look at proper HTML generation methods: # (*) either XHTML via xml.etree # (*) or Jinja2 (is it possible to parse and generate in one pass?) @@ -74,3 +76,5 @@ class PortageProcessor: self.storage.save_file(source, f.filename, output.getvalue()) file_id = db.insert_file(os.path.join(source, f.filename), group_id) + + db.insert_group_extra(group_id, 'TODO', matches, pkg_failed, test_failed, collision, bug_assignee, bug_cc) |