[csw-devel] [PATCH 2/2] checkpkg: Store i_depends information
maciej at opencsw.org
maciej at opencsw.org
Sun Mar 27 10:54:06 CEST 2011
From: Maciej Bliziński <maciej at opencsw.org>
---
gar/v2/lib/python/package.py | 18 +++++++++++++++---
gar/v2/lib/python/package_stats.py | 6 ++++--
2 files changed, 19 insertions(+), 5 deletions(-)
diff --git a/gar/v2/lib/python/package.py b/gar/v2/lib/python/package.py
index 1d06467..76ea892 100644
--- a/gar/v2/lib/python/package.py
+++ b/gar/v2/lib/python/package.py
@@ -342,20 +342,32 @@ class DirectoryFormatPackage(shell.ShellMixin, object):
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 2 < len(fields):
+ 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 CheckPkgpathExists(self):
if not os.path.isdir(self.directory):
diff --git a/gar/v2/lib/python/package_stats.py b/gar/v2/lib/python/package_stats.py
index d03ee01..65566d5 100644
--- a/gar/v2/lib/python/package_stats.py
+++ b/gar/v2/lib/python/package_stats.py
@@ -22,7 +22,7 @@ import sharedlib_utils
from sqlobject import sqlbuilder
-PACKAGE_STATS_VERSION = 10L
+PACKAGE_STATS_VERSION = 11L
BAD_CONTENT_REGEXES = (
# Slightly obfuscating these by using the default concatenation of
# strings.
@@ -187,10 +187,12 @@ class PackageStatsMixin(object):
# 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,
"isalist": sharedlib_utils.GetIsalist(arch),
"overrides": override_dicts,
"pkgchk": self.GetPkgchkData(),
--
1.7.1
More information about the devel
mailing list