From 2a8ed0f1e07f9d0c30d16066509c7023a322ac93 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Feb 09 2018 11:37:58 +0000 Subject: When searching by source name try to get a direct match first Then fall back to what are potentially sub-packages. Signed-off-by: Pierre-Yves Chibon --- diff --git a/mdapi/lib.py b/mdapi/lib.py index 7c2e54f..9b547ee 100644 --- a/mdapi/lib.py +++ b/mdapi/lib.py @@ -107,6 +107,12 @@ def get_package(session, pkg_name): def get_package_by_src(session, pkg_name): ''' Return information about a package, if we can find it. ''' + # First try if there is a package matching exactly the provided name + simple_match = yield from get_package(session, pkg_name) + if simple_match and simple_match.basename == pkg_name: + return simple_match + + # If there is not a direct match, look by the sourcerpm name output = None cnt = 0 try: