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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Dec 27 13:25:56 CET 2010


Revision: 12095
          http://gar.svn.sourceforge.net/gar/?rev=12095&view=rev
Author:   wahwah
Date:     2010-12-27 12:25:56 +0000 (Mon, 27 Dec 2010)

Log Message:
-----------
checkpkg: Moving PSTAMP_RE to common_constants

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

Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py	2010-12-27 12:25:29 UTC (rev 12094)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py	2010-12-27 12:25:56 UTC (rev 12095)
@@ -20,7 +20,6 @@
 import package_stats
 
 
-PSTAMP_RE = r"(?P<username>\w+)@(?P<hostname>[\w\.-]+)-(?P<timestamp>\d+)"
 DESCRIPTION_RE = r"^([\S]+) - (.*)$"
 BAD_CONTENT_REGEXES = (
     # Slightly obfuscating these by using concatenation of strings.
@@ -87,7 +86,7 @@
 
 
 def ExtractBuildUsername(pkginfo):
-  m = re.match(PSTAMP_RE, pkginfo["PSTAMP"])
+  m = re.match(common_constants.PSTAMP_RE, pkginfo["PSTAMP"])
   return m.group("username") if m else None
 
 

Modified: csw/mgar/gar/v2/lib/python/checkpkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_test.py	2010-12-27 12:25:29 UTC (rev 12094)
+++ csw/mgar/gar/v2/lib/python/checkpkg_test.py	2010-12-27 12:25:56 UTC (rev 12095)
@@ -15,6 +15,7 @@
 import sqlite3
 import sqlobject
 import test_base
+import common_constants
 
 from testdata.tree_stats import pkgstats as tree_stats
 from testdata.neon_stats import pkgstats as neon_stats
@@ -57,7 +58,7 @@
         'timestamp': '20100313144445',
         'hostname': 'solaris9s-csw'
     }
-    self.assertEqual(expected, re.match(checkpkg.PSTAMP_RE, pstamp).groupdict())
+    self.assertEqual(expected, re.match(common_constants.PSTAMP_RE, pstamp).groupdict())
 
 
 class SliceListUnitTest(unittest.TestCase):

Modified: csw/mgar/gar/v2/lib/python/common_constants.py
===================================================================
--- csw/mgar/gar/v2/lib/python/common_constants.py	2010-12-27 12:25:29 UTC (rev 12094)
+++ csw/mgar/gar/v2/lib/python/common_constants.py	2010-12-27 12:25:56 UTC (rev 12095)
@@ -66,3 +66,5 @@
 DO_NOT_REPORT_SURPLUS = [r"^CSWcommon$", r"^CSWcswclassutils$", r"^CSWcas-", r"^CSWisaexec$"]
 DO_NOT_REPORT_SURPLUS_FOR = [r"CSW[a-z\-]+dev(el)?"]
 DO_NOT_REPORT_MISSING_RE = [r"\*?SUNW.*"]
+
+PSTAMP_RE = r"(?P<username>\w+)@(?P<hostname>[\w\.-]+)-(?P<timestamp>\d+)"

Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-27 12:25:29 UTC (rev 12094)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-27 12:25:56 UTC (rev 12095)
@@ -578,7 +578,7 @@
 def CheckPstamp(pkg_data, error_mgr, logger, messenger):
   pkginfo = pkg_data["pkginfo"]
   if "PSTAMP" in pkginfo:
-    if not re.match(checkpkg.PSTAMP_RE, pkginfo["PSTAMP"]):
+    if not re.match(common_constants.PSTAMP_RE, pkginfo["PSTAMP"]):
       msg=("It should be 'username at hostname-timestamp', "
            "but it's %s." % repr(pkginfo["PSTAMP"]))
       error_mgr.ReportError("pkginfo-pstamp-in-wrong-format", pkginfo["PSTAMP"], msg)


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