SF.net SVN: gar:[23092] csw/mgar/gar/v2/lib/python/checkpkg_lib.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Sat Mar 1 13:09:30 CET 2014


Revision: 23092
          http://sourceforge.net/p/gar/code/23092
Author:   wahwah
Date:     2014-03-01 12:09:29 +0000 (Sat, 01 Mar 2014)
Log Message:
-----------
checkpkg: New assertion: files declared as needed

Previously, if no package was found to satisfy a need for a file, no error was
thrown. From now on, there will be an error thrown that a file was missing and
not satisfied. This will catch things like dangling symlinks.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/checkpkg_lib.py

Modified: csw/mgar/gar/v2/lib/python/checkpkg_lib.py
===================================================================
--- csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-03-01 12:09:22 UTC (rev 23091)
+++ csw/mgar/gar/v2/lib/python/checkpkg_lib.py	2014-03-01 12:09:29 UTC (rev 23092)
@@ -633,11 +633,21 @@
     reasons_by_pkg_by_pkgname = {}
     pkgs_by_reasons_by_pkgname = {}
     needed_pkgs = copy.deepcopy(needed_pkgs)
+    unsatisfied_needed_files = []
     # Resolving files into packages and adding to the common data structure.
-    for pkgname, full_path, reason in needed_files:
-      needed_pkgs_tmp = checkpkg_interface.GetPkgByPath(full_path)
-      for needed_pkgname in needed_pkgs_tmp:
-        needed_pkgs.append(NeededPackage(pkgname, needed_pkgname, reason))
+    for needed_file in needed_files:
+      pkgname, full_path, reason = needed_file
+      logging.debug('_ReportDependencies(): processing %r %r %r', pkgname,
+                    full_path, reason)
+      needed_pkgnames = checkpkg_interface.GetPkgByPath(full_path)
+      if needed_pkgnames:
+        for needed_pkgname in needed_pkgnames:
+          needed_pkg = NeededPackage(pkgname, needed_pkgname, reason)
+          logging.debug('Need package %r', needed_pkg)
+          needed_pkgs.append(needed_pkg)
+      else:
+        logging.warning('Did not find packages for %r', full_path)
+        unsatisfied_needed_files.append(needed_file)
     for pkgname, needed_pkgname, reason in needed_pkgs:
       reasons_by_pkg_by_pkgname.setdefault(pkgname, {})
       reasons_by_pkg_by_pkgname[pkgname].setdefault(needed_pkgname, [])
@@ -691,6 +701,14 @@
         if alternatives:
           messenger.SuggestGarLine("# (end of the list of alternative dependencies)")
 
+    # Files that were declared as needed, but we did not find any packages
+    # providing these files.
+    for unsatisfied_file in unsatisfied_needed_files:
+      checkpkg_interface.ReportErrorForPkgname(
+          unsatisfied_file.pkgname,
+          'file-needed-but-no-package-satisfies-it',
+          '%s %s' % (unsatisfied_file.full_path, unsatisfied_file.reason))
+
   def _ReportMissingDependencies(self,
                                  error_mgr,
                                  pkgname,

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