[csw-devel] SF.net SVN: gar:[9141] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat Mar 13 18:39:05 CET 2010
Revision: 9141
http://gar.svn.sourceforge.net/gar/?rev=9141&view=rev
Author: wahwah
Date: 2010-03-13 17:39:05 +0000 (Sat, 13 Mar 2010)
Log Message:
-----------
mGAR v2: checkpkg, allow dashes in host names; fix a bug in the regex; add a unit test. References: http://lists.opencsw.org/pipermail/maintainers//2010-March/011576.html
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg.py
csw/mgar/gar/v2/lib/python/checkpkg_test.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py 2010-03-13 17:30:05 UTC (rev 9140)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py 2010-03-13 17:39:05 UTC (rev 9141)
@@ -31,7 +31,7 @@
DO_NOT_REPORT_MISSING = set([])
DO_NOT_REPORT_MISSING_RE = [r"SUNW.*", r"\*SUNW.*"]
DUMP_BIN = "/usr/ccs/bin/dump"
-PSTAMP_RE = r"(?P<username>\w)+@(?P<hostname>[\w\.]+)-(?P<timestamp>\d+)"
+PSTAMP_RE = r"(?P<username>\w+)@(?P<hostname>[\w\.-]+)-(?P<timestamp>\d+)"
DESCRIPTION_RE = r"^([\S]+) - (.*)$"
SYSTEM_SYMLINKS = (
Modified: csw/mgar/gar/v2/lib/python/checkpkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-03-13 17:30:05 UTC (rev 9140)
+++ csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-03-13 17:39:05 UTC (rev 9141)
@@ -1,6 +1,7 @@
#!/opt/csw/bin/python2.6
# $Id$
+import re
import unittest
import mox
import difflib
@@ -827,6 +828,15 @@
result = "Maciej Blizinski"
self.assertEqual(result, checkpkg.ExtractMaintainerName(data))
+ def testPstampRegex(self):
+ pstamp = "hson at solaris9s-csw-20100313144445"
+ expected = {
+ 'username': 'hson',
+ 'timestamp': '20100313144445',
+ 'hostname': 'solaris9s-csw'
+ }
+ self.assertEqual(expected, re.match(checkpkg.PSTAMP_RE, pstamp).groupdict())
+
if __name__ == '__main__':
unittest.main()
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