def feedback(msg, tag, tagger, mygerrit):
""" post message back to gerrit and send mail to tag owner """
- mygerrit.review(commit = GERRIT_PATCHSET_REVISION, message = msg)
- msg = 'Hi, %s,\n\n' % tagger['author'] + msg + '\n\n----------------------------------------------------------------\nAutomatically generated by backend service.\nPlease DO NOT Reply!'
- prepare_mail("%s.mail.env" % random.random(), TITLE_FAILED % (tag, GERRIT_PROJECT), msg, NOREPLY_EMAIL_SENDER, tagger['email'])
+ # current disable post comment to gerrit
+ #mygerrit.review(commit = GERRIT_PATCHSET_REVISION, message = msg)
+ if tagger.has_key('author') and tagger.has_key('email'):
+ msg = 'Hi, %s,\n\n' % tagger['author'] + msg + '\n\n----------------------------------------------------------------\nAutomatically generated by backend service.\nPlease DO NOT Reply!'
+ prepare_mail("%s.mail.env" % random.random(), TITLE_FAILED % (tag, GERRIT_PROJECT), msg, NOREPLY_EMAIL_SENDER, tagger['email'])
def end(result = 'success'):
print 'execute result: %s' % result
if st in ['?', '!', 'D']:
# can not find changelog file under packaging directory
title = '[Warning] no changelog file found in submission: [%s] of %s' % (tag, GERRIT_PROJECT)
- msg = '[Warning] The "%s" branch of "%s" project does NOT contain change file under packaging directory! Please create "packaging/%s" and document the bug fix and/or features in this changelog file before your submission.' % (GERRIT_BRANCH, GERRIT_PROJECT, changelog)
+ msg = '[Error] The "%s" branch of "%s" project does NOT contain change file under packaging directory! Please create "packaging/%s" and document the bug fix and/or features in this changelog file before your submission.' % (GERRIT_BRANCH, GERRIT_PROJECT, changelog)
elif st == ' ':
# this submission didn't modify changelog file
title = '[Warning] no new changelog entry in submission: [%s] of %s' % (tag, GERRIT_PROJECT)
- msg = '[Warning] Compare to last submission, this one (tag %s) does not contain any new entry for packaging/%s! Please add a new entry in change log to document the bug fix and/or feature before your submission. You can use "gbs changelog" to generate new entry, for details please refer to: https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-changelog' % (tag, changelog)
+ msg = '[Error] Compare to last submission, this one (tag %s) does not contain any new entry for packaging/%s! Please add a new entry in change log to document the bug fix and/or feature before your submission. You can use "gbs changelog" to generate new entry, for details please refer to: https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-changelog' % (tag, changelog)
elif st in ['M', 'A']:
print 'This submission has updated changes file.'
print 'changes file status:', changelog, st, msg
if msg:
feedback(msg, tag, tagger, mygerrit)
+ # current still follow origin process if no changelog update
+ #end('failure')
def main():
# global variable