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

bdwalton at users.sourceforge.net bdwalton at users.sourceforge.net
Sat Jul 2 02:49:47 CEST 2011


Revision: 14956
          http://gar.svn.sourceforge.net/gar/?rev=14956&view=rev
Author:   bdwalton
Date:     2011-07-02 00:49:46 +0000 (Sat, 02 Jul 2011)

Log Message:
-----------
checkpkg: detect gzipped manpages in pkgmap and provide a suggested correction

Modified Paths:
--------------
    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/package_checks.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks.py	2011-07-01 20:50:27 UTC (rev 14955)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2011-07-02 00:49:46 UTC (rev 14956)
@@ -220,6 +220,15 @@
       if re.search(perllocal_re, entry["path"]):
         error_mgr.ReportError("perllocal-pod-in-pkgmap", entry["path"])
 
+def CheckGzippedManpages(pkg_data, error_mgr, logger, messenger):
+  gzipman_re = re.compile(r'share/man/man.*/.*\.gz$')
+  for entry in pkg_data["pkgmap"]:
+    if entry["path"]:
+      if re.search(gzipman_re, entry["path"]):
+        error_mgr.ReportError(
+          'gzipped-manpage-in-pkgmap', entry["path"],
+          "Solaris' man cannot automatically inflate man pages. "
+          "Solution: man page should be gunzipped.")
 
 def CheckMultipleDepends(pkg_data, error_mgr, logger, messenger):
   new_depends = set()

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-07-01 20:50:27 UTC (rev 14955)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-07-02 00:49:46 UTC (rev 14956)
@@ -950,6 +950,55 @@
         'This path is already provided by CSWcommon '
         'or is not allowed for other reasons.')
 
+
+class TestCheckGzippedManpages(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = "CheckGzippedManpages"
+  def CheckpkgTest(self):
+    self.pkg_data["pkgmap"].append({
+      "class": "none",
+      "group": "bin",
+      "line": "",
+      "mode": '0755',
+      "path": "/opt/csw/share/man/man5/puppet.conf.5.gz",
+      "type": "f",
+      "user": "root"
+    })
+    self.error_mgr_mock.ReportError(
+      'gzipped-manpage-in-pkgmap', '/opt/csw/share/man/man5/puppet.conf.5.gz',
+      "Solaris' man cannot automatically inflate man pages. "
+      "Solution: man page should be gunzipped.")
+
+
+class TestCheckGzippedManpages_good(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = "CheckGzippedManpages"
+  def CheckpkgTest(self):
+    self.pkg_data["pkgmap"].append({
+      "class": "none",
+      "group": "bin",
+      "line": "",
+      "mode": '0755',
+      "path": "/opt/csw/share/man/man5/puppet.conf.5",
+      "type": "f",
+      "user": "root"
+    })
+
+
+# Although this is a gzipped manpage, it is not in a directory associated with
+# manpages, so we should not trigger an error here.
+class TestCheckGzippedManpages_misplaced(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = "CheckGzippedManpages"
+  def CheckpkgTest(self):
+    self.pkg_data["pkgmap"].append({
+      "class": "none",
+      "group": "bin",
+      "line": "",
+      "mode": '0755',
+      "path": "/etc/opt/csw/puppet/puppet.conf.5.gz",
+      "type": "f",
+      "user": "root"
+    })
+
+
 class TestCheckArchitecture_sparcv8plus(CheckpkgUnitTestHelper,
                                         unittest.TestCase):
   FUNCTION_NAME = "CheckArchitecture"


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