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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Feb 9 08:52:43 CET 2011


Revision: 13239
          http://gar.svn.sourceforge.net/gar/?rev=13239&view=rev
Author:   wahwah
Date:     2011-02-09 07:52:43 +0000 (Wed, 09 Feb 2011)

Log Message:
-----------
checkpkg: Shared lib name suggestions with letters

A gradual improvement of the function which suggests names for library
collections.  If the collection name does not contain at least two
letters, don't suggest it.

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

Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils.py	2011-02-09 04:09:06 UTC (rev 13238)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils.py	2011-02-09 07:52:43 UTC (rev 13239)
@@ -171,6 +171,13 @@
     return (True, versions_set.pop())
 
 
+def ValidateCollectionName(l):
+  letters = "".join(re.findall(r"[a-zA-Z]", l))
+  if len(letters) <= 1:
+    return False
+  return True
+
+
 def MakePackageNameBySonameCollection(sonames):
   """Finds a name for a collection of sonames.
 
@@ -194,6 +201,8 @@
     candidate = re.sub("\.so.*$", "", candidate)
     common_substring_candidates.append(candidate)
   lcs = CollectionLongestCommonSubstring(copy.copy(common_substring_candidates))
+  if not ValidateCollectionName(lcs):
+    return None
   pkgnames = [
       "CSW" + SonameToStringWithChar("lib%s%s" % (lcs, common_version), "-"),
   ]

Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py	2011-02-09 04:09:06 UTC (rev 13238)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py	2011-02-09 07:52:43 UTC (rev 13239)
@@ -252,7 +252,17 @@
     )
     self.assertEqual(expected, su.MakePackageNameBySonameCollection(sonames))
 
+  def testMakePackageNameBySonameCollectionMultipleSoGlib2(self):
+    sonames = [
+      "libgio-2.0.so.0",
+      "libglib-2.0.so.0",
+      "libgmodule-2.0.so.0",
+      "libgobject-2.0.so.0",
+      "libgthread-2.0.so.0",
+    ]
+    self.assertEqual(None, su.MakePackageNameBySonameCollection(sonames))
 
+
 class CommomSubstringTest(unittest.TestCase):
 
   def testLongestCommonSubstring_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