return (control, control_keys, section, depends, recommends, arch, maintainer)
-def read_changes_or_dsc (suite, filename):
+def read_changes_or_dsc (suite, filename, session = None):
dsc = {}
dsc_file = utils.open_file(filename)
for k in dsc.keys():
if k in ("build-depends","build-depends-indep"):
- dsc[k] = create_depends_string(suite, split_depends(dsc[k]))
+ dsc[k] = create_depends_string(suite, split_depends(dsc[k]), session)
elif k == "architecture":
if (dsc["architecture"] != "any"):
dsc['architecture'] = colour_output(dsc["architecture"], 'arch')
filecontents = '\n'.join(map(lambda x: format_field(x,dsc[x.lower()]), keysinorder))+'\n'
return filecontents
-def create_depends_string (suite, depends_tree):
+def create_depends_string (suite, depends_tree, session = None):
result = ""
if suite == 'experimental':
suite_where = "in ('experimental','unstable')"
result += " | "
# doesn't do version lookup yet.
- res = get_binary_from_name_suite(d['name'], suite_where)
+ res = get_binary_from_name_suite(d['name'], suite_where, session)
if res.rowcount > 0:
i = res.fetchone()
package_relations.clear()
return foldable_output("Package relations", "relations", to_print)
-def output_deb_info(suite, filename, packagename):
+def output_deb_info(suite, filename, packagename, session = None):
(control, control_keys, section, depends, recommends, arch, maintainer) = read_control(filename)
if control == '':
package_relations[packagename] = {}
for key in control_keys :
if key == 'Depends':
- field_value = create_depends_string(suite, depends)
+ field_value = create_depends_string(suite, depends, session)
package_relations[packagename][key] = field_value
elif key == 'Recommends':
- field_value = create_depends_string(suite, recommends)
+ field_value = create_depends_string(suite, recommends, session)
package_relations[packagename][key] = field_value
elif key == 'Section':
field_value = section
return res
-def check_dsc (suite, dsc_filename):
- (dsc) = read_changes_or_dsc(suite, dsc_filename)
+def check_dsc (suite, dsc_filename, session = None):
+ (dsc) = read_changes_or_dsc(suite, dsc_filename, session)
return foldable_output(dsc_filename, "dsc", dsc, norow=True) + \
"\n" + \
foldable_output("lintian check for %s" % dsc_filename,
foldable_output("README.source for %s" % dsc_filename,
"source-readmesource", get_readme_source(dsc_filename))
-def check_deb (suite, deb_filename):
+def check_deb (suite, deb_filename, session = None):
filename = os.path.basename(deb_filename)
packagename = filename.split('_')[0]
is_a_udeb = 0
result = foldable_output("control file for %s" % (filename), "binary-%s-control"%packagename,
- output_deb_info(suite, deb_filename, packagename), norow=True) + "\n"
+ output_deb_info(suite, deb_filename, packagename, session), norow=True) + "\n"
if is_a_udeb:
result += foldable_output("skipping lintian check for udeb",
else:
u.source_file_checks(deb_filename, session)
u.check_source_against_db(deb_filename, session)
- session.close()
u.pkg.changes["suite"] = u.pkg.changes["distribution"]
new = determine_new(u.pkg.changes, files, 0)
print >> outfile, html_header(changes["source"], filestoexamine)
- check_valid(new)
+ check_valid(new, session)
distribution = changes["distribution"].keys()[0]
print >> outfile, examine_package.display_changes(distribution, changes_file)
for fn in filter(lambda fn: fn.endswith(".dsc"), filestoexamine):
- print >> outfile, examine_package.check_dsc(distribution, fn)
+ print >> outfile, examine_package.check_dsc(distribution, fn, session)
for fn in filter(lambda fn: fn.endswith(".deb") or fn.endswith(".udeb"), filestoexamine):
- print >> outfile, examine_package.check_deb(distribution, fn)
+ print >> outfile, examine_package.check_deb(distribution, fn, session)
print >> outfile, html_footer()
outfile.close()
+ session.close()
################################################################################
################################################################################
-def check_valid(new):
+def check_valid(new, session = None):
"""
Check if section and priority for NEW packages exist in database.
Additionally does sanity checks:
priority_name = new[pkg]["priority"]
file_type = new[pkg]["type"]
- section = get_section(section_name)
+ section = get_section(section_name, session)
if section is None:
new[pkg]["section id"] = -1
else:
new[pkg]["section id"] = section.section_id
- priority = get_priority(priority_name)
+ priority = get_priority(priority_name, session)
if priority is None:
new[pkg]["priority id"] = -1
else:
architecture = control.Find("Architecture")
upload_suite = self.pkg.changes["distribution"].keys()[0]
- if architecture not in [a.arch_string for a in get_suite_architectures(default_suite, session)] \
- and architecture not in [a.arch_string for a in get_suite_architectures(upload_suite, session)]:
+ if architecture not in [a.arch_string for a in get_suite_architectures(default_suite, session = session)] \
+ and architecture not in [a.arch_string for a in get_suite_architectures(upload_suite, session = session)]:
self.rejects.append("Unknown architecture '%s'." % (architecture))
# Ensure the architecture of the .deb is one of the ones