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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Wed Jul 14 00:54:38 CEST 2010


Revision: 10519
          http://gar.svn.sourceforge.net/gar/?rev=10519&view=rev
Author:   wahwah
Date:     2010-07-13 22:54:37 +0000 (Tue, 13 Jul 2010)

Log Message:
-----------
mGAR v2: checkpkg, adding a check for /opt/csw/var.

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-07-13 17:46:57 UTC (rev 10518)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2010-07-13 22:54:37 UTC (rev 10519)
@@ -63,8 +63,14 @@
 DO_NOT_LINK_AGAINST_THESE_SONAMES = set([])
 
 DISCOURAGED_FILE_PATTERNS = (
-    r"\.py[co]$",
-    r"/lib\w+\.l?a$",
+    (r"\.py[co]$", ("Python compiled files are supposed to be compiled using"
+                    "the cswpycompile class action script. For more "
+                    "information, see "
+                    "http://wiki.opencsw.org/cswclassutils-package")),
+    (r"/lib\w+\.l?a$", "Static libraries aren't necessary on Solaris."),
+    (r"opt/csw/var($|/)", ("The /opt/csw/var directory is not writable on "
+                            "sparse non-global zones.  "
+                            "Please use /var/opt/csw instead.")),
 )
 RPATH_PARTS = {
     'prefix': r"(?P<prefix>/opt/csw)",
@@ -689,13 +695,14 @@
 
 
 def CheckDiscouragedFileNamePatterns(pkg_data, error_mgr, logger, messenger):
-  patterns = [re.compile(x) for x in DISCOURAGED_FILE_PATTERNS]
+  patterns = [(re.compile(x), y) for x, y in DISCOURAGED_FILE_PATTERNS]
   for entry in pkg_data["pkgmap"]:
     if entry["path"]:
-      for pattern in patterns:
-        if re.search(pattern, entry["path"]):
+      for pattern, msg in patterns:
+        if pattern.search(entry["path"]):
           error_mgr.ReportError("discouraged-path-in-pkgmap",
                                 entry["path"])
+          messenger.Message(msg)
 
 
 def CheckBadContent(pkg_data, error_mgr, logger, messenger):

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-07-13 17:46:57 UTC (rev 10518)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2010-07-13 22:54:37 UTC (rev 10519)
@@ -779,5 +779,27 @@
     # ReportError('CSWivtools', 'soname-not-found', 'libComUnidraw.so is needed by opt/csw/bin/comdraw')
 
 
+class TestCheckDiscouragedFileNamePatterns(CheckpkgUnitTestHelper,
+                                           unittest.TestCase):
+  """Throw an error if there's a conflicting file in the package set."""
+  FUNCTION_NAME = 'CheckDiscouragedFileNamePatterns'
+  CSWfoo_DATA = {
+        'basic_stats': {'catalogname': 'foo',
+                        'pkgname': 'CSWfoo',
+                        'stats_version': 1},
+        'binaries_dump_info': [],
+        'depends': tuple(),
+        'isalist': [],
+        'pkgmap': [
+          { "type": "d", "path": "/opt/csw/var", },
+          { "type": "d", "path": "/opt/csw/bin", },
+        ],
+  }
+  def CheckpkgTest(self):
+    self.pkg_data = self.CSWfoo_DATA
+    self.error_mgr_mock.ReportError(
+        'discouraged-path-in-pkgmap', '/opt/csw/var')
+
+
 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