#295: Provide proper functions for ENVRA manipulation -------------------------+-------------------------------------------------- Reporter: kparal | Owner: Type: enhancement | Status: new Priority: minor | Milestone: Finger Food Component: core | Keywords: -------------------------+-------------------------------------------------- Some testcases need to manipulate ENVRA names, like stripping epoch, stripping architecture, detecting whether build name contains epoch, parsing out package name, etc. The current implementation (taken from depcheck) is clearly sub-optimal, because it doesn't reflect the full RPM naming spec, just the most widespread usage (e.g. can colon be part of NVR, except for separating epoch?):
{{{ def strip_epoch(rpmstr): return rpmstr.split(':',1)[-1] # works for E:N-V-R.A or N-V-R.A def strip_arch(rpmstr): return rpmstr.rsplit('.',1)[0] }}}
Let's create one or more methods for these tasks in our library and let's use rpmUtils module in them. That ensures that the correct algorithms for detecting epochs, names, releases, etc are used.
Most of the use cases for those methods have been mentioned in the description, but search through available code whether some more use cases are needed.