From a160def2ab78fe1d24451e19f9f89cd833f0b012 Mon Sep 17 00:00:00 2001 From: Benjamin Drung Date: Tue, 31 Jan 2023 14:35:12 +0100 Subject: [PATCH] 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 --- requestbackport | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/requestbackport b/requestbackport index 91a03da..7baf7bb 100755 --- a/requestbackport +++ b/requestbackport @@ -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):