*/*: Clean PYTHON_COMPAT of obsolete impls
[gentoo.git] / net-firewall / firewalld / firewalld-0.7.1.ebuild
1 # Copyright 1999-2020 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 EAPI=7
5 PYTHON_COMPAT=( python{2_7,3_6,3_7} )
6
7 inherit autotools bash-completion-r1 gnome2-utils linux-info python-single-r1 systemd xdg-utils
8
9 DESCRIPTION="A firewall daemon with D-BUS interface providing a dynamic firewall"
10 HOMEPAGE="http://www.firewalld.org/"
11 SRC_URI="https://github.com/${PN}/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
12
13 LICENSE="GPL-2+"
14 SLOT="0"
15 KEYWORDS="~amd64 ~arm64 ~ppc64 ~x86"
16 IUSE="gui"
17 REQUIRED_USE="${PYTHON_REQUIRED_USE}"
18
19 RDEPEND="${PYTHON_DEPS}
20         !!net-firewall/gshield
21         dev-python/dbus-python[${PYTHON_USEDEP}]
22         dev-python/decorator[${PYTHON_USEDEP}]
23         >=dev-python/python-slip-0.2.7[dbus,${PYTHON_USEDEP}]
24         dev-python/pygobject:3[${PYTHON_USEDEP}]
25         net-firewall/iptables[ipv6]
26         || ( net-firewall/iptables[nftables] net-firewall/ebtables )
27         net-firewall/ipset
28         net-firewall/nftables
29         || ( >=sys-apps/openrc-0.11.5 sys-apps/systemd )
30         gui? (
31                 x11-libs/gtk+:3
32                 dev-python/PyQt5[gui,widgets,${PYTHON_USEDEP}]
33         )"
34 DEPEND="${RDEPEND}
35         dev-libs/glib:2
36         >=dev-util/intltool-0.35
37         sys-devel/gettext"
38
39 RESTRICT="test" # bug 650760
40
41 pkg_setup() {
42         local CONFIG_CHECK="~NF_CONNTRACK ~NF_CONNTRACK_IPV4 ~NF_CONNTRACK_IPV6 ~NETFILTER_XT_MATCH_CONNTRACK"
43         linux-info_pkg_setup
44 }
45
46 src_prepare() {
47         default
48         eautoreconf
49 }
50
51 src_configure() {
52         python_setup
53
54         econf \
55                 --enable-systemd \
56                 --with-iptables="${EPREFIX}/sbin/iptables" \
57                 --with-ip6tables="${EPREFIX}/sbin/ip6tables" \
58                 --with-iptables_restore="${EPREFIX}/sbin/iptables-restore" \
59                 --with-ip6tables_restore="${EPREFIX}/sbin/ip6tables-restore" \
60                 --with-ebtables="${EPREFIX}/sbin/ebtables" \
61                 --with-ebtables_restore="${EPREFIX}/sbin/ebtables-restore" \
62                 --with-nft="${EPREFIX}/sbin/nft" \
63                 --with-systemd-unitdir="$(systemd_get_systemunitdir)" \
64                 --with-bashcompletiondir="$(get_bashcompdir)"
65 }
66
67 src_install() {
68         default
69         python_optimize
70
71         # Get rid of junk
72         rm -rf "${D}/etc/rc.d/" || die
73         rm -rf "${D}/etc/sysconfig/" || die
74
75         # For non-gui installs we need to remove GUI bits
76         if ! use gui; then
77                 rm -rf "${D}/etc/xdg/autostart" || die
78                 rm -f "${D}/usr/bin/firewall-applet" || die
79                 rm -f "${D}/usr/bin/firewall-config" || die
80                 rm -rf "${D}/usr/share/applications" || die
81                 rm -rf "${D}/usr/share/icons" || die
82         fi
83
84         newinitd "${FILESDIR}"/firewalld.init firewalld
85 }
86
87 pkg_preinst() {
88         gnome2_schemas_savelist
89 }
90
91 pkg_postinst() {
92         xdg_icon_cache_update
93         gnome2_schemas_update
94 }
95
96 pkg_postrm() {
97         xdg_icon_cache_update
98         gnome2_schemas_update
99 }