]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
pfa-rpmlint: invalidate cache when rpmlintrc is changed
authorElan Ruusamäe <glen@pld-linux.org>
Tue, 4 Feb 2014 23:06:30 +0000 (01:06 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Mon, 21 Jul 2014 13:05:57 +0000 (16:05 +0300)
bin/pfa-lintpkg

index 010f6d34326f948ed8221581052e7c286076739b..c9ae5375dd2d653811a4825d2c96536202ab11d4 100755 (executable)
@@ -81,6 +81,12 @@ class LintPkg:
 
         self._rpmlint = '/usr/bin/rpmlint'
 
+        # mtime, which invalidates all caches
+        self.mtime = None
+        rpmlintrc = os.path.expanduser("~/.config/rpmlint")
+        if os.path.exists(rpmlintrc):
+            self.mtime = os.stat(rpmlintrc).st_mtime
+
         self.cachedir = os.path.expanduser(cachedir)
         if not os.path.isdir(self.cachedir):
             os.makedirs(self.cachedir)
@@ -149,7 +155,9 @@ class LintPkg:
         cachefile = self.cachefile(file)
 
         rc = None
-        if not os.path.exists(cachefile) or os.stat(file).st_mtime > os.stat(cachefile).st_mtime:
+        if not os.path.exists(cachefile) \
+            or os.stat(file).st_mtime > os.stat(cachefile).st_mtime \
+            or (self.mtime and self.mtime > os.stat(cachefile).st_mtime):
             cmd = [self._rpmlint, file]
             outfd = open(cachefile, 'w')
             try:
This page took 0.064018 seconds and 4 git commands to generate.