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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Jun 17 11:53:37 CEST 2011


Revision: 14834
          http://gar.svn.sourceforge.net/gar/?rev=14834&view=rev
Author:   wahwah
Date:     2011-06-17 09:53:36 +0000 (Fri, 17 Jun 2011)

Log Message:
-----------
checkpkg: A check for the alternatives dependency

If one of the files in the package is of the 'cswalternatives' class, checkpkg
declares that the package needs the /opt/csw/sbin/alteratives file.

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-06-16 16:42:27 UTC (rev 14833)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2011-06-17 09:53:36 UTC (rev 14834)
@@ -1283,3 +1283,18 @@
     return
   if "UNCOMMITTED" in pkginfo[repotag]:
     error_mgr.ReportError("pkginfo-opencsw-repository-uncommitted")
+
+def CheckAlternativesDependency(
+    pkg_data, error_mgr, logger, messenger):
+
+  need_alternatives = False
+  for entry in pkg_data["pkgmap"]:
+    if not entry["path"]:
+      continue
+    if entry["class"] == "cswalternatives":
+      need_alternatives = True
+      break
+  if need_alternatives:
+    error_mgr.NeedFile(
+        "/opt/csw/sbin/alternatives",
+        "The alternatives subsystem is used")

Modified: csw/mgar/gar/v2/lib/python/package_checks_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-06-16 16:42:27 UTC (rev 14833)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-06-17 09:53:36 UTC (rev 14834)
@@ -1735,5 +1735,25 @@
     self.RunCheckpkgTest(self.CheckpkgTest2)
 
 
+class TestCheckAlternativesDependency(CheckpkgUnitTestHelper, unittest.TestCase):
+  FUNCTION_NAME = 'CheckAlternativesDependency'
+  ALTERNATIVES_EXECUTABLE = "/opt/csw/sbin/alternatives"
+  def CheckpkgTest(self):
+    self.pkg_data["pkgmap"].append({
+      'class': 'cswalternatives',
+      'group': 'bin',
+      'line': ('1 f cswalternatives /opt/csw/share/alternatives/sendmail '
+               '0644 root bin 408 36322 1308243112'),
+      'mode': '0644',
+      'path': '/opt/csw/share/alternatives/sendmail',
+      'target': None,
+      'type': 'f',
+      'user': 'root',
+    })
+    self.error_mgr_mock.NeedFile(
+        self.ALTERNATIVES_EXECUTABLE,
+        "The alternatives subsystem is used")
+
+
 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