[packages/firewalld] Version: 0.4.2

jajcus jajcus at pld-linux.org
Sun Jun 19 22:29:48 CEST 2016


commit 6a1554d7085ba05e22b05be42e33c8e915594b05
Author: Jacek Konieczny <jajcus at jajcus.net>
Date:   Sun Jun 19 22:28:09 2016 +0200

    Version: 0.4.2
    
    - use Python3 for the service, but still package python2 library
    - make it build and somehow start
    
    still needs some work

 firewalld.spec             | 123 +++++++++++++++++++++------------------------
 pid_file_RHBZ1233232.patch |  58 ---------------------
 2 files changed, 56 insertions(+), 125 deletions(-)
---
diff --git a/firewalld.spec b/firewalld.spec
index 6462714..ceba2b3 100644
--- a/firewalld.spec
+++ b/firewalld.spec
@@ -1,19 +1,14 @@
-#
-# Conditional build:
-%bcond_with	python3 # CPython 3.x package
-
 Summary:	A firewall daemon with D-Bus interface providing a dynamic firewall
 Name:		firewalld
-Version:	0.3.14.2
+Version:	0.4.2
 Release:	0.1
 License:	GPL v2+
 Source0:	https://fedorahosted.org/released/firewalld/%{name}-%{version}.tar.bz2
-# Source0-md5:	5984690845a7be38dff3cedff273b73a
+# Source0-md5:	21983c929bd5061df73408a11cb3a8fd
 Source1:	FedoraServer.xml
 Group:		Networking/Admin
 Source2:	FedoraWorkstation.xml
 Patch0:		MDNS-default.patch
-Patch1:		pid_file_RHBZ1233232.patch
 URL:		http://www.firewalld.org/
 BuildRequires:	desktop-file-utils
 BuildRequires:	docbook-style-xsl
@@ -22,21 +17,21 @@ BuildRequires:	glib2
 # glib2-devel is needed for gsettings.m4
 BuildRequires:	glib2-devel
 BuildRequires:	intltool
-BuildRequires:	python-devel
+BuildRequires:	python3
+BuildRequires:	python3-modules
 BuildRequires:	rpm-pythonprov
 BuildRequires:	rpmbuild(macros) >= 1.713
+BuildRequires:	sed >= 4.0
 BuildRequires:	systemd-units
-%if %{with python3}
-BuildRequires:	python3-devel
-%endif
 Requires:	ebtables
 Requires:	iptables
+Suggests:	ipset
 Requires(post):	systemd
 Requires(preun):	systemd
 Requires(postun):	systemd
 Requires:	firewalld-config
 Requires:	firewalld-filesystem = %{version}-%{release}
-Requires:	python-firewall = %{version}-%{release}
+Requires:	python3-firewall = %{version}-%{release}
 Obsoletes:	firewalld-config-cloud <= 0.3.15
 Obsoletes:	firewalld-config-server <= 0.3.15
 Obsoletes:	firewalld-config-standard <= 0.3.15
@@ -66,7 +61,7 @@ Summary:	Python3 bindings for firewalld
 Group:		Libraries/Python
 Requires:	python3-dbus
 Requires:	python3-decorator
-Requires:	python3-gobject
+Requires:	python3-pygobject
 Requires:	python3-slip-dbus
 
 %description -n python3-firewall
@@ -148,40 +143,37 @@ Workstation product specific firewalld configuration settings.
 %prep
 %setup -q
 %patch0 -p1
-%patch1 -p1
-
-%if %{with python3}
-rm -rf py3
-cp -a . py3
-%endif
 
 %build
 %configure \
 	--enable-sysconfig \
 	--enable-rpmmacros \
-	PYTHON=%{__python}
-
-%if %{with python3}
-cd py3
-	%configure \
-	--enable-sysconfig \
-	--enable-rpmmacros \
+	--with-systemd-unitdir=%{systemdunitdir} \
+	--with-iptables=/usr/sbin/iptables \
+	--with-iptables-restore=/usr/sbin/iptables-restore \
+	--with-ip6tables=/usr/sbin/ip6tables \
+	--with-ip6tables-restore=/usr/sbin/ip6tables-restore \
+	--with-ebtables=/usr/sbin/ebtables \
+	--with-ebtables-restore=/usr/sbin/ebtables-restore \
+	--with-ipset=/usr/sbin/ipset \
 	PYTHON=%{__python3}
-%endif
 
 %install
 rm -rf $RPM_BUILD_ROOT
-%{__make} install \
-	PYTHON=%{__python} \
-	DESTDIR=$RPM_BUILD_ROOT
 
-%if %{with python3}
-cd py3
+# Python 2 library, in case anything still wants this
 %{__make} -C src \
-	install-nobase_dist_pythonDATA \
+        install-nobase_dist_pythonDATA \
+	pythondir=%{py_sitescriptdir} \
+	pyexecdir=%{py_sitescriptdir} \
+        PYTHON=%{__python} \
+        DESTDIR=$RPM_BUILD_ROOT
+
+%{__make} install \
+	pythondir=%{py3_sitescriptdir} \
+	pyexecdir=%{py3_sitescriptdir} \
 	PYTHON=%{__python3} \
 	DESTDIR=$RPM_BUILD_ROOT
-%endif
 
 %find_lang %{name} --all-name
 
@@ -200,6 +192,7 @@ install -c %{SOURCE2} $RPM_BUILD_ROOT%{_prefix}/lib/firewalld/zones/FedoraWorkst
 # standard firewalld.conf
 mv $RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld.conf \
 	$RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld-standard.conf
+ln -s firewalld-standard.conf $RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld.conf
 
 # server firewalld.conf
 cp -a $RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld-standard.conf \
@@ -213,7 +206,22 @@ cp -a $RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld-standard.conf \
 sed -i 's|^DefaultZone=.*|DefaultZone=FedoraWorkstation|g' \
 	$RPM_BUILD_ROOT%{_sysconfdir}/firewalld/firewalld-workstation.conf
 
-rm -f $RPM_BUILD_ROOT%{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy
+ln -sf org.fedoraproject.FirewallD1.server.policy $RPM_BUILD_ROOT%{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy
+
+rm -f $RPM_BUILD_ROOT/usr/lib/firewalld/ipsets/README
+rm -f $RPM_BUILD_ROOT/usr/lib/rpm/macros.d/macros.firewalld
+
+%{__sed} -i -e '1s,^#!.*python,#!%{__python3},' $RPM_BUILD_ROOT{%{_sbindir},%{_bindir}}/*
+
+%py_comp $RPM_BUILD_ROOT%{py_sitescriptdir}/firewall
+%py_ocomp $RPM_BUILD_ROOT%{py_sitescriptdir}/firewall
+
+for module in ""  "/config" "/core" "/core/io" "/server"  ; do
+    %{__python3} -m compileall -l -d %{py3_sitescriptdir}/firewall$module $RPM_BUILD_ROOT%{py3_sitescriptdir}/firewall$module
+    %{__python3} -O -m compileall -l -d %{py3_sitescriptdir}/firewall$module $RPM_BUILD_ROOT%{py3_sitescriptdir}/firewall$module
+done
+%{__python3} -m compileall -l -d %{_datadir}/firewalld $RPM_BUILD_ROOT%{_datadir}/firewalld
+%{__python3} -O -m compileall -l -d %{_datadir}/firewalld $RPM_BUILD_ROOT%{_datadir}/firewalld
 
 %clean
 rm -rf $RPM_BUILD_ROOT
@@ -225,7 +233,7 @@ rm -rf $RPM_BUILD_ROOT
 %systemd_preun firewalld.service
 
 %postun
-%systemd_postun_with_restart firewalld.service
+%systemd_reload firewalld.service
 
 %posttrans
 # If we don't yet have a symlink or existing file for firewalld.conf,
@@ -336,22 +344,20 @@ fi
 %{_prefix}/lib/firewalld/services/*.xml
 %{_prefix}/lib/firewalld/zones/*.xml
 %{_prefix}/lib/firewalld/xmlschema/*.xsd
+%attr(755,root,root) %{_prefix}/lib/firewalld/xmlschema/check.sh
 %dir %attr(750,root,root) %dir %{_sysconfdir}/firewalld
-#%ghost %config(noreplace) %{_sysconfdir}/firewalld/firewalld.conf
-#%config(noreplace) %{_sysconfdir}/firewalld/firewalld-standard.conf
-#%config(noreplace) %{_sysconfdir}/firewalld/firewalld-server.conf
-#%config(noreplace) %{_sysconfdir}/firewalld/firewalld-workstation.conf
-%config(noreplace) %{_sysconfdir}/firewalld/lockdown-whitelist.xml
+%ghost %config(noreplace) %{_sysconfdir}/firewalld/firewalld.conf
 %attr(750,root,root) %dir %{_sysconfdir}/firewalld/icmptypes
 %attr(750,root,root) %dir %{_sysconfdir}/firewalld/services
 %attr(750,root,root) %dir %{_sysconfdir}/firewalld/zones
-%defattr(0644,root,root)
+%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/firewalld/lockdown-whitelist.xml
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/firewalld
-#%{systemdunitdir}/firewalld.service
+%{systemdunitdir}/firewalld.service
 %config(noreplace) /etc/dbus-1/system.d/FirewallD.conf
 %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.desktop.policy
 %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.server.policy
-#%ghost %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy
+%ghost %{_datadir}/polkit-1/actions/org.fedoraproject.FirewallD1.policy
+%{_datadir}/%{name}/tests
 %{_mandir}/man1/firewall*cmd*.1*
 %{_mandir}/man1/firewalld*.1*
 %{_mandir}/man5/firewall*.5*
@@ -369,30 +375,9 @@ fi
 %{py_sitescriptdir}/firewall/core/io/*.py*
 %{py_sitescriptdir}/firewall/server/*.py*
 
-%if %{with python3}
 %files -n python3-firewall
 %defattr(644,root,root,755)
-%dir %{py3_sitescriptdir}/firewall
-%dir %{py3_sitescriptdir}/firewall/__pycache__
-%dir %{py3_sitescriptdir}/firewall/config
-%dir %{py3_sitescriptdir}/firewall/config/__pycache__
-%dir %{py3_sitescriptdir}/firewall/core
-%dir %{py3_sitescriptdir}/firewall/core/__pycache__
-%dir %{py3_sitescriptdir}/firewall/core/io
-%dir %{py3_sitescriptdir}/firewall/core/io/__pycache__
-%dir %{py3_sitescriptdir}/firewall/server
-%dir %{py3_sitescriptdir}/firewall/server/__pycache__
-%{py3_sitescriptdir}/firewall/__pycache__/*.py*
-%{py3_sitescriptdir}/firewall/*.py*
-%{py3_sitescriptdir}/firewall/config/*.py*
-%{py3_sitescriptdir}/firewall/config/__pycache__/*.py*
-%{py3_sitescriptdir}/firewall/core/*.py*
-%{py3_sitescriptdir}/firewall/core/__pycache__/*.py*
-%{py3_sitescriptdir}/firewall/core/io/*.py*
-%{py3_sitescriptdir}/firewall/core/io/__pycache__/*.py*
-%{py3_sitescriptdir}/firewall/server/*.py*
-%{py3_sitescriptdir}/firewall/server/__pycache__/*.py*
-%endif
+%{py3_sitescriptdir}/firewall
 
 %files -n firewalld-filesystem
 %defattr(644,root,root,755)
@@ -401,6 +386,7 @@ fi
 %dir %{_prefix}/lib/firewalld/services
 %dir %{_prefix}/lib/firewalld/zones
 %dir %{_prefix}/lib/firewalld/xmlschema
+%dir %{_datadir}/firewalld
 #%{_rpmconfigdir}/macros.d/macros.firewalld
 
 %files -n firewall-applet
@@ -410,13 +396,16 @@ fi
 %{_sysconfdir}/xdg/autostart/firewall-applet.desktop
 %{_iconsdir}/hicolor/*/apps/firewall-applet*.*
 %{_mandir}/man1/firewall-applet*.1*
+%dir %{_sysconfdir}/firewall
+%config(noreplace) %{_sysconfdir}/firewall/applet.conf
 
 %files -n firewall-config
 %defattr(644,root,root,755)
 %attr(755,root,root) %{_bindir}/firewall-config
 %defattr(0644,root,root)
+%{_datadir}/firewalld/__pycache__
 %{_datadir}/firewalld/firewall-config.glade
-%{_datadir}/firewalld/gtk3_chooserbutton.py*
+%{_datadir}/firewalld/gtk3_*
 %{_desktopdir}/firewall-config.desktop
 %{_datadir}/appdata/firewall-config.appdata.xml
 %{_iconsdir}/hicolor/*/apps/firewall-config*.*
diff --git a/pid_file_RHBZ1233232.patch b/pid_file_RHBZ1233232.patch
deleted file mode 100644
index f785bc7..0000000
--- a/pid_file_RHBZ1233232.patch
+++ /dev/null
@@ -1,58 +0,0 @@
-commit 3a1f22c95bb5723456533de5aa821143682b8e3d
-Author: Thomas Woerner <twoerner at redhat.com>
-Date:   Thu Jun 18 16:55:40 2015 +0200
-
-    firewalld: Fixed 'pid_file' referenced before assignment (RHBZ#1233232)
-
-diff --git a/src/firewalld b/src/firewalld
-index 2db71a8..bd81316 100755
---- a/src/firewalld
-+++ b/src/firewalld
-@@ -82,6 +82,7 @@ def setup_logging(args):
-             log.addDebugLogging("*", log.stdout)
- 
- def startup(args):
-+    pid_file = "/var/run/firewalld.pid"
-     try:
-         if not args.nofork:
-             # do the UNIX double-fork magic, see Stevens' "Advanced
-@@ -119,7 +120,6 @@ def startup(args):
- 
-         if not args.nopid:
-             # write the pid file
--            pid_file = "/var/run/firewalld.pid"
-             with open(pid_file, "w") as f:
-                 f.write(str(os.getpid()))
- 
-@@ -128,27 +128,27 @@ def startup(args):
-         server.run_server(args.debug_gc)
- 
-         # Clean up on exit
--        if os.path.exists(pid_file) and not args.nopid:
-+        if not args.nopid and os.path.exists(pid_file):
-             os.remove(pid_file)
- 
-     except OSError as e:
-         log.fatal(_("Fork #1 failed: %d (%s)") % (e.errno, e.strerror))
-         log.error(traceback.format_exc())
--        if os.path.exists(pid_file) and not args.nopid:
-+        if not args.nopid and os.path.exists(pid_file):
-             os.remove(pid_file)
-         sys.exit(1)
- 
-     except dbus.exceptions.DBusException as e:
-         log.fatal(str(e))
-         log.error(traceback.format_exc())
--        if os.path.exists(pid_file) and not args.nopid:
-+        if not args.nopid and os.path.exists(pid_file):
-             os.remove(pid_file)
-         sys.exit(1)
- 
-     except IOError as e:
-         log.fatal(str(e))
-         log.error(traceback.format_exc())
--        if os.path.exists(pid_file) and not args.nopid:
-+        if not args.nopid and os.path.exists(pid_file):
-             os.remove(pid_file)
-         sys.exit(1)
- 
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/firewalld.git/commitdiff/6a1554d7085ba05e22b05be42e33c8e915594b05



More information about the pld-cvs-commit mailing list