summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
9a77e1a)
examin_package.py would assume that a package when targetting unstable when
checking Depends and Recommends relationships. Now it will allow the suite to
be specified when checking a .deb or .dsc and will read the suite from the
.changes file when checking .changes
Signed-off-by: Mike O'Connor <stew@vireo.org>
return (control, control_keys, section, depends, recommends, arch, maintainer)
return (control, control_keys, section, depends, recommends, arch, maintainer)
-def read_changes_or_dsc (filename):
+def read_changes_or_dsc (suite, filename):
dsc = {}
dsc_file = utils.open_file(filename)
dsc = {}
dsc_file = utils.open_file(filename)
for k in dsc.keys():
if k in ("build-depends","build-depends-indep"):
for k in dsc.keys():
if k in ("build-depends","build-depends-indep"):
- dsc[k] = create_depends_string(split_depends(dsc[k]))
+ dsc[k] = create_depends_string(suite, split_depends(dsc[k]))
elif k == "architecture":
if (dsc["architecture"] != "any"):
dsc['architecture'] = colour_output(dsc["architecture"], 'arch')
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
filecontents = '\n'.join(map(lambda x: format_field(x,dsc[x.lower()]), keysinorder))+'\n'
return filecontents
-def create_depends_string (depends_tree):
- # just look up unstable for now. possibly pull from .changes later
- suite = "unstable"
+def create_depends_string (suite, depends_tree):
+ if suite == 'experimental':
+ suite_where = " in ('experimental','unstable')"
+ else:
+ suite_where = " ='%s'" % suite
+
comma_count = 1
for l in depends_tree:
if (comma_count >= 2):
comma_count = 1
for l in depends_tree:
if (comma_count >= 2):
result += " | "
# doesn't do version lookup yet.
result += " | "
# doesn't do version lookup yet.
- q = projectB.query("SELECT DISTINCT(b.package), b.version, c.name, su.suite_name FROM binaries b, files fi, location l, component c, bin_associations ba, suite su WHERE b.package='%s' AND b.file = fi.id AND fi.location = l.id AND l.component = c.id AND ba.bin=b.id AND ba.suite = su.id AND su.suite_name='%s' ORDER BY b.version desc" % (d['name'], suite))
+ q = projectB.query("SELECT DISTINCT(b.package), b.version, c.name, su.suite_name FROM binaries b, files fi, location l, component c, bin_associations ba, suite su WHERE b.package='%s' AND b.file = fi.id AND fi.location = l.id AND l.component = c.id AND ba.bin=b.id AND ba.suite = su.id AND su.suite_name %s ORDER BY b.version desc" % (d['name'], suite_where))
ql = q.getresult()
if ql:
i = ql[0]
ql = q.getresult()
if ql:
i = ql[0]
comma_count += 1
return result
comma_count += 1
return result
-def output_deb_info(filename):
+def output_deb_info(suite, filename):
(control, control_keys, section, depends, recommends, arch, maintainer) = read_control(filename)
if control == '':
(control, control_keys, section, depends, recommends, arch, maintainer) = read_control(filename)
if control == '':
to_print = ""
for key in control_keys :
if key == 'Depends':
to_print = ""
for key in control_keys :
if key == 'Depends':
- field_value = create_depends_string(depends)
+ field_value = create_depends_string(suite, depends)
elif key == 'Recommends':
elif key == 'Recommends':
- field_value = create_depends_string(recommends)
+ field_value = create_depends_string(suite, recommends)
elif key == 'Section':
field_value = section
elif key == 'Architecture':
elif key == 'Section':
field_value = section
elif key == 'Architecture':
printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename)
return res+formatted_text(cright)
printed_copyrights[copyrightmd5] = "%s (%s)" % (package, deb_filename)
return res+formatted_text(cright)
-def check_dsc (dsc_filename):
- (dsc) = read_changes_or_dsc(dsc_filename)
+def check_dsc (suite, dsc_filename):
+ (dsc) = read_changes_or_dsc(suite, dsc_filename)
foldable_output(dsc_filename, "dsc", dsc, norow=True)
foldable_output("lintian check for %s" % dsc_filename, "source-lintian", do_lintian(dsc_filename))
foldable_output(dsc_filename, "dsc", dsc, norow=True)
foldable_output("lintian check for %s" % dsc_filename, "source-lintian", do_lintian(dsc_filename))
-def check_deb (deb_filename):
+def check_deb (suite, deb_filename):
filename = os.path.basename(deb_filename)
packagename = filename.split('_')[0]
filename = os.path.basename(deb_filename)
packagename = filename.split('_')[0]
foldable_output("control file for %s" % (filename), "binary-%s-control"%packagename,
foldable_output("control file for %s" % (filename), "binary-%s-control"%packagename,
- output_deb_info(deb_filename), norow=True)
+ output_deb_info(suite, deb_filename), norow=True)
if is_a_udeb:
foldable_output("skipping lintian check for udeb", "binary-%s-lintian"%packagename,
if is_a_udeb:
foldable_output("skipping lintian check for udeb", "binary-%s-lintian"%packagename,
file.close()
return contents
file.close()
return contents
-def display_changes(changes_filename):
- changes = read_changes_or_dsc(changes_filename)
+def display_changes(suite, changes_filename):
+ changes = read_changes_or_dsc(suite, changes_filename)
foldable_output(changes_filename, "changes", changes, norow=True)
def check_changes (changes_filename):
foldable_output(changes_filename, "changes", changes, norow=True)
def check_changes (changes_filename):
- display_changes(changes_filename)
-
changes = utils.parse_changes (changes_filename)
changes = utils.parse_changes (changes_filename)
+ display_changes(changes['distribution'], changes_filename)
+
files = utils.build_file_list(changes)
for f in files.keys():
if f.endswith(".deb") or f.endswith(".udeb"):
files = utils.build_file_list(changes)
for f in files.keys():
if f.endswith(".deb") or f.endswith(".udeb"):
+ check_deb(changes['distribution'], f)
+ check_dsc(changes['distribution'], f)
# else: => byhand
def main ():
# else: => byhand
def main ():
if f.endswith(".changes"):
check_changes(f)
elif f.endswith(".deb") or f.endswith(".udeb"):
if f.endswith(".changes"):
check_changes(f)
elif f.endswith(".deb") or f.endswith(".udeb"):
+ # default to unstable when we don't have a .changes file
+ # perhaps this should be a command line option?
+ check_deb('unstable', file)
+ check_dsc('unstable', f)
else:
utils.fubar("Unrecognised file type: '%s'." % (f))
finally:
else:
utils.fubar("Unrecognised file type: '%s'." % (f))
finally:
stdout_fd = sys.stdout
try:
sys.stdout = less_fd
stdout_fd = sys.stdout
try:
sys.stdout = less_fd
- examine_package.display_changes(Upload.pkg.changes_file)
+ changes = utils.parse_changes (Upload.pkg.changes_file)
+ examine_package.display_changes(changes['distribution'], Upload.pkg.changes_file)
files = Upload.pkg.files
for f in files.keys():
if files[f].has_key("new"):
ftype = files[f]["type"]
if ftype == "deb":
files = Upload.pkg.files
for f in files.keys():
if files[f].has_key("new"):
ftype = files[f]["type"]
if ftype == "deb":
- examine_package.check_deb(f)
+ examine_package.check_deb(changes['distribution'], f)
- examine_package.check_dsc(f)
+ examine_package.check_dsc(changes['distribution'], f)
finally:
sys.stdout = stdout_fd
except IOError, e:
finally:
sys.stdout = stdout_fd
except IOError, e: