From: Michael Tremer Date: Mon, 7 Feb 2011 00:16:12 +0000 (+0100) Subject: index: Search for files in a directory recursively. X-Git-Tag: 0.9.3~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a85ddae9419a5987fa712c324dd439fc877e7f8;p=pakfire.git index: Search for files in a directory recursively. If we have such directories like: abc |`- i686 `-- noarch ...we need to search recursively for packages that do match the architecture of the distribution. --- diff --git a/pakfire/index.py b/pakfire/index.py index 3617a4feb..592653ff8 100644 --- a/pakfire/index.py +++ b/pakfire/index.py @@ -61,17 +61,18 @@ class DirectoryIndex(Index): def update(self, force=False): logging.debug("Updating repository index '%s' (force=%s)" % (self.path, force)) - for file in os.listdir(self.path): - file = os.path.join(self.path, file) + for dir, subdirs, files in os.walk(self.path): + for file in files: + file = os.path.join(dir, file) - package = packages.BinaryPackage(file) + package = packages.BinaryPackage(file) - if not package.arch in (self.arch, "noarch"): - logging.warning("Skipped package with wrong architecture: %s (%s)" \ - % (package.filename, package.arch)) - continue + if not package.arch in (self.arch, "noarch"): + logging.warning("Skipped package with wrong architecture: %s (%s)" \ + % (package.filename, package.arch)) + continue - self._packages.append(package) + self._packages.append(package) class InstalledIndex(Index):