# sepolicy generate --init /usr/bin/rkt
Traceback (most recent call last):
File "/bin/sepolicy", line 650, in <module>
File "/bin/sepolicy", line 519, in generate
File "/usr/lib64/python3.5/site-packages/sepolicy/generate.py", line 1309, in gen_writeable
File "/usr/lib64/python3.5/site-packages/sepolicy/generate.py", line 1281, in __extract_rpms
pkg_basename = dnf.rpm.miscutils.splitFilename(pkg.sourcerpm)
AttributeError: module 'dnf.rpm.miscutils' has no attribute 'splitFilename'
Note: /usr/bin/rkt needs to be installed to reproduce this issue.
pkg_basename = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)
helps me to generate a new policy. Just a quick fix. I am not sure if there is a solution with dnf module.
Is that available for python3?
We don't need to use dnf, the following patch fixes it for the moment:
--- /usr/lib64/python3.4/site-packages/sepolicy/generate.py.orig 2016-02-21 12:44:42.871125419 +0100
+++ /usr/lib64/python3.4/site-packages/sepolicy/generate.py 2016-02-21 12:45:06.238043729 +0100
@@ -1278,7 +1278,7 @@
- pkg_basename = dnf.rpm.miscutils.splitFilename(pkg.sourcerpm)
+ pkg_basename = '-'.join(pkg.sourcerpm.split('-')[0:-2])
for bpkg in installed.filter(name=pkg_basena
policycoreutils-2.4-20.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2016-a7b86cd38e
policycoreutils-2.4-20.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-a7b86cd38e
While this works it might hit some corner cases where a package name includes -1
But most likely this is fine.
I don't think there's a valid case it doesn't work. Package id consists of <name>-<version>-<release> and '-' is an illegal char in <version> and <release>:
error: line 9: Illegal char '-' (0x2d) in: Version: 2.5.-1
error: line 10: Illegal char '-' (0x2d) in: Release: 0.1.rc1.fc23.-1
policycoreutils-2.4-20.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.
SGTM Petr, nice work.