From 55c224906a1d00885eb461306f072b389d6b8ed2 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 22 May 2024 19:40:21 -0400 Subject: [PATCH] More dependency detection fixes with DNF5 * DNF5 does not state "Dependencies resolved", which prevented the dependency resolver from ever moving to state==3. Instead, it states "Repositories loaded". * DNF5 states "Package ... is already installed" after "Repositories loaded" and before "Installing:", while state==2. * DNF5 includes "Installing: ## packages" in its Transaction Summary, which needs to be ignored so as to not move to state==3. --- feedback_pipeline.py | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/feedback_pipeline.py b/feedback_pipeline.py index 0ed44ca..8a1a92f 100755 --- a/feedback_pipeline.py +++ b/feedback_pipeline.py @@ -2884,22 +2884,37 @@ def _get_build_deps_from_a_root_log(self, root_log): # "Package already installed" indicates it's directly required, # so save it. - # DNF5 quotes the NVR in that statement, where DNF4 did not. + # DNF5 does this after "Repositories loaded" and quotes the NVR; + # DNF4 does this before "Dependencies resolved" without the quotes. if "is already installed." in file_line: pkg_name = file_line.split()[3].strip('"').rsplit("-",2)[0] required_pkgs.append(pkg_name) - # That's all! Next state! + # That's all! Next state! (DNF4) elif "Dependencies resolved." in file_line: state += 1 - + + # That's all! Next state! (DNF5) + elif "Repositories loaded." in file_line: + state += 1 + # 2/ # going through the log right before the first package name elif state == 2: + # "Package already installed" indicates it's directly required, + # so save it. + # DNF5 does this after "Repositories loaded" and quotes the NVR; + # DNF4 does this before "Dependencies resolved" without the quotes. + if "is already installed." in file_line: + pkg_name = file_line.split()[3].strip('"').rsplit("-",2)[0] + required_pkgs.append(pkg_name) + # The next line will be the first package. Next state! - if "Installing:" in file_line: + # DNF5 reports "Installing: ## packages" in the Transaction Summary, + # which we need to ignore + if "Installing:" in file_line and len(file_line.split()) == 3: state += 1