Description of problem: It seems a the stringToVersion() utility functions was removed from dnf/rpmUtils/miscutils.py without being provided elsewhere. Commit 4e00d6481f028495dc0ddbd353826f47d52b8f2c [1] removed stringToVersion(), but there doesn't seem to be another source for this function. The commit marks the function as unused, but doesn't provide a path for Python 2 code using this function to be ported to Python 3 without reimplementing the functionality. Additional info: [1] https://github.com/rpm-software-management/dnf/commit/4e00d6481f028495dc0ddbd353826f47d52b8f2c
It turns out that function is also buggy, so should be fixed as well as reimplemented. >>> rpmUtils.miscutils.stringToVersion('fedora-review-0.6.1-1.fc24.noarch') ('0', 'fedora', 'review-0.6.1-1.fc24.noarch')
Nevermind that last comment, works fine, but still should be available in DNF for Python 3. >>> rpmUtils.miscutils.stringToVersion('0.6.1-1.fc24.noarch') ('0', '0.6.1', '1.fc24.noarch')
That was never API.
According to the docs it is for yum: http://yum.baseurl.org/api/yum-3.2.27/ $ dnf provides /usr/lib/python2.7/site-packages/rpmUtils/miscutils.py Last metadata expiration check: 2 days, 1:56:36 ago on Wed Aug 3 16:16:57 2016. yum-3.4.3-509.fc24.noarch : RPM package installer/updater/manager Repo : @System yum-3.4.3-509.fc24.noarch : RPM package installer/updater/manager Repo : fedora Capability exists in Yum for Python 2 and is not provided by DNF.
We need this method for Python 3 support in rdopkg. (discussed at https://review.rdoproject.org/r/6705)
I create pull request that should provide a functionality (https://github.com/rpm-software-management/dnf/pull/828). Hope that it is what was requested
Example how to use it: ``` subject = dnf.subjet.Subject("my_nevra_string") possible_nevra = subject.get_nevra_possibilities() ``` If I want to print all possible names just use: ``` for nevra in possible_nevra: print(nevra.name) ```
Thank you! Especially for providing an example. Would you mind putting that example into the DNF documentation, so it will be easy for developers to discover?
Examples added
The patch was released in dnf-2.5.1-1 into rawhide and fc26.