rpmUtils.miscutils in python3.6
Solution 1:
This library was indeed removed, but you have several other options you can use.
Please note that these other functions expect to receive a string in the NEVRA (name, epoch, version, release, architecture) format as an input, not a filename. Thus you must remove the '.rpm' extension of the filename, in order to get a NVRA string (epoch normally is not included in the filename of the RPM package).
So basically you have 2 options:
-
to use dnf as suggested in i.e. https://bugzilla.redhat.com/show_bug.cgi?id=1364504
-
to use hawkey i.e. :
import hawkey rpm_base_filename = os.path.basename(rpm_file) nevra = hawkey.split_nevra(rpm_base_filename[:-len(".rpm")]) name = nevra.name version = nevra.version release = str(nevra.release) epoch = str(nevra.epoch) arch = nevra.arch
For example here is a patch for such modification that I made for one of the tools we use as part of the oVirt release process:
https://github.com/oVirt/releng-tools/commit/823405e6b261f7ff27ddbba0e8fa2b86dd2a8698