import rpmlint config from local git cache
authorLin Yang <lin.a.yang@intel.com>
Mon, 11 Mar 2013 07:43:25 +0000 (15:43 +0800)
committerLin Yang <lin.a.yang@intel.com>
Mon, 11 Mar 2013 07:43:25 +0000 (15:43 +0800)
Origin implementation is copy rpmlint config from jenkins local git
cache to default location ~/.config/rpmlint when scm/rpmlint-config
project updated. Now it will try to import rpmlint config from local
git cache at first, then ~/.config/rpmlint.

Change-Id: I717f6d337c313c45dcce265244bf97c4e887fdd9
Signed-off-by: Lin Yang <lin.a.yang@intel.com>
common/rpmlint.py
job_submitobs.py

index 765247f..630fbf5 100644 (file)
@@ -80,7 +80,12 @@ def rpmlint(spec_file):
     # the tempfile is designed for python policycheck.py, bash script doesn't use it
 
     try:
-        execfile(os.path.expanduser('~/.config/rpmlint'))
+        rpmlint_config = os.path.join(os.getenv('GIT_CACHE_DIR'),
+                                      os.getenv('RPMLINT_PRJ'),
+                                      'rpmlint')
+        if not os.path.isfile(rpmlint_config):
+            rpmlint_config = '~/.config/rpmlint'
+        execfile(os.path.expanduser(rpmlint_config))
     except IOError:
         pass
 
index 1154b2b..8156a5f 100755 (executable)
@@ -227,15 +227,6 @@ def main():
     if not clone_gitproject(GERRIT_PROJECT, prjdir):
         end('retry')
 
-    # if scm/rpmlint-config changed, update HOME/.config/rpmlint
-    print '\n', GERRIT_PROJECT, RPMLINT_PRJ
-    if GERRIT_PROJECT == RPMLINT_PRJ:
-        if not os.path.exists('%s/.config' % JENKINS_HOME):
-            os.makedirs('%s/.config' % JENKINS_HOME)
-        shutil.copy2('%s/rpmlint' % prjdir, '%s/.config/rpmlint' % JENKINS_HOME)
-        print '\nPulled scm/rpmlint-config change to local, exit now'
-        end('success')
-
     mygit = Git(prjdir)
     mygerrit = gerrit.Gerrit(GERRIT_HOSTNAME, GERRIT_USERNAME, GERRIT_SSHPORT)