give warning for multiply specfile under packaging
authorLin Yang <lin.a.yang@intel.com>
Fri, 7 Dec 2012 04:01:19 +0000 (12:01 +0800)
committerLin Yang <lin.a.yang@intel.com>
Thu, 28 Feb 2013 07:23:24 +0000 (15:23 +0800)
Change-Id: I5689a1fbd0744837d30cdfdd81b869960069af93
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
job_policycheck.py

index 0f3d2e5..2115991 100755 (executable)
@@ -137,7 +137,9 @@ if __name__ == '__main__':
         else:
             specfile = utils.find_spec('%s/%s' % (prjdir, packagingdir))
             if not specfile:
-                specfile = '%s/%s/%s.spec' % (prjdir, packagingdir, prj)
+                msg = "[ERROR]: Packaging directory contains multiply spec files, backend service can not decide which spec file to use. Please use OBS_PACKAGE parameter in scm/git-obs-mapping project to specify the target spec file or contact system administrator for more details."
+                mygerrit.review(commit = GERRIT_PATCHSET_REVISION, message = msg)
+                continue
         print('specfile %s' % specfile)
 
         # build the package under home project of backend service user
@@ -149,7 +151,7 @@ if __name__ == '__main__':
             print 'submit this change to OBS for build check...'
             temp_build = TempPackageBuild(OBS_API_URL, OBS_OSCRC_PATH, buildcheck_project, spec.name)
             if 'NoRepo' == temp_build.remote_build(obs_dest_prj, prjdir, 'GIT_PROJECT: %s\nCOMMIT_ID: %s\nOWNER_EMAIL: %s' % (GERRIT_PROJECT, GERRIT_PATCHSET_REVISION, GERRIT_CHANGE_OWNER_EMAIL)):
-                msg = "[BUILD CHECK RESULT] Can not test build against to project %s, which currently has no build targets defined. Please contact the build systerm administrator." %(obs_dest_prj)
+                msg = "[BUILD CHECK RESULT] Can not test build against to project %s, which currently has no build targets defined. Please contact the build system administrator." %(obs_dest_prj)
                 mygerrit.review(commit = GERRIT_PATCHSET_REVISION, message = msg)
         except Exception, err:
             print '%s' % err