Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Added support for openSUSE MicroOS #5998
Added support for openSUSE MicroOS #5998
Changes from 1 commit
821d030
4924bfd
a880100
db0b4bd
9763f52
1003df2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
another way to write this
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 assume the suggested change makes the boolean operation non-trivial anymore, in the way that it allocates an array and has to reflectively apply the list items to the supplied function. For more items i'd be with you, but for two..?
Thx for the suggestion nevertheless! Phyton's not my native language and i'm happy to learn about new ways to do stuff :)
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.
On Python 3 it the
map
result is a generator, but on Python 2 this causes two calls toos.path.exists
, while the original statement only makes two calls if the first one returnsFalse
.But using a generator expression would make it rather efficient (though still slower than the original version) even on Python 2.6 and 2.7:
any(os.path.exists(path) for path in ('/var/lib/misc/transactional-update.state', '/usr/sbin/transactional-update'))
.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.
Thank you for the explanation 🤗 Makes sense.
So should i change it, or leave it as is? What's preferred?
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.
Python 2 is dead and is probably irrelevant if something there is slower than the supported release. What does /var/lib/misc/transactional-update.state contain? And is the system in a valid state if this file is missing?
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.
Hi, thanks for pinging me.
Is the pure existence of the executable enough to check if transactional updates are actually in use? It may be true for MicroOS, which only exists in the transaction-variant. In openSUSE (e.g. Tumbleweed) I can as well install
transactional-update
and have the executable on the disk. That does not mean I actually activated transactional updates. That's the reason why I checked for the state file.If there's a better way to check if transactional updates are really in use (and not only "possible"), I'm for the change. But not when we break the usage of the module on other systems.
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.
Is there a way to identify MicroOS? Maybe looking at
/etc/os-release
or/etc/lsb-release
?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.
@felixfontein in my MicroOS installation there is no
/etc/lsb-release
file, but/etc/os-release
contains: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.
It's id is
opensuse-microos
, so yes.But we shouldn't only rely on that, as the state-file doesn't exist on a transactional Tumbleweed/Leap install.
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 think we should replicate the checks zypper uses, if suitable. And it doesn't seem to use black magic, so we should be able to do so: https://github.com/openSUSE/zypper/blob/master/src/commands/conditions.cc#L44