-
Notifications
You must be signed in to change notification settings - Fork 162
Improve logging of requires #4430
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
I'd say it should be separated, wth proper messaging, e.g. "failed to install required packages, see the details below, we're done here" vs "failed to install recommended packages, see the details below, and let's move on".
Yes. We should have a test somewhere checking whether a non-existent package failed to install, it should be enough to extend it with an assert or two to check for new messages. |
795a3dc to
b46f5c7
Compare
|
I have addressed comments and suggestions in b46f5c7 For the "unattributed_packages" - I don't know if that can even happen that packages would not be required/recommended - but maybe the "essential requires" like |
|
|
||
| raise NotImplementedError | ||
|
|
||
| def extract_package_name_from_package_manager_output(self, output: str) -> Iterator[str]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, decorate with @abc.abstractmethod to make clear to linters this is an abstract method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or not. After seeing the actual methods, how about moving the patterns into classes, making something like _PACKAGE_NAME_IN_PM_OUTPUT_PATTERNS = [...], and the default implementation of this method can do what all the methods do: iterate over a list of patterns, match, yield. They are really repeating the same set of lines, right? The only thing that's different is the actual set of patterns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to classes. Should the compiles themselves be also inside a class?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yes, why not?
class ApkEngine(PackageManagerEngine):
install_command = Command('add')
_engine_class = ApkEngine
_PACKAGE_NAME_IN_PM_OUTPUT_PATTERNS = [
re.compile(r'unable to locate package\s+([^\s]+)', re.IGNORECASE),
re.compile(r'ERROR:\s+([^\s:]+):\s+No such package', re.IGNORECASE)
]
tmt/package_managers/apt.py
Outdated
| # Compiled regex patterns for APT error messages | ||
| _UNABLE_TO_LOCATE_PATTERN = re.compile(r'Unable to locate package\s+([^\s]+)', re.IGNORECASE) | ||
| _E_UNABLE_TO_LOCATE_PATTERN = re.compile( | ||
| r'E:\s+Unable to locate package\s+([^\s]+)', re.IGNORECASE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would (?:E:\s+)? be possible? Then we would need just one pattern, with the E: prefix being optional, the rest seems to be the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've used the non-capture group like you suggested.
|
I've addressed the comments in latest commits, now extending the tests remains. |
Pull Request Checklist
dependencies_to_testgathers both requires + recommends and tmt is going to fail when something could not be installed in the require phase already. If all required packages are available to install, but a recommended one is not, then it will fail also, but the message{package}: required by {test_name}might be a bit misleading, because it is not required, only recommended. Should the messaging be handled separately or is simply "needed by" enough to cover both requires+recommend in general?Output:
Test coverage needed?
Fixes #4302