From f26322759f15cd408d488deacef94f8670f8df10 Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Jul 24 2015 15:26:50 +0000 Subject: All scripts originally from policycoreutils-python use python 3 now --- diff --git a/policycoreutils-rhat.patch b/policycoreutils-rhat.patch index eb8eea0..a0f6d60 100644 --- a/policycoreutils-rhat.patch +++ b/policycoreutils-rhat.patch @@ -9,9 +9,15 @@ index 962ac12..6a9c40c 100644 INOTIFYH = $(shell ls /usr/include/sys/inotify.h 2>/dev/null) diff --git a/policycoreutils-2.4/audit2allow/audit2allow b/policycoreutils-2.4/audit2allow/audit2allow -index c9713a2..167e135 100644 +index c9713a2..4796fad 100644 --- a/policycoreutils-2.4/audit2allow/audit2allow +++ b/policycoreutils-2.4/audit2allow/audit2allow +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Authors: Karl MacMillan + # Authors: Dan Walsh + # @@ -135,13 +135,13 @@ class AuditToPolicy: elif self.__options.audit: try: @@ -151,9 +157,15 @@ index c9713a2..167e135 100644 if __name__ == "__main__": diff --git a/policycoreutils-2.4/audit2allow/audit2why b/policycoreutils-2.4/audit2allow/audit2why -index 323eddd..09422a2 100644 +index 323eddd..a078587 100644 --- a/policycoreutils-2.4/audit2allow/audit2why +++ b/policycoreutils-2.4/audit2allow/audit2why +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Authors: Karl MacMillan + # Authors: Dan Walsh + # @@ -135,13 +135,13 @@ class AuditToPolicy: elif self.__options.audit: try: @@ -291,9 +303,15 @@ index 323eddd..09422a2 100644 if __name__ == "__main__": diff --git a/policycoreutils-2.4/audit2allow/sepolgen-ifgen b/policycoreutils-2.4/audit2allow/sepolgen-ifgen -index 83c7ecf..7f8caaf 100644 +index 83c7ecf..0504608 100644 --- a/policycoreutils-2.4/audit2allow/sepolgen-ifgen +++ b/policycoreutils-2.4/audit2allow/sepolgen-ifgen +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # + # Authors: Karl MacMillan + # @@ -82,7 +82,7 @@ def get_attrs(policy_path): sys.stderr.write("No installed policy to check\n") return None @@ -654782,9 +654800,15 @@ index b306041..16eb50b 100644 msgid "Loss of data Dialog" msgstr "" diff --git a/policycoreutils-2.4/sandbox/sandbox b/policycoreutils-2.4/sandbox/sandbox -index 3678c5d..fb64464 100644 +index 3678c5d..7fc755c 100644 --- a/policycoreutils-2.4/sandbox/sandbox +++ b/policycoreutils-2.4/sandbox/sandbox +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Authors: Dan Walsh + # Authors: Thomas Liu + # Authors: Josh Cogliati @@ -25,7 +25,6 @@ import selinux import signal from tempfile import mkdtemp @@ -654937,9 +654961,15 @@ index b3b7f64..d765cb4 100644 - print "SELinux must be in enforcing mode for this test" + print("SELinux must be in enforcing mode for this test") diff --git a/policycoreutils-2.4/scripts/chcat b/policycoreutils-2.4/scripts/chcat -index 9efcb22..21212be 100755 +index 9efcb22..d61af9d 100755 --- a/policycoreutils-2.4/scripts/chcat +++ b/policycoreutils-2.4/scripts/chcat +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2005 Red Hat + # see file 'COPYING' for use and warranty information + # @@ -22,15 +22,19 @@ # 02111-1307 USA # @@ -655343,9 +655373,15 @@ index 0000000..e2befdb + packages=["policycoreutils"], +) diff --git a/policycoreutils-2.4/semanage/semanage b/policycoreutils-2.4/semanage/semanage -index dd63010..fa02242 100644 +index dd63010..7fd02ed 100644 --- a/policycoreutils-2.4/semanage/semanage +++ b/policycoreutils-2.4/semanage/semanage +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012-2013 Red Hat + # AUTHOR: Miroslav Grepl + # AUTHOR: David Quigley @@ -18,24 +18,38 @@ # # You should have received a copy of the GNU General Public License @@ -655686,11 +655722,11 @@ index 568ebfd..306d9b7 100644 def __init__(self, store): diff --git a/policycoreutils-2.4/semanage/seobject/__init__.py b/policycoreutils-2.4/semanage/seobject/__init__.py new file mode 100644 -index 0000000..ed984af +index 0000000..1cf9681 --- /dev/null +++ b/policycoreutils-2.4/semanage/seobject/__init__.py @@ -0,0 +1,2251 @@ -+#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es +# Copyright (C) 2005-2013 Red Hat +# see file 'COPYING' for use and warranty information +# @@ -656524,7 +656560,7 @@ index 0000000..ed984af + def __modify(self, name, roles = [], selevel = "", serange = None, prefix = ""): + oldserole = "" + oldserange = "" -+ newroles = string.join(roles, ' '); ++ newroles = ' '.join(roles); + if prefix == "" and len(roles) == 0 and not serange and selevel == "": + if is_mls_enabled == 1: + raise ValueError(_("Requires prefix, roles, level or range")) @@ -656548,7 +656584,7 @@ index 0000000..ed984af + oldserange = semanage_user_get_mlsrange(u) + (rc, rlist) = semanage_user_get_roles(self.sh, u) + if rc >= 0: -+ oldserole = string.join(rlist, ' '); ++ oldserole = ' '.join(rlist); + + if serange: + semanage_user_set_mlsrange(self.sh, u, untranslate(serange)) @@ -656662,7 +656698,7 @@ index 0000000..ed984af + if rc < 0: + raise ValueError(_("Could not list roles for user %s") % name) + -+ roles = string.join(rlist, ' '); ++ roles = ' '.join(rlist); + ddict[semanage_user_get_name(u)] = (semanage_user_get_prefix(u), semanage_user_get_mlslevel(u), semanage_user_get_mlsrange(u), roles) + + return ddict @@ -658555,9 +658591,15 @@ index 458a4d2..b6088af 100644 + except dbus.DBusException as e: + print(e) diff --git a/policycoreutils-2.4/sepolicy/selinux_server.py b/policycoreutils-2.4/sepolicy/selinux_server.py -index e94c38f..3cfdc94 100644 +index e94c38f..0a91638 100644 --- a/policycoreutils-2.4/sepolicy/selinux_server.py +++ b/policycoreutils-2.4/sepolicy/selinux_server.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + import dbus + import dbus.service @@ -18,7 +18,7 @@ class selinux_server(slip.dbus.service.Object): # # The semanage method runs a transaction on a series of semanage commands, @@ -658717,9 +658759,15 @@ index 2e67456..0c5f998 100644 .B sepolicy generate \-\-cgi [\-n NAME] command [\-w WRITE_PATH ] .br diff --git a/policycoreutils-2.4/sepolicy/sepolicy.py b/policycoreutils-2.4/sepolicy/sepolicy.py -index 74fb347..adb6ca5 100755 +index 74fb347..6c7639f 100755 --- a/policycoreutils-2.4/sepolicy/sepolicy.py +++ b/policycoreutils-2.4/sepolicy/sepolicy.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012 Red Hat + # AUTHOR: Dan Walsh + # see file 'COPYING' for use and warranty information @@ -32,12 +32,15 @@ gettext.bindtextdomain(PROGNAME, "/usr/share/locale") gettext.textdomain(PROGNAME) try: @@ -658995,10 +659043,13 @@ index 74fb347..adb6ca5 100755 + print("Out") sys.exit(0) diff --git a/policycoreutils-2.4/sepolicy/sepolicy/__init__.py b/policycoreutils-2.4/sepolicy/sepolicy/__init__.py -index 679725d..d3dc4be 100644 +index 679725d..78a5c9e 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/__init__.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/__init__.py -@@ -3,23 +3,27 @@ +@@ -1,25 +1,29 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + # Author: Dan Walsh # Author: Ryan Hallisey @@ -659418,9 +659469,15 @@ index 679725d..d3dc4be 100644 global portrecsbynum global port_types diff --git a/policycoreutils-2.4/sepolicy/sepolicy/booleans.py b/policycoreutils-2.4/sepolicy/sepolicy/booleans.py -index 9003652..75b14de 100644 +index 9003652..fb672fb 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/booleans.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/booleans.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012 Red Hat + # see file 'COPYING' for use and warranty information + # @@ -36,6 +36,6 @@ def get_types(src, tclass, perm): raise TypeError("The %s type is not allowed to %s any types" % (src, ",".join(perm))) @@ -659430,9 +659487,15 @@ index 9003652..75b14de 100644 tlist = tlist + expand_attribute(l) return tlist diff --git a/policycoreutils-2.4/sepolicy/sepolicy/communicate.py b/policycoreutils-2.4/sepolicy/sepolicy/communicate.py -index 9b9a09a..ec3e67e 100755 +index 9b9a09a..b99b6d4 100755 --- a/policycoreutils-2.4/sepolicy/sepolicy/communicate.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/communicate.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012 Red Hat + # see file 'COPYING' for use and warranty information + # @@ -43,7 +43,7 @@ def get_types(src, tclass, perm): raise ValueError("The %s type is not allowed to %s any types" % (src, ",".join(perm))) @@ -659443,9 +659506,15 @@ index 9b9a09a..ec3e67e 100755 return tlist diff --git a/policycoreutils-2.4/sepolicy/sepolicy/generate.py b/policycoreutils-2.4/sepolicy/sepolicy/generate.py -index 6b53035..a27b17b 100644 +index 6b53035..340a10a 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/generate.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/generate.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python -Es ++#!/usr/bin/python3 -Es + # + # Copyright (C) 2007-2012 Red Hat + # see file 'COPYING' for use and warranty information @@ -27,21 +27,21 @@ import sepolicy from sepolicy import get_all_types, get_all_attributes, get_all_roles import time @@ -660685,9 +660754,15 @@ index 6b53035..a27b17b 100644 out += "%s # %s\n" % (self.write_te(out_dir), _("Type Enforcement file")) out += "%s # %s\n" % (self.write_if(out_dir), _("Interface file")) diff --git a/policycoreutils-2.4/sepolicy/sepolicy/gui.py b/policycoreutils-2.4/sepolicy/sepolicy/gui.py -index 5ca87b9..ac2fe31 100644 +index 5ca87b9..4437d9e 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/gui.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/gui.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python -Es ++#!/usr/bin/python3 -Es + # + # Copyright (C) 2013 Red Hat + # see file 'COPYING' for use and warranty information @@ -47,12 +47,15 @@ gettext.bindtextdomain(PROGNAME, "/usr/share/locale") gettext.textdomain(PROGNAME) try: @@ -661274,9 +661349,15 @@ index 5ca87b9..ac2fe31 100644 def confirmation_close(self, button, *args): diff --git a/policycoreutils-2.4/sepolicy/sepolicy/interface.py b/policycoreutils-2.4/sepolicy/sepolicy/interface.py -index bbabb3b..b17f6af 100644 +index bbabb3b..29370ee 100644 --- a/policycoreutils-2.4/sepolicy/sepolicy/interface.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/interface.py +@@ -1,4 +1,4 @@ +-#!/usr/bin/python -Es ++#!/usr/bin/python3 -Es + # + # Copyright (C) 2012 Red Hat + # see file 'COPYING' for use and warranty information @@ -38,18 +38,22 @@ gettext.bindtextdomain(PROGNAME, "/usr/share/locale") gettext.textdomain(PROGNAME) try: @@ -661462,9 +661543,15 @@ index bbabb3b..b17f6af 100644 os.remove(v) diff --git a/policycoreutils-2.4/sepolicy/sepolicy/manpage.py b/policycoreutils-2.4/sepolicy/sepolicy/manpage.py -index ba15b2c..2316f50 100755 +index ba15b2c..b12f379 100755 --- a/policycoreutils-2.4/sepolicy/sepolicy/manpage.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/manpage.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012-2013 Red Hat + # AUTHOR: Dan Walsh + # AUTHOR: Miroslav Grepl @@ -30,103 +30,111 @@ import selinux import sepolicy from sepolicy import * @@ -663098,9 +663185,15 @@ index ba15b2c..2316f50 100755 SELinux policy allows the %s role%s can transition to the %s_r role. diff --git a/policycoreutils-2.4/sepolicy/sepolicy/network.py b/policycoreutils-2.4/sepolicy/sepolicy/network.py -index 3a75d7c..dca1b79 100755 +index 3a75d7c..fc999bf 100755 --- a/policycoreutils-2.4/sepolicy/sepolicy/network.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/network.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2012 Red Hat + # see file 'COPYING' for use and warranty information + # @@ -24,20 +24,22 @@ import sepolicy search=sepolicy.search info=sepolicy.info @@ -663384,9 +663477,15 @@ index 893a204..3a3faa6 100644 # Local policy # diff --git a/policycoreutils-2.4/sepolicy/sepolicy/transition.py b/policycoreutils-2.4/sepolicy/sepolicy/transition.py -index 11834c7..96bf96c 100755 +index 11834c7..bb5517e 100755 --- a/policycoreutils-2.4/sepolicy/sepolicy/transition.py +++ b/policycoreutils-2.4/sepolicy/sepolicy/transition.py +@@ -1,4 +1,4 @@ +-#! /usr/bin/python -Es ++#! /usr/bin/python3 -Es + # Copyright (C) 2011 Red Hat + # see file 'COPYING' for use and warranty information + # @@ -78,4 +78,4 @@ class setrans: def output(self): diff --git a/policycoreutils.spec b/policycoreutils.spec index dfa15f1..1972d96 100644 --- a/policycoreutils.spec +++ b/policycoreutils.spec @@ -18,7 +18,7 @@ Source2: policycoreutils_man_ru2.tar.bz2 Source3: system-config-selinux.png Source4: sepolicy-icons.tgz # use make-rhat-patches.sh to create following patches from https://github.com/fedora-selinux/selinux/ -# HEAD https://github.com/fedora-selinux/selinux/commit/ab77906ea96a10bcbefee06ab7d32af853d4cf33 +# HEAD https://github.com/fedora-selinux/selinux/commit/b7b250d47a5ae70efc95492cda499ee6a8ae12d8 Patch: policycoreutils-rhat.patch Patch1: sepolgen-rhat.patch Obsoletes: policycoreutils < 2.0.61-2 @@ -183,22 +183,14 @@ an SELinux environment. %{python_sitearch}/sepolicy/network.py* %{python_sitearch}/sepolicy/transition.py* %{python_sitearch}/sepolicy/sedbus.py* -%{_sysconfdir}/dbus-1/system.d/org.selinux.conf %{python_sitearch}/%{name}*.egg-info %{python_sitearch}/sepolicy*.egg-info %{python_sitearch}/%{name} -%{_mandir}/man8/chcat.8* -%{_mandir}/ru/man8/chcat.8* -%{_mandir}/man8/sandbox.8* -%{_mandir}/man8/semanage*.8* -%{_mandir}/ru/man8/semanage.8* -%{_datadir}/bash-completion/completions/semanage -%{_datadir}/bash-completion/completions/setsebool %package devel Summary: SELinux policy core policy devel utilities Group: System Environment/Base -Requires: policycoreutils-python = %{version}-%{release} +Requires: policycoreutils-python3 = %{version}-%{release} Requires: /usr/bin/make dnf Requires: selinux-policy-devel @@ -239,7 +231,7 @@ The policycoreutils-devel package contains the management tools use to develop p %package sandbox Summary: SELinux sandbox utilities Group: System Environment/Base -Requires: policycoreutils-python = %{version}-%{release} +Requires: policycoreutils-python3 = %{version}-%{release} Requires: xorg-x11-server-Xephyr >= 1.14.1-2 /usr/bin/rsync /usr/bin/xmodmap Requires: openbox BuildRequires: libcap-ng-devel