| Summary: | sepolicy generate broken in rawhide. | ||
|---|---|---|---|
| Product: | [Fedora] Fedora | Reporter: | Daniel Walsh <dwalsh> |
| Component: | policycoreutils | Assignee: | Petr Lautrbach <plautrba> |
| Status: | CLOSED ERRATA | QA Contact: | Fedora Extras Quality Assurance <extras-qa> |
| Severity: | unspecified | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | rawhide | CC: | dwalsh, jsilhan, mgrepl, mluscon, packaging-team-maint, plautrba, pnemade, vmukhame |
| Target Milestone: | --- | ||
| Target Release: | --- | ||
| Hardware: | Unspecified | ||
| OS: | Unspecified | ||
| Whiteboard: | |||
| Fixed In Version: | policycoreutils-2.4-20.fc23 | Doc Type: | Bug Fix |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-02-23 19:21:49 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
Note: /usr/bin/rkt needs to be installed to reproduce this issue. Using pkg_basename = rpmUtils.miscutils.splitFilename(pkg.sourcerpm)[0] 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 @@
else:
self.add_dir(fname)
- pkg_basename = dnf.rpm.miscutils.splitFilename(pkg.sourcerpm)[0]
+ 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
$ python
>>> '-'.join("selinux-policy-targeted-3.13.1-158.7.fc23.noarch".split('-')[0:-2])
'selinux-policy-targeted'
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. |
# sepolicy generate --init /usr/bin/rkt Traceback (most recent call last): File "/bin/sepolicy", line 650, in <module> args.func(args) File "/bin/sepolicy", line 519, in generate mypolicy.gen_writeable() File "/usr/lib64/python3.5/site-packages/sepolicy/generate.py", line 1309, in gen_writeable self.__extract_rpms() File "/usr/lib64/python3.5/site-packages/sepolicy/generate.py", line 1281, in __extract_rpms pkg_basename = dnf.rpm.miscutils.splitFilename(pkg.sourcerpm)[0] AttributeError: module 'dnf.rpm.miscutils' has no attribute 'splitFilename'