[csw-devel] SF.net SVN: gar:[8992] csw/mgar/gar/v2/lib/python
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Sat Mar 6 08:33:49 CET 2010
Revision: 8992
http://gar.svn.sourceforge.net/gar/?rev=8992&view=rev
Author: wahwah
Date: 2010-03-06 07:33:48 +0000 (Sat, 06 Mar 2010)
Log Message:
-----------
mGAR v2: checkpkg, description needs to start with an uppercase letter.
Modified Paths:
--------------
csw/mgar/gar/v2/lib/python/checkpkg.py
csw/mgar/gar/v2/lib/python/checkpkg_test.py
csw/mgar/gar/v2/lib/python/package_checks.py
csw/mgar/gar/v2/lib/python/package_checks_test.py
Modified: csw/mgar/gar/v2/lib/python/checkpkg.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg.py 2010-03-05 23:59:55 UTC (rev 8991)
+++ csw/mgar/gar/v2/lib/python/checkpkg.py 2010-03-06 07:33:48 UTC (rev 8992)
@@ -32,6 +32,7 @@
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+)"
+DESCRIPTION_RE = r"^([\S]+) - (.*)$"
SYSTEM_SYMLINKS = (
("/opt/csw/bdb4", ["/opt/csw/bdb42"]),
@@ -154,9 +155,9 @@
def ExtractDescription(pkginfo):
- desc_re = re.compile(r"^[\w_]+ - (.*)$")
+ desc_re = re.compile(DESCRIPTION_RE)
m = re.match(desc_re, pkginfo["NAME"])
- return m.group(1) if m else None
+ return m.group(2) if m else None
def ExtractMaintainerName(pkginfo):
Modified: csw/mgar/gar/v2/lib/python/checkpkg_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-03-05 23:59:55 UTC (rev 8991)
+++ csw/mgar/gar/v2/lib/python/checkpkg_test.py 2010-03-06 07:33:48 UTC (rev 8992)
@@ -828,11 +828,16 @@
class ExtractorsUnitTest(unittest.TestCase):
- def testExtractDescription_1(self):
+ def testExtractDescriptionFromGoodData(self):
data = {"NAME": "nspr_devel - Netscape Portable Runtime header files"}
result = "Netscape Portable Runtime header files"
self.assertEqual(result, checkpkg.ExtractDescription(data))
+ def testExtractDescriptionWithBadCatalogname(self):
+ data = {"NAME": "foo-bar - Bad catalogname shouldn't break this function"}
+ result = "Bad catalogname shouldn't break this function"
+ self.assertEqual(result, checkpkg.ExtractDescription(data))
+
def testExtractMaintainerName(self):
data = {"VENDOR": "https://ftp.mozilla.org/pub/mozilla.org/"
"nspr/releases/v4.8/src/ packaged for CSW by "
Modified: csw/mgar/gar/v2/lib/python/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py 2010-03-05 23:59:55 UTC (rev 8991)
+++ csw/mgar/gar/v2/lib/python/package_checks.py 2010-03-06 07:33:48 UTC (rev 8992)
@@ -74,6 +74,9 @@
else:
if len(desc) > MAX_DESCRIPTION_LENGTH:
error_mgr.ReportError("pkginfo-description-too-long")
+ if not desc[0].isupper():
+ error_mgr.ReportError("pkginfo-description-not-starting-with-uppercase",
+ desc)
def CheckCatalogname(pkg_data, error_mgr, logger):
@@ -81,7 +84,7 @@
catalogname = pkginfo["NAME"].split(" ")[0]
catalogname_re = r"^(\w+)$"
if not re.match(catalogname_re, catalogname):
- error_mgr.ReportError("pkginfo-bad-catalogname")
+ error_mgr.ReportError("pkginfo-bad-catalogname", catalogname)
def CheckSmfIntegration(pkg_data, error_mgr, logger):
Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-03-05 23:59:55 UTC (rev 8991)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py 2010-03-06 07:33:48 UTC (rev 8992)
@@ -56,6 +56,14 @@
self.error_mgr_mock.ReportError('pkginfo-description-too-long')
+class TestDescriptionNotCapitalized(CheckpkgUnitTestHelper, unittest.TestCase):
+ FUNCTION_NAME = 'CheckDescription'
+ def CheckpkgTest(self):
+ self.pkg_data["pkginfo"]["NAME"] = 'foo - lowercase'
+ self.error_mgr_mock.ReportError('pkginfo-description-not-starting-with-uppercase',
+ 'lowercase')
+
+
class TestCheckCatalogname(CheckpkgUnitTestHelper, unittest.TestCase):
FUNCTION_NAME = 'CheckCatalogname'
def CheckpkgTest(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