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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Dec 5 23:59:11 CET 2010


Revision: 11794
          http://gar.svn.sourceforge.net/gar/?rev=11794&view=rev
Author:   wahwah
Date:     2010-12-05 22:59:11 +0000 (Sun, 05 Dec 2010)

Log Message:
-----------
checkpkg: New check, docdir

A package is allowed to have files in /opt/csw/share/doc/<catalogname>,
but not in any other directory under /opt/csw/shared/doc.

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	2010-12-05 17:55:12 UTC (rev 11793)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-12-05 22:59:11 UTC (rev 11794)
@@ -1194,6 +1194,22 @@
             % (binary_info["soname"], binary_info["base_name"]))
 
 
+def CheckDocDir(pkg_data, error_mgr, logger, messenger):
+  pkgname = pkg_data["basic_stats"]["pkgname"]
+  docpath_re = re.compile(r"/opt/csw/share/doc/(?P<docname>[^/]+)/.*")
+  for pkgmap_entry in pkg_data["pkgmap"]:
+    if "path" not in pkgmap_entry: continue
+    if not pkgmap_entry["path"]: continue
+    m = docpath_re.match(pkgmap_entry["path"])
+    if m:
+      if m.groupdict()["docname"] != pkg_data["basic_stats"]["catalogname"]:
+        error_mgr.ReportError(
+            "wrong-docdir",
+            "expected=/opt/csw/shared/doc/%s/... "
+            "in-package=%s"
+            % (pkg_data["basic_stats"]["catalogname"],
+               pkgmap_entry["path"]))
+
 def CheckSonameMustNotBeEqualToFileNameIfFilenameEndsWithSo(
     pkg_data, error_mgr, logger, messenger):
   pass

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-12-05 17:55:12 UTC (rev 11793)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-12-05 22:59:11 UTC (rev 11794)
@@ -1431,6 +1431,7 @@
   FUNCTION_NAME = 'CheckSharedLibraryNameMustBeAsubstringOfSoname'
   def CheckpkgTest(self):
     self.pkg_data = neon_stats[0]
+    # TODO: Implement this
 
 
 class TestCheckSharedLibraryNameMustBeAsubstringOfSonameGood(
@@ -1444,5 +1445,24 @@
         'soname=libneon.so.27 filename=foo.so.1')
 
 
+class TestCheckDocDir(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckDocDir'
+  def CheckpkgTest(self):
+    self.pkg_data = neon_stats[0]
+    self.pkg_data["pkgmap"].append({
+      "class": "none",
+      "group": "bin",
+      "line": "",
+      "mode": '0755',
+      "path": "/opt/csw/share/doc/alien/license",
+      "type": "f",
+      "user": "root"
+    })
+    self.error_mgr_mock.ReportError(
+        'wrong-docdir',
+        'expected=/opt/csw/shared/doc/neon/... '
+        'in-package=/opt/csw/share/doc/alien/license')
+
+
 if __name__ == '__main__':
   unittest.main()


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