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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sun Aug 21 00:52:13 CEST 2011


Revision: 15387
          http://gar.svn.sourceforge.net/gar/?rev=15387&view=rev
Author:   wahwah
Date:     2011-08-20 22:52:13 +0000 (Sat, 20 Aug 2011)

Log Message:
-----------
checkpkg: Check dangling hardlinks as well

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-08-20 20:42:52 UTC (rev 15386)
+++ csw/mgar/gar/v2/lib/python/package_checks.py	2011-08-20 22:52:13 UTC (rev 15387)
@@ -1203,11 +1203,14 @@
   for pkgmap_entry in pkg_data["pkgmap"]:
     if "path" not in pkgmap_entry: continue
     if not pkgmap_entry["path"]: continue
-    if pkgmap_entry["type"] == "s":
+    if pkgmap_entry["type"] in ("s", "l"):
+      link_type = "symlink"
+      if pkgmap_entry["type"] == "l":
+        link_type = "hardling"
       error_mgr.NeedFile(
           pkgmap_entry["target"],
-          "%s contains a symlink (%s) which needs the target file: %s."
-          % (pkgname, repr(pkgmap_entry["path"]), repr(pkgmap_entry["target"])))
+          "%s contains a %s (%s) which needs the target file: %s."
+          % (link_type, pkgname, repr(pkgmap_entry["path"]), repr(pkgmap_entry["target"])))
 
 
 def CheckPrefixDirs(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	2011-08-20 20:42:52 UTC (rev 15386)
+++ csw/mgar/gar/v2/lib/python/package_checks_test.py	2011-08-20 22:52:13 UTC (rev 15387)
@@ -1649,7 +1649,24 @@
          'target': '/opt/csw/lib/libpq.so.5'})
     self.error_mgr_mock.NeedFile('/opt/csw/lib/libpq.so.5', mox.IsA(str))
 
+  # Hardlinks work the same way.
+  def CheckpkgTest2(self):
+    self.pkg_data = copy.deepcopy(tree_stats[0])
+    self.pkg_data["pkgmap"].append(
+        {'class': 'none',
+         'group': None,
+         'line': None,
+         'mode': None,
+         'path': '/opt/csw/lib/postgresql/9.0/lib/libpq.so.5',
+         'type': 'l',
+         'user': None,
+         'target': '/opt/csw/lib/libpq.so.5'})
+    self.error_mgr_mock.NeedFile('/opt/csw/lib/libpq.so.5', mox.IsA(str))
 
+  def testTwo(self):
+    self.RunCheckpkgTest(self.CheckpkgTest2)
+
+
 class TestCheckPrefixDirs(CheckpkgUnitTestHelper,
                           unittest.TestCase):
   FUNCTION_NAME = 'CheckPrefixDirs'


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