[csw-devel] SF.net SVN: gar:[11418] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Tue Oct 26 11:35:24 CEST 2010
Revision: 11418
http://gar.svn.sourceforge.net/gar/?rev=11418&view=rev
Author: wahwah
Date: 2010-10-26 09:35:24 +0000 (Tue, 26 Oct 2010)
Log Message:
-----------
mGAR v2: checkpkg libpolicy, caught a bug in package name composer.
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 2010-10-26 09:34:57 UTC (rev 11417)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils.py 2010-10-26 09:35:24 UTC (rev 11418)
@@ -69,7 +69,7 @@
if need_sep:
new_parts.append(c)
new_parts.append(part)
- prev_type = first_type
+ prev_type = CharType(part[-1])
return "".join(new_parts).lower()
@@ -86,6 +86,19 @@
Returns a pair of pkgname, catalogname.
"""
+ def AddSeparator(d, sep):
+ "Adds a separator based on the neighboring of two digits."
+ dc = copy.copy(d)
+ if dc["version"]:
+ if (dc["basename"][-1].isdigit()
+ and
+ dc["version"][0].isdigit()):
+ dc["sep"] = sep
+ else:
+ dc["sep"] = ""
+ else:
+ dc["sep"] = ""
+ return dc
soname_re = re.compile(r"(?P<basename>[\w\+]+([\.\-]+[\w\+]+)*)"
r"\.so"
r"(\.(?P<version>[\d\.]+))?"
@@ -111,17 +124,23 @@
else:
keywords_pkgname[key] = ""
keywords_catalogname[key] = ""
- pkgname_list = [
- "CSW%(basename)s%(version)s" % keywords_pkgname,
- ]
+ pkgname_list = []
+ keywords_pkgname = AddSeparator(keywords_pkgname, "-")
+ pkgname_list.append(
+ "CSW%(basename)s%(sep)s%(version)s" % keywords_pkgname)
+ keywords_catalogname = AddSeparator(keywords_catalogname, "_")
catalogname_list = [
- "%(basename)s%(version)s" % keywords_catalogname,
+ "%(basename)s%(sep)s%(version)s" % keywords_catalogname,
]
- if keywords_pkgname["version"]:
- catalogname_list.append(
- "%(basename)s_%(version)s" % keywords_catalogname)
- pkgname_list.append(
- "CSW%(basename)s-%(version)s" % keywords_pkgname)
+ # if keywords_pkgname["version"]:
+ # candidate_catalogname = (
+ # "%(basename)s%(version)s" % keywords_catalogname)
+ # if candidate_catalogname not in catalogname_list:
+ # pkgname_list.append(candidate_catalogname)
+ # candidate_pkgname = (
+ # "CSW%(basename)s-%(version)s" % keywords_pkgname)
+ # if candidate_pkgname not in pkgname_list:
+ # pkgname_list.append(candidate_pkgname)
return pkgname_list, catalogname_list
Modified: csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py 2010-10-26 09:34:57 UTC (rev 11417)
+++ csw/mgar/gar/v2/lib/python/sharedlib_utils_test.py 2010-10-26 09:35:24 UTC (rev 11418)
@@ -86,8 +86,8 @@
def testMakePackageNameBySonameApr(self):
soname = "libapr-1.so.0"
expected = (
- ['CSWlibapr-10', 'CSWlibapr-1-0'],
- ['libapr_10', 'libapr_1_0']
+ ['CSWlibapr1-0'],
+ ['libapr1_0']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
@@ -95,8 +95,8 @@
def testMakePackageNameBySonameDot(self):
soname = "libbabl-0.1.so.0"
expected = (
- ['CSWlibbabl-0-10', 'CSWlibbabl-0-1-0'],
- ['libbabl_0_10', 'libbabl_0_1_0']
+ ['CSWlibbabl0-1-0'],
+ ['libbabl0_1_0']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
@@ -104,8 +104,8 @@
def testMakePackageNameBySonameMoreDot(self):
soname = "libgettextlib-0.14.1.so"
expected = (
- ['CSWlibgettextlib-0-14-1'],
- ['libgettextlib_0_14_1'],
+ ['CSWlibgettextlib0-14-1'],
+ ['libgettextlib0_14_1'],
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
@@ -122,17 +122,17 @@
def testMakePackageNameBySonamePlus(self):
soname = "libstdc++.so.6"
expected = (
- ['CSWlibstdc++6', 'CSWlibstdc++-6'],
- ['libstdc++6', 'libstdc++_6']
+ ['CSWlibstdc++6'],
+ ['libstdc++6']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
- def testMakePackageNameBySonamePlus(self):
+ def testMakePackageNameBySonameNoVersion(self):
soname = "libdnet.1"
expected = (
- ['CSWlibdnet1', 'CSWlibdnet-1'],
- ['libdnet1', 'libdnet_1']
+ ['CSWlibdnet1'],
+ ['libdnet1']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
@@ -140,19 +140,12 @@
def testMakePackageNameUppercase(self):
soname = "libUpperCase.so.1"
expected = (
- ['CSWlibuppercase1', 'CSWlibuppercase-1'],
- ['libuppercase1', 'libuppercase_1']
+ ['CSWlibuppercase1'],
+ ['libuppercase1']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
- def testMakePackageNameBySonameMoreDot(self):
- soname = "libgettextlib-0.14.1.so"
- expected = (
- ['CSWlibgettextlib-0-14-1'],
- ['libgettextlib_0_14_1'],
- )
-
def testMakePackageNameDashesNoDashes(self):
soname = "libpyglib-2.0-python.so.0"
expected = (
@@ -162,51 +155,30 @@
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
- def testMakePackageNameBySonameComplexApr(self):
- soname = "libapr-1.so.10.0.0"
+ def testMakePackageNameDashesNoDashesPython(self):
+ soname = "libpython3.1.so.1.0"
expected = (
- ['CSWlibapr-110', 'CSWlibapr-1-10'],
- ['libapr_110', 'libapr_1_10']
+ ['CSWlibpython3-1-1-0'],
+ ['libpython3_1_1_0'],
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
- def testMakePackageNameBySonamePlus(self):
- soname = "libstdc++.so.6"
+ def testMakePackageNameBySonameComplexApr(self):
+ soname = "libapr-1.so.10.0.0"
expected = (
- ['CSWlibstdc++6', 'CSWlibstdc++-6'],
- ['libstdc++6', 'libstdc++_6']
+ ['CSWlibapr1-10-0-0'],
+ ['libapr1_10_0_0']
)
self.assertEqual(expected,
su.MakePackageNameBySoname(soname))
- def testMakePackageNameBySonamePlus(self):
- soname = "libdnet.1"
- expected = (
- ['CSWlibdnet1', 'CSWlibdnet-1'],
- ['libdnet1', 'libdnet_1']
- )
- self.assertEqual(expected,
- su.MakePackageNameBySoname(soname))
- def testMakePackageNameUppercase(self):
- soname = "libUpperCase.so.1"
- expected = (
- ['CSWlibuppercase1', 'CSWlibuppercase-1'],
- ['libuppercase1', 'libuppercase_1']
- )
- self.assertEqual(expected,
- su.MakePackageNameBySoname(soname))
+class SanitizationUnitTest(unittest.TestCase):
-
-class MakePackageNameBySonameUnitTest(unittest.TestCase):
-
def testSanitizeWithChar(self):
self.assertEqual("foo_0", su.SanitizeWithChar("foo-0", "_"))
-
-class MakePackageNameBySonameUnitTest(unittest.TestCase):
-
def testSanitizeWithChar(self):
self.assertEqual("foo_0", su.SanitizeWithChar("foo-0", "_"))
@@ -219,7 +191,10 @@
def testSonameToStringWithCharDigitDigit(self):
self.assertEqual("foo_bar0_0", su.SonameToStringWithChar("foo-bar-0-0", "_"))
+ def testSonameToStringWithCharPython(self):
+ self.assertEqual("libpython3_1_1_0", su.SonameToStringWithChar("libpython3.1.so.1.0", "_"))
+
class GetCommonVersionUnitTest(unittest.TestCase):
def testGetCommonVersionSimple(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