reject submission if doesn't have changelog update
authorLin Yang <lin.a.yang@intel.com>
Wed, 19 Dec 2012 09:15:44 +0000 (17:15 +0800)
committerLin Yang <lin.a.yang@intel.com>
Thu, 28 Feb 2013 08:00:30 +0000 (16:00 +0800)
Change-Id: I7759009c885311e2c4fc01c0e977e7cee7b6bb53
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
job_submitobs.py

index d0d8812..46a8bf9 100755 (executable)
@@ -153,9 +153,11 @@ def update_gerritinfo(obspkg, gitprj, commitid):
 
 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
@@ -253,17 +255,19 @@ def check_changes(obspkg, name, mygerrit, tag, tagger):
     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