Currently, ekeyword.py returns 0 when you request a keyword change that has no effect. It would be useful to have it return something else (I suggest 2) so that in keywording scripts, you can use that information to correct the request before you commit. A simple use case would be where you have tested two architectures and request a stabilisation for both but one is already stable. When you have scripted the commit message to reflect a change for both architectures, and only one gets updated, you would want to catch that.
Created attachment 412312 [details, diff] gentoolkit-dev-9999-ekeyword.py-fail-on-planned-update.patch
Comment on attachment 412312 [details, diff] gentoolkit-dev-9999-ekeyword.py-fail-on-planned-update.patch this is incorrect for a bunch of reasons: - exit should pretty much never be used; you want sys.exit instead - ekeyword is a library, so calling exit is never correct - libs should be passing back up values, not exiting -- this already has |updated| - process_content() is the right func to actually pass back a diff value - this code aborts after updating a single ebuild when there might be many more
an exit of 2 wouldn't help out your automated use case. unless you can think of a better CLI here, i think the best answer is to import ekeyword yourself and call its API. the module has been written explicitly with re-use in mind.