arches -= set(["source", "all"])
for arch in arches:
for component in components:
- temp_filename = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch)
- packages = utils.open_file(temp_filename)
- Packages = apt_pkg.ParseTagFile(packages)
+ Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch)
while Packages.Step():
package_name = Packages.Section.Find("Package")
dep_list = Packages.Section.Find("Depends")
for i in d:
if i[0] == package:
rdepends.add(package_name)
- os.unlink(temp_filename)
query = """SELECT o.package, p.level, p.priority
FROM override o
arches -= set(['source', 'all'])
for arch in arches:
for component in components:
- temp_filename = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch)
- packages_file = utils.open_file(temp_filename)
- Packages = apt_pkg.ParseTagFile(packages_file)
+ Packages = utils.get_packages_from_ftp(cnf['Dir::Root'], suite, component, arch)
while Packages.Step():
package = Packages.Section.Find('Package')
dep_list = Packages.Section.Find('Depends')
if not depends.has_key(package):
depends[package] = set()
depends[package].add(i[0])
- os.unlink(temp_filename)
priorities = {}
query = """SELECT DISTINCT o.package, p.level, p.priority, m.name
AND ba.suite = s.id
AND p.level <> 0""" % suite
packages = session.execute(query)
- session.commit()
out = {}
if Options.has_key('file'):
def get_packages_from_ftp(root, suite, component, architecture):
"""
- Returns a filename containing data collected by aggregating Packages.gz files
- gathered for each architecture.
+ Returns an object containing apt_pkg-parseable data collected by
+ aggregating Packages.gz files gathered for each architecture.
+
+ @type root: string
+ @param root: path to ftp archive root directory
+
+ @type suite: string
+ @param suite: suite to extract files from
+
+ @type component: string
+ @param component: component to extract files from
+
+ @type architecture: string
+ @param architecture: architecture to extract files from
+
+ @rtype: TagFile
+ @return: apt_pkg class containing package data
- Returned file has to be manually deleted afterwards.
"""
filename = "%s/dists/%s/%s/binary-%s/Packages.gz" % (root, suite, component, architecture)
(fd, temp_file) = temp_filename()
(result, output) = commands.getstatusoutput("gunzip -c %s >> %s" % (filename, temp_file))
if (result != 0):
fubar("Gunzip invocation failed!\n%s\n" % (output), result)
- return temp_file
+ packages = open_file(temp_file)
+ Packages = apt_pkg.ParseTagFile(packages)
+ os.unlink(temp_file)
+ return Packages