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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Jan 29 16:47:01 CET 2011


Revision: 13104
          http://gar.svn.sourceforge.net/gar/?rev=13104&view=rev
Author:   wahwah
Date:     2011-01-29 15:47:01 +0000 (Sat, 29 Jan 2011)

Log Message:
-----------
checkpkg: OpencswCatalog understands i_deps

Better parsing of the catalog format.  Deps and i-deps returned as
tuples.

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

Property Changed:
----------------
    csw/mgar/gar/v2/lib/python/catalog_test.py

Modified: csw/mgar/gar/v2/lib/python/catalog.py
===================================================================
--- csw/mgar/gar/v2/lib/python/catalog.py	2011-01-29 15:46:28 UTC (rev 13103)
+++ csw/mgar/gar/v2/lib/python/catalog.py	2011-01-29 15:47:01 UTC (rev 13104)
@@ -96,12 +96,12 @@
             r"(?P<deps>\S+)"
             r"\s+"
             # none
-            r"(?P<none_thing_1>\S+)"
+            r"(?P<category>\S+)"
             # An optional empty field.
             r"("
               r"\s+"
               # none\n'
-              r"(?P<none_thing_2>\S+)"
+              r"(?P<i_deps>\S+)"
             r")?"
             r"$"
         ),
@@ -109,6 +109,14 @@
     cline_re_list = [re.compile(x) for x in cline_re_str_list]
     matched = False
     d = None
+    def SplitPkgList(pkglist):
+      if not pkglist:
+        pkglist = ()
+      elif pkglist == "none":
+        pkglist = ()
+      else:
+        pkglist = tuple(pkglist.split("|"))
+      return pkglist
     for cline_re in cline_re_list:
       m = cline_re.match(line)
       if m:
@@ -116,6 +124,8 @@
         matched = True
         if not d:
           raise CatalogLineParseError("Parsed %s data is empty" % repr(line))
+        d["deps"] = SplitPkgList(d["deps"])
+        d["i_deps"] = SplitPkgList(d["i_deps"])
     if not matched:
       raise CatalogLineParseError("No regexes matched %s" % repr(line))
     return d

Modified: csw/mgar/gar/v2/lib/python/catalog_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/catalog_test.py	2011-01-29 15:46:28 UTC (rev 13103)
+++ csw/mgar/gar/v2/lib/python/catalog_test.py	2011-01-29 15:47:01 UTC (rev 13104)
@@ -14,11 +14,11 @@
     oc = catalog.OpencswCatalog(None)
     parsed = oc._ParseCatalogLine(line)
     expected = {'catalogname': 'tmux',
-                'deps': 'CSWcommon|CSWlibevent',
+                'deps': ('CSWcommon', 'CSWlibevent'),
                 'file_basename': 'tmux-1.2,REV=2010.05.17-SunOS5.9-sparc-CSW.pkg.gz',
                 'md5sum': '145351cf6186fdcadcd169b66387f72f',
-                'none_thing_1': 'none',
-                'none_thing_2': 'none',
+                'category': 'none',
+                'i_deps': (),
                 'pkgname': 'CSWtmux',
                 'size': '214091',
                 'version': '1.2,REV=2010.05.17'}


Property changes on: csw/mgar/gar/v2/lib/python/catalog_test.py
___________________________________________________________________
Added: svn:executable
   + *


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