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

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Mon Mar 28 10:51:20 CEST 2011


Revision: 13982
          http://gar.svn.sourceforge.net/gar/?rev=13982&view=rev
Author:   wahwah
Date:     2011-03-28 08:51:20 +0000 (Mon, 28 Mar 2011)

Log Message:
-----------
checkpkg: Store i_depends information

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/package.py
    csw/mgar/gar/v2/lib/python/package_stats.py
    csw/mgar/gar/v2/lib/python/package_stats_test.py

Modified: csw/mgar/gar/v2/lib/python/package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package.py	2011-03-28 08:50:43 UTC (rev 13981)
+++ csw/mgar/gar/v2/lib/python/package.py	2011-03-28 08:51:20 UTC (rev 13982)
@@ -342,20 +342,32 @@
     self.SetPkginfoEntry("NAME", pkginfo_name)
 
   def GetDependencies(self):
+    """Gets dependencies information.
+
+    Returns:
+      A tuple of (list, list) of depends and i_depends.
+    """
+    # The collection of dependencies needs to be a list (as opposed to
+    # a set) because there might be duplicates and it's necessary to
+    # carry that information.
     depends = []
+    i_depends = []
     depend_file_path = os.path.join(self.directory, "install", "depend")
     if not os.path.exists(depend_file_path):
       return depends
     with open(depend_file_path, "r") as fd:
-      # It needs to be a list because there might be duplicates and it's
-      # necessary to carry that information.
       for line in fd:
         fields = re.split(c.WS_RE, line)
+        if len(fields) < 2:
+          logging.warning("Bad depends line: %s", repr(line))
         if fields[0] == "P":
           pkgname = fields[1]
           pkg_desc = " ".join(fields[1:])
           depends.append((pkgname, pkg_desc))
-    return depends
+        if fields[0] == "I":
+          pkgname = fields[1]
+          i_depends.append(pkgname)
+    return depends, i_depends
 
   def GetObsoletedBy(self):
     """Collects obsolescence information from the package if it exists

Modified: csw/mgar/gar/v2/lib/python/package_stats.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_stats.py	2011-03-28 08:50:43 UTC (rev 13981)
+++ csw/mgar/gar/v2/lib/python/package_stats.py	2011-03-28 08:51:20 UTC (rev 13982)
@@ -22,7 +22,7 @@
 
 from sqlobject import sqlbuilder
 
-PACKAGE_STATS_VERSION = 11L
+PACKAGE_STATS_VERSION = 12L
 BAD_CONTENT_REGEXES = (
     # Slightly obfuscating these by using the default concatenation of
     # strings.
@@ -187,10 +187,12 @@
     # there are packages with 'i386' in the pkgname and 'all' as the
     # architecture.
     arch = basic_stats["parsed_basename"]["arch"]
+    depends, i_depends = dir_pkg.GetDependencies()
     pkg_stats = {
         "binaries": dir_pkg.ListBinaries(),
         "binaries_dump_info": self.GetBinaryDumpInfo(),
-        "depends": dir_pkg.GetDependencies(),
+        "depends": depends,
+        "i_depends": i_depends,
         "obsoleteness_info": dir_pkg.GetObsoletedBy(),
         "isalist": sharedlib_utils.GetIsalist(arch),
         "overrides": override_dicts,

Modified: csw/mgar/gar/v2/lib/python/package_stats_test.py
===================================================================
--- csw/mgar/gar/v2/lib/python/package_stats_test.py	2011-03-28 08:50:43 UTC (rev 13981)
+++ csw/mgar/gar/v2/lib/python/package_stats_test.py	2011-03-28 08:51:20 UTC (rev 13982)
@@ -48,7 +48,7 @@
     mock_srv4.GetSize().AndReturn(42)
     mock_dirpkg.ListBinaries().AndReturn([])
     mock_dirpkg.GetBinaryDumpInfo().AndReturn([])
-    mock_dirpkg.GetDependencies().AndReturn([])
+    mock_dirpkg.GetDependencies().AndReturn(([], []))
     mock_srv4.GetPkgchkOutput().AndReturn((0, "", ""))
     mock_dirpkg.GetParsedPkginfo().AndReturn({
       "ARCH": "sparc",


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