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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Thu Oct 7 05:16:32 CEST 2010


Revision: 11188
          http://gar.svn.sourceforge.net/gar/?rev=11188&view=rev
Author:   wahwah
Date:     2010-10-07 03:16:32 +0000 (Thu, 07 Oct 2010)

Log Message:
-----------
mGAR v2: submitpkg, fixed a bug in the interaction of ParseVersionString and submitpkg, where submitpkg expected hashable elements only, and ParseVersionString would return a extra_strings as a list.

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

Modified: csw/mgar/gar/v2/lib/python/opencsw.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw.py	2010-10-07 02:27:33 UTC (rev 11187)
+++ csw/mgar/gar/v2/lib/python/opencsw.py	2010-10-07 03:16:32 UTC (rev 11188)
@@ -150,6 +150,7 @@
   }
   return data
 
+
 def ParseVersionString(s):
   version_bits = re.split("_|,", s)
   version_str = version_bits[0]
@@ -170,6 +171,10 @@
       if not "extra_strings" in revision_info:
         revision_info["extra_strings"] = []
       revision_info["extra_strings"].append(version_bit)
+  # Bits of parsed version must be hashable; especially extra_strings in
+  # revision_info.
+  if "extra_strings" in revision_info:
+    revision_info["extra_strings"] = tuple(revision_info["extra_strings"])
   return version_str, version_info, revision_info
 
 

Modified: csw/mgar/gar/v2/lib/python/opencsw_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/opencsw_test.py	2010-10-07 02:27:33 UTC (rev 11187)
+++ csw/mgar/gar/v2/lib/python/opencsw_test.py	2010-10-07 03:16:32 UTC (rev 11188)
@@ -174,11 +174,28 @@
 
   def test_Empty(self):
     data = ""
-    opencsw.ParseVersionString(data)
     expected = ('', {'major version': ''}, {})
     self.assertEqual(expected, opencsw.ParseVersionString(data))
 
+  def testExtraStringsHashable(self):
+    data = "2.7,REV=2009.06.18_STABLE6"
+    expected = (
+        '2.7',
+        {
+          'minor version': '7',
+          'major version': '2'},
+        {
+          # Here's the important bit: all parts of the parsed version
+          # must be hashable for submitpkg to work.
+          'extra_strings': ('STABLE6',),
+          'REV': '2009.06.18',
+        }
+    )
+    result = opencsw.ParseVersionString(data)
+    hash(result[2]['extra_strings'])
+    self.assertEqual(expected, opencsw.ParseVersionString(data))
 
+
 class UpgradeTypeTest(unittest.TestCase):
 
   def testUpgradeType_1(self):


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