Skip to content
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

Ignore extra output when comparing versions with zypper #243

Merged
merged 1 commit into from
Aug 23, 2023

Conversation

nelsonkopliku
Copy link
Member

@nelsonkopliku nelsonkopliku commented Aug 22, 2023

This PR makes sure to ignore extra output of the zypper versioncmp command so that we can only take into account the actual comparinson result.

ie when the /etc/products.d/baseproduct symlink is missing a warning is returned in the output of a version comparison, breaking the parsing of the comparison value (expected to be -1, 0, 1)

$ zypper --terse versioncmp 1.5.2 1.5.2
Warning: The /etc/products.d/baseproduct symlink is dangling or missing!
The link must point to your core products .prod file in /etc/products.d.

0

@nelsonkopliku nelsonkopliku self-assigned this Aug 22, 2023
@nelsonkopliku nelsonkopliku added enhancement New feature or request bug Something isn't working labels Aug 22, 2023
Copy link
Contributor

@dottorblaster dottorblaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't help asking myself "what if we get an empty string?"

but still, LGTM

@nelsonkopliku nelsonkopliku merged commit d636931 into main Aug 23, 2023
9 checks passed
@nelsonkopliku nelsonkopliku deleted the strip-irrelevant-output-in-version-comparison branch August 23, 2023 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

2 participants