Only display reverse dependency section when there are any

This commit is contained in:
Stefano Rivera 2011-11-13 02:25:42 +02:00
parent ce61a43a13
commit ad463fb831

View File

@ -103,7 +103,25 @@ def find_rdepends(package, releases, published_binaries):
for release, relationship in appearences: for release, relationship in appearences:
output += [' [ ] %s (%s)' % (release, relationship)] output += [' [ ] %s (%s)' % (release, relationship)]
return '\n'.join(output) found_any = sum(len(rdeps) for rdeps in intermediate.itervalues())
if found_any:
output = [
"Reverse dependencies:",
"=====================",
"The following reverse-dependencies need to be tested against the "
"new version of %(package)s. "
"For reverse-build-dependencies (-Indep), please test that the "
"package still builds against the new %(package)s. "
"For reverse-dependencies, please test that the version of the "
"package currently in the release still works with the new "
"%(package)s installed. "
"Reverse- Recommends, Suggests, and Enhances don't need to be "
"tested, and are listed for completeness-sake."
] + output
else:
output = ["No reverse dependencies"]
return output
def locate_package(package, distribution): def locate_package(package, distribution):
@ -152,41 +170,30 @@ def request_backport(package_spph, source, destinations):
'component': package_spph.getComponent(), 'component': package_spph.getComponent(),
'source': source, 'source': source,
'destinations': ', '.join(destinations), 'destinations': ', '.join(destinations),
'testing': '\n'.join(testing),
'rdepends': find_rdepends(package_spph, destinations,
published_binaries),
} }
subject = ("Please backport %(package)s %(version)s (%(component)s) " subject = ("Please backport %(package)s %(version)s (%(component)s) "
"from %(source)s" % subst) "from %(source)s" % subst)
body = ("Please backport %(package)s %(version)s (%(component)s) " body = ('\n'.join(
"from %(source)s to %(destinations)s.\n" [
"\n" "Please backport %(package)s %(version)s (%(component)s) "
"Reason for the backport:\n" "from %(source)s to %(destinations)s.",
"========================\n" "",
"<<< Enter your reasoning here >>>\n" "Reason for the backport:",
"\n" "========================",
"Testing:\n" "<<< Enter your reasoning here >>>",
"========\n" "",
"Testing:",
"========",
"Mark off items in the checklist [X] as you test them, " "Mark off items in the checklist [X] as you test them, "
"but please leave the checklist so that backporters can quickly " "but please leave the checklist so that backporters can quickly "
"evaluate the state of testing.\n" "evaluate the state of testing.",
"\n" ""
"%(testing)s\n" ]
"\n" + testing
"Reverse dependencies:\n" + [""]
"=====================\n" + find_rdepends(package_spph, destinations, published_binaries)
"The following reverse-dependencies need to be tested against the " + [""]
"new version of %(package)s. " ) % subst)
"For reverse-build-dependencies (-Indep), please test that the "
"package still builds against the new %(package)s. "
"For reverse-dependencies, please test that the version of the "
"package currently in the release still works with the new "
"%(package)s installed. "
"Reverse- Recommends, Suggests, and Enhances don't need to be "
"tested, and are listed for completeness-sake."
"\n"
"%(rdepends)s\n"
% subst)
subject, body = edit_report(subject, body, changes_required=True) subject, body = edit_report(subject, body, changes_required=True)