[csw-devel] SF.net SVN: gar:[10268] csw/mgar/gar/v2/lib/python/checkpkg.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Jun 20 11:47:17 CEST 2010


Revision: 10268
          http://gar.svn.sourceforge.net/gar/?rev=10268&view=rev
Author:   wahwah
Date:     2010-06-20 09:47:17 +0000 (Sun, 20 Jun 2010)

Log Message:
-----------
mGAR v2: checkpkg, use rounded up seconds for db age detection.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py	2010-06-19 21:18:48 UTC (rev 10267)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py	2010-06-20 09:47:17 UTC (rev 10268)
@@ -464,9 +464,17 @@
   def IsDatabaseUpToDate(self):
     f_mtime = self.GetFileMtime()
     d_mtime = self.GetDatabaseMtime()
-    logging.debug("f_mtime %s, d_time: %s", f_mtime, d_mtime)
-    fresh = self.GetFileMtime() <= self.GetDatabaseMtime()
+    logging.debug("IsDatabaseUpToDate: f_mtime %s, d_time: %s", f_mtime, d_mtime)
+    # Rounding up to integer seconds.  There is a race condition: 
+    # pkgadd finishes at 100.1
+    # checkpkg reads /var/sadm/install/contents at 100.2
+    # new pkgadd runs and finishes at 100.3
+    # subsequent checkpkg runs won't pick up the last change.
+    # I don't expect pkgadd to run under 1s.
+    fresh = int(f_mtime) <= int(d_mtime)
     good_version = self.GetDatabaseSchemaVersion() >= DB_SCHEMA_VERSION
+    logging.debug("IsDatabaseUpToDate: fresh=%s, good_version=%s",
+                  repr(fresh), repr(good_version))
     return fresh and good_version
 
   def SoftDropTable(self, tablename):


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list