fix(requestbackport): Remove useless loop from locate_package

Commit 0f3d2fed2a4ed67b90b5d49aab25ca2bda5d9d37 removed the difference
between the two loop iterations in `locate_package`. So drop the useless
second iteration.

Signed-off-by: Benjamin Drung <benjamin.drung@canonical.com>
This commit is contained in:
Benjamin Drung 2023-01-31 14:35:12 +01:00
parent 909d945af4
commit a160def2ab

View File

@ -164,20 +164,19 @@ def find_rdepends(releases, published_binaries):
def locate_package(package, distribution):
archive = Distribution("ubuntu").getArchive()
for pass_ in ("source", "binary"):
try:
package_spph = archive.getSourcePackage(package, distribution)
return package_spph
except PackageNotFoundException as e:
try:
package_spph = archive.getSourcePackage(package, distribution)
return package_spph
except PackageNotFoundException as e:
try:
apt_pkg = apt.Cache()[package]
except KeyError:
Logger.error(str(e))
sys.exit(1)
package = apt_pkg.candidate.source_name
Logger.info(
"Binary package specified, considering its source package instead: %s", package
)
apt_pkg = apt.Cache()[package]
except KeyError:
Logger.error(str(e))
sys.exit(1)
package = apt_pkg.candidate.source_name
Logger.info(
"Binary package specified, considering its source package instead: %s", package
)
def request_backport(package_spph, source, destinations):