commit:     4834c9751340622feb34f4c3d747517826499788
Author:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 22 10:10:27 2016 +0000
Commit:     Magnus Granberg <zorry <AT> gentoo <DOT> org>
CommitDate: Thu Dec 22 10:10:27 2016 +0000
URL:        
https://gitweb.gentoo.org/proj/tinderbox-cluster.git/commit/?id=4834c975

add git commit msg

 pym/tbc/db_mapping.py |  1 +
 pym/tbc/package.py    | 14 ++++++++++----
 pym/tbc/sqlquerys.py  |  2 +-
 3 files changed, 12 insertions(+), 5 deletions(-)

diff --git a/pym/tbc/db_mapping.py b/pym/tbc/db_mapping.py
index aba6ee1..964df54 100644
--- a/pym/tbc/db_mapping.py
+++ b/pym/tbc/db_mapping.py
@@ -287,6 +287,7 @@ class EbuildsMetadata(Base):
        Id =  Column('id', Integer, primary_key=True)
        EbuildId = Column('ebuild_id', ForeignKey('ebuilds.ebuild_id'))
        Commit = Column('commit', String(100))
+       CommitMsg = Column('git_commit_msg', String(200))
        New = Column('new', Boolean, default=False)
        Updated = Column('updated', Boolean, default=False)
        Descriptions = Column('descriptions', Text)

diff --git a/pym/tbc/package.py b/pym/tbc/package.py
index 3c5664c..4bbb63e 100644
--- a/pym/tbc/package.py
+++ b/pym/tbc/package.py
@@ -92,10 +92,14 @@ class tbc_package(object):
        def get_git_log_ebuild(self, repodir, ebuild_file):
                git_log_ebuild = ''
                g = git.Git(repodir)
+               index = 1
+               git_log_dict = {}
                for line in g.log('-n 1', ebuild_file).splitlines():
-                       if re.search('^commit', line):
-                               git_log_ebuild = re.sub('commit', '', line)
-               return git_log_ebuild
+                       git_log_dict[index] = line
+                       index = index + 1
+               git_ebuild_commit = re.sub('commit ', '', git_log_dict[1])
+               git_ebuild_commit_msg = re.sub('    ', '', git_log_dict[5])
+               return git_ebuild_commit, git_ebuild_commit_msg
 
        def get_packageDict(self, pkgdir, cpv, repo):
 
@@ -115,9 +119,10 @@ class tbc_package(object):
                        log_msg = "C %s:%s ... Fail." % (cpv, repo)
                        write_log(self._session, log_msg, "info", 
self._config_id, 'packages.get_packageDict')
                        git_commit = '0'
+                       git_commit_msg = '0'
                else:
                        repodir =self._myportdb.getRepositoryPath(repo)
-                       git_commit = self.get_git_log_ebuild(repodir, 
ebuild_file)
+                       git_commit, git_commit_msg = 
self.get_git_log_ebuild(repodir, ebuild_file)
 
                # Get the ebuild metadata
                ebuild_version_metadata_tree = self.get_ebuild_metadata(cpv, 
repo)
@@ -140,6 +145,7 @@ class tbc_package(object):
                attDict['ebuild_version_metadata_tree'] = 
ebuild_version_metadata_tree
                #attDict['ebuild_version_text_tree'] = 
ebuild_version_text_tree[0]
                attDict['git_commit'] = git_commit
+               attDict['git_commit_msg'] = git_commit_msg
                attDict['new'] = False
                attDict['updated'] = False
                attDict['ebuild_version_descriptions_tree'] = 
ebuild_version_metadata_tree[7]

diff --git a/pym/tbc/sqlquerys.py b/pym/tbc/sqlquerys.py
index c9141ef..1d69151 100644
--- a/pym/tbc/sqlquerys.py
+++ b/pym/tbc/sqlquerys.py
@@ -430,7 +430,7 @@ def add_new_ebuild_sql(session, packageDict):
                        except (MultipleResultsFound) as e:
                                # FIXME
                                sys.exit()
-               session.add(EbuildsMetadata(EbuildId = EbuildInfo.EbuildId, New 
= v['new'], Updated = v['updated'], Commit = v['git_commit'], Descriptions = 
v['ebuild_version_descriptions_tree']))
+               session.add(EbuildsMetadata(EbuildId = EbuildInfo.EbuildId, New 
= v['new'], Updated = v['updated'], Commit = v['git_commit'], CommitMsg = 
v['git_commit_msg'], Descriptions = v['ebuild_version_descriptions_tree']))
                session.commit()
                ebuild_id_list.append(EbuildInfo.EbuildId)
                restrictions = []

Reply via email to