Skip to contentSkip to conversation

package/python-slip-dbus: new package

PATCH Superseded aduskett at gmail.com 2 participants 6 messages Apr 23, 2020 – Apr 24, 2020

v3 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/2 package/python-slip-dbus: new package

From: Adam Duskett <[email protected]>

This package provides a dbus.service.Object derivative that ends itself after a certain time without being used and/or if there are no clients anymore on the message bus.

The package also provides a set of convenience functions and decorators for integrating a dbus service with PolicyKit.

Firewalld depends on this package.

---
Changes v1 -> v2:
- Combine dependency comment (Yann)
- Add a more detailed commit message. (Yann)
- Add an explination for the PYTHON_SLIP_DBUS_APPEND_VERSION hook. (Yann)

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/python-slip-dbus/Config.in            | 27 +++++++++++++++++++
 .../python-slip-dbus/python-slip-dbus.hash    |  3 +++
 package/python-slip-dbus/python-slip-dbus.mk  | 23 ++++++++++++++++
 5 files changed, 55 insertions(+)
 create mode 100644 package/python-slip-dbus/Config.in
 create mode 100644 package/python-slip-dbus/python-slip-dbus.hash
 create mode 100644 package/python-slip-dbus/python-slip-dbus.mk
DEVELOPERS +1 -0
index 56178ba100..e0ab2f61bf 100644
@@ -74,6 +74,7 @@ F:	package/python-nested-dict/
 F:	package/python-pbr/
 F:	package/python-pip/
 F:	package/python-psycopg2/
+F:	package/python-slip-dbus/
 F:	package/python-smmap2/
 F:	package/python-sqlalchemy/
 F:	package/python-sqlparse/
package/Config.in +1 -0
index a9c6f6fcbc..918052bc38 100644
@@ -1149,6 +1149,7 @@ menu "External python modules"
 	source "package/python-singledispatch/Config.in"
 	source "package/python-sip/Config.in"
 	source "package/python-six/Config.in"
+	source "package/python-slip-dbus/Config.in"
 	source "package/python-slob/Config.in"
 	source "package/python-smbus-cffi/Config.in"
 	source "package/python-smmap2/Config.in"
package/python-slip-dbus/Config.in new file +27 -0
new file mode 100644
index 0000000000..3e1c8adc03
@@ -0,0 +1,27 @@
+config BR2_PACKAGE_PYTHON_SLIP_DBUS
+	bool "python-slip-dbus"
+	depends on BR2_USE_MMU # libglib2, gobject-introspection
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS # gobject-introspection
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # gobject-introspection
+	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on BR2_TOOLCHAIN_USES_GLIBC # gobject-introspection
+	depends on BR2_PACKAGE_PYTHON3 # gobject-introspection
+	select BR2_PACKAGE_DBUS # runtime
+	select BR2_PACKAGE_DBUS_PYTHON # runtime
+	select BR2_PACKAGE_PYTHON_DECORATOR  # runtime
+	select BR2_PACKAGE_PYTHON_GOBJECT  # runtime
+	select BR2_PACKAGE_PYTHON_SIX # runtime
+	help
+	  A dbus.service.Object derivative that ends
+	  itself after a certain time without being used and/or if there
+	  are no clients anymore on the message bus, as well as
+	  convenience functions and decorators for integrating a dbus
+	  service with PolicyKit.
+
+	  https://github.com/nphilipp/python-slip
+
+comment "python-slip-dbus needs python3, and a glibc toolchain w/ gcc >= 4.9, threads"
+	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_USES_GLIBC \
+		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_PACKAGE_PYTHON3
package/python-slip-dbus/python-slip-dbus.hash new file +3 -0
new file mode 100644
index 0000000000..8a88533169
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  7a52ebe49945cd27d06a1172042a55eb5c79cfda49b742153fa076d1d9bd99a1  python-slip-0.6.5.tar.gz
+sha256  1ca3e8f71b7de618968e7ea9fe47822d9e704dc476aef8544033abedec355225  COPYING
package/python-slip-dbus/python-slip-dbus.mk new file +23 -0
new file mode 100644
index 0000000000..5c2f416f5d
@@ -0,0 +1,23 @@
+################################################################################
+#
+# python-slip-dbus
+#
+################################################################################
+
+PYTHON_SLIP_DBUS_VERSION = 0.6.5
+PYTHON_SLIP_DBUS_SOURCE = python-slip-$(PYTHON_SLIP_DBUS_VERSION).tar.gz
+PYTHON_SLIP_DBUS_SITE = https://github.com/nphilipp/python-slip/archive
+PYTHON_SLIP_DBUS_LICENSE = GPL-2.0+
+PYTHON_SLIP_DBUS_LICENSE_FILES = COPYING
+PYTHON_SLIP_DBUS_SETUP_TYPE = distutils
+PYTHON_SLIP_DBUS_DEPENDENCIES = python-gobject
+
+# Python-slip-dbus only packages a setup.py.in file with a @VERSION@ variable,
+# so we must create the file ourselves and sed the appropriate version number.
+define PYTHON_SLIP_DBUS_APPEND_VERSION
+	cd $(@D) && \
+		sed -e 's/@VERSION@/$(PYTHON_SLIP_DBUS_VERSION)/g' setup.py.in > setup.py
+endef
+PYTHON_SLIP_DBUS_PRE_CONFIGURE_HOOKS += PYTHON_SLIP_DBUS_APPEND_VERSION
+
+$(eval $(python-package))
Signature · 1 line
2.25.3
#1 lore raw

PATCH v3 2/2 package/firewalld: new package

From: Adam Duskett <[email protected]>

Firewalld provides a dynamically managed firewall with
support for network or firewall zones to define the trust level of network connections or interfaces.

Items of note:

- Iptables is set as a requirement because many applications such as Docker require direct-passthrough rules which firewalld does not support.

- Setting FIREWALLD_AUTORECONF=YES results in the following error:
"error: cannot find input file: `po/Makefile.in.in'" As such, a manual call to autogen.sh is necessary with PATH=$(BR_PATH) set to ensure the script uses the host intltoolize binary.

- Setting PYTHON="/usr/bin/env python$(PYTHON3_VERSION_MAJOR)" prevents Firewalld from setting the shebang in the installed python files to the full path to the python interpreter used when building.

- The bundled provided SYSV init file has several bashisms and requires /etc/init.d/functions which buildroot doesn't provide. So instead, we provide a more simple init.d file in the package directory, which does not require bash.

---
Changes v1 -> v2:
- Select DBUS (Yann)
- Add some extra comments in the Makefile (Yann)
- Add a more detailed commit message. (Yann)
- Move dependency lines (Yann)
- Combine dependency message (Yann)
- Cleanup init file (Yann)
- Install the systemd file.
- Bump version from 0.8.1 to 0.8.2.
- Drop upstream patch.

Changes v2 -> v3:
- Fix subject line.

 DEVELOPERS                       |  1 +
 package/Config.in                |  1 +
 package/firewalld/Config.in      | 39 +++++++++++++++
 package/firewalld/S41firewalld   | 40 +++++++++++++++
 package/firewalld/firewalld.hash |  3 ++
 package/firewalld/firewalld.mk   | 85 ++++++++++++++++++++++++++++++++
 6 files changed, 169 insertions(+)
 create mode 100644 package/firewalld/Config.in
 create mode 100644 package/firewalld/S41firewalld
 create mode 100644 package/firewalld/firewalld.hash
 create mode 100644 package/firewalld/firewalld.mk
DEVELOPERS +1 -0
index e0ab2f61bf..58d9a6200d 100644
@@ -31,6 +31,7 @@ F:	package/audit/
 F:	package/busybox/
 F:	package/checkpolicy/
 F:	package/cppdb/
+F:	package/firewalld/
 F:	package/gobject-introspection/
 F:	package/gstreamer1/gstreamer1/
 F:	package/gstreamer1/gstreamer1-mm/
package/Config.in +1 -0
index 918052bc38..07b4b5d863 100644
@@ -2029,6 +2029,7 @@ menu "Networking applications"
 	source "package/fail2ban/Config.in"
 	source "package/fastd/Config.in"
 	source "package/fcgiwrap/Config.in"
+	source "package/firewalld/Config.in"
 	source "package/flannel/Config.in"
 	source "package/fmc/Config.in"
 	source "package/fping/Config.in"
package/firewalld/Config.in new file +39 -0
new file mode 100644
index 0000000000..517bca7822
@@ -0,0 +1,39 @@
+config BR2_PACKAGE_FIREWALLD
+	bool "firewalld"
+	depends on BR2_USE_MMU # ebtables, gobject-introspection
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS # gobject-introspection
+	depends on BR2_USE_WCHAR # dbus-python, gettext
+	depends on BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12 # nftables
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # gobject-introspection
+	depends on BR2_TOOLCHAIN_HAS_THREADS # dbus-python
+	depends on BR2_TOOLCHAIN_USES_GLIBC # gobject-introspection
+	depends on BR2_PACKAGE_PYTHON3 # gobject-introspection
+	select BR2_PACKAGE_DBUS # dbus-python
+	select BR2_PACKAGE_DBUS_PYTHON
+	select BR2_PACKAGE_EBTABLES
+	select BR2_PACKAGE_GETTEXT
+	select BR2_PACKAGE_GOBJECT_INTROSPECTION
+	select BR2_PACKAGE_IPSET
+	select BR2_PACKAGE_IPTABLES
+	select BR2_PACKAGE_JANSSON # Runtime
+	select BR2_PACKAGE_NFTABLES
+	select BR2_PACKAGE_PYTHON_DECORATOR
+	select BR2_PACKAGE_PYTHON_GOBJECT
+	select BR2_PACKAGE_PYTHON_SIX
+	select BR2_PACKAGE_PYTHON_SLIP_DBUS
+	help
+	  Firewalld provides a dynamically managed firewall with
+	  support for network or firewall zones to define the trust
+	  level of network connections or interfaces. It has support
+	  for IPv4, IPv6 firewall settings and for ethernet bridges and
+	  a separation of runtime and permanent configuration options.
+	  It also provides an interface for services or applications to
+	  add ip*tables and ebtables rules directly.
+
+	  https://github.com/firewalld/firewalld
+
+comment "firewalld needs python3, and a glibc toolchain w/ gcc >= 4.9, threads"
+	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_USES_GLIBC \
+		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_PACKAGE_PYTHON3
package/firewalld/S41firewalld new file +40 -0
new file mode 100644
index 0000000000..270435f1f8
@@ -0,0 +1,40 @@
+#!/bin/sh
+
+firewalld=/usr/sbin/firewalld
+pidfile=/var/run/firewalld.pid
+
+start() {
+  printf "Starting firewalld: "
+  start-stop-daemon -S -q --exec ${firewalld}
+  [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+stop() {
+  printf "Stopping firewalld: "
+  start-stop-daemon --stop --quiet --pidfile ${pidfile}
+  [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+reload(){
+  printf "Reloading firewalld: "
+  firewall-cmd --reload
+  [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+
+restart() {
+  stop
+  start
+}
+
+status(){
+  firewall-cmd --state
+}
+
+case "${1}" in
+    start|stop|restart|reload|status)
+      ${1}
+      ;;
+    *)
+      echo "Usage: $0 {start|stop|restart|reload|status}"
+      exit 1
+esac
package/firewalld/firewalld.hash new file +3 -0
new file mode 100644
index 0000000000..93cf67ccea
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  769c57d5c49218821ad30639a3f802831f9618899e403a811802c56e30f93c79  firewalld-v0.8.2.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/firewalld/firewalld.mk new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.25.3
#2 lore raw

PATCH v3 2/2 package/firewalld: new package

Adam, All,

On 2020-04-23 10:33 -0700, aduskett at gmail.com spake thusly:

Quoted 8 lines

From: Adam Duskett <[email protected]>

Firewalld provides a dynamically managed firewall with
support for network or firewall zones to define the trust level of network connections or interfaces.

Items of note:

Quoted 7 lines

- Iptables is set as a requirement because many applications such as Docker require direct-passthrough rules which firewalld does not support.

- Setting FIREWALLD_AUTORECONF=YES results in the following error:
"error: cannot find input file: `po/Makefile.in.in'" As such, a manual call to autogen.sh is necessary with PATH=$(BR_PATH) set to ensure the script uses the host intltoolize binary.

I think we can do better. ;-)

    # Prpare the tree as autogen.sh would; allows using _AUTORECONF=YES
    define FIREWALLD_INTLTOOLIZE
        ls -1 $(@D)/po/*.po |sed -r -e 's:.*/::; s:.po$$::' >$(@D)/po/LINGUAS
        cd $(@D) && $(HOST_DIR)/bin/intltoolize --force --automake
    endef
    FIREWALLD_PRE_CONFIGURE_HOOKS += FIREWALLD_INTLTOOLIZE
Quoted 11 lines

- Setting PYTHON="/usr/bin/env python$(PYTHON3_VERSION_MAJOR)" prevents Firewalld from setting the shebang in the installed python files to the full path to the python interpreter used when building.

- The bundled provided SYSV init file has several bashisms and requires /etc/init.d/functions which buildroot doesn't provide. So instead, we provide a more simple init.d file in the package directory, which does not require bash.

---

[--SNIP--]

Quoted 15 lines
package/firewalld/firewalld.hash new file +3 -0
new file mode 100644
index 0000000000..93cf67ccea
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  769c57d5c49218821ad30639a3f802831f9618899e403a811802c56e30f93c79  firewalld-v0.8.2.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/firewalld/firewalld.mk new file +0 -0
new file mode 100644
index 0000000000..aedc250be1

package/firewalld/firewalld.mk line 5

Quoted 5 lines
package/firewalld/firewalld.mk new file +5 -0
@@ -0,0 +1,84 @@
+# iptables, ip6tables, ebtables, and ipset *should* be unnecessary
+# when the nftables backend is available, because nftables supersedes all of
+# them. However we still need to build and install iptables and ip6tables
+# because application relying on direct passthrough rules (IE docker) will
+# break.

So ti should nt be the responsibility of firewalld to select iptables or ebtables, but the individual applications, like docker, which should either unconditionally select them, or conditionally seelect them, like for example:

seelct BR2_PACKAGE_IPTABLES if BR2_PACKAGE_FIREWALLD

Quoted 9 lines
package/firewalld/firewalld.mk new file +9 -0
+# /etc/sysconfig/firewalld is a Red Hat-ism, only referenced by
+# the Red Hat-specific init script which isn't used, so we set
+# --disable-sysconfig.
+FIREWALLD_CONF_OPTS += \
+	--disable-rpmmacros \
+	--disable-sysconfig \
+	--with-ip6tables-restore=/usr/sbin/ip6tables-restore \
+	--with-ip6tables=/usr/sbin/ip6tables \
+	--with-iptables-restore=/usr/sbin/iptables-restore \

package/firewalld/firewalld.mk line 67

Quoted 10 lines
package/firewalld/firewalld.mk new file +10 -0
+	--with-iptables=/usr/sbin/iptables \
+	--with-nft=/usr/sbin/nft \
+	--without-ebtables \
+	--without-ebtables-restore \
+	--without-ipset \
+	--without-xml-catalog
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+FIREWALLD_DEPENDENCIES += systemd
+FIREWALLD_CONF_OPTS += --with-systemd-unitdir=/usr/lib/systemd/system

We also want an explicit --enable-systemd

This was just a quick review, I may come back to it later in the WE...

Regards,
Yann E. MORIN.

Quoted 24 lines
package/firewalld/firewalld.mk new file +17 -0
+else
+FIREWALLD_CONF_OPTS += --disable-systemd
+endif
+
+define FIREWALLD_INSTALL_INIT_SYSTEMD
+	$(INSTALL) -D -m 0644 $(@D)/config/firewalld.service \
+		$(TARGET_DIR)/usr/lib/systemd/system/firewalld.service
+endef
+
+# The bundled sysvinit file requires /etc/init.d/functions which is not
+# provided by buildroot. As such, we provide our own firewalld init file.
+define FIREWALLD_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 0755 $(FIREWALLD_PKGDIR)/S41firewalld \
+		$(TARGET_DIR)/etc/init.d/S41firewalld
+endef
+
+$(eval $(autotools-package))
Signature · 6 lines
2.25.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#3 lore raw

PATCH v3 2/2 package/firewalld: new package

Hello;

Quoted 20 lines · Yann E. MORIN

Adam, All,

On 2020-04-23 10:33 -0700, aduskett at gmail.com spake thusly:

Quoted 8 lines

From: Adam Duskett <[email protected]>

Firewalld provides a dynamically managed firewall with
support for network or firewall zones to define the trust level of network connections or interfaces.

Items of note:

Quoted 7 lines

- Iptables is set as a requirement because many applications such as Docker require direct-passthrough rules which firewalld does not support.

- Setting FIREWALLD_AUTORECONF=YES results in the following error:
"error: cannot find input file: `po/Makefile.in.in'" As such, a manual call to autogen.sh is necessary with PATH=$(BR_PATH) set to ensure the script uses the host intltoolize binary.

Quoted 9 lines

I think we can do better. ;-)

    # Prpare the tree as autogen.sh would; allows using _AUTORECONF=YES
    define FIREWALLD_INTLTOOLIZE
        ls -1 $(@D)/po/*.po |sed -r -e 's:.*/::; s:.po$$::' >$(@D)/po/LINGUAS
        cd $(@D) && $(HOST_DIR)/bin/intltoolize --force --automake
    endef
    FIREWALLD_PRE_CONFIGURE_HOOKS += FIREWALLD_INTLTOOLIZE

I heavily disagree:
1) The existing autogen.sh script may change in the future which would make this macro
more unmaintanable.
2) package/sdl/sdl.mk has PATH=$(BR_PATH) ./autogen.sh, which means there is already
a precident for this kind of logic.

Quoted 29 lines
Quoted 11 lines

- Setting PYTHON="/usr/bin/env python$(PYTHON3_VERSION_MAJOR)" prevents Firewalld from setting the shebang in the installed python files to the full path to the python interpreter used when building.

- The bundled provided SYSV init file has several bashisms and requires /etc/init.d/functions which buildroot doesn't provide. So instead, we provide a more simple init.d file in the package directory, which does not require bash.

---

[--SNIP--]

Quoted 17 lines
package/firewalld/firewalld.hash new file +3 -0
new file mode 100644
index 0000000000..93cf67ccea
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  769c57d5c49218821ad30639a3f802831f9618899e403a811802c56e30f93c79  firewalld-v0.8.2.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/firewalld/firewalld.mk new file +2 -0
new file mode 100644
index 0000000000..aedc250be1
@@ -0,0 +1,84 @@
+# iptables, ip6tables, ebtables, and ipset *should* be unnecessary
+# when the nftables backend is available, because nftables supersedes all of
Quoted 9 lines

package/firewalld/firewalld.mk line 48

Quoted 3 lines
package/firewalld/firewalld.mk new file +3 -0
+# them. However we still need to build and install iptables and ip6tables
+# because application relying on direct passthrough rules (IE docker) will
+# break.

So it should nt be the responsibility of firewalld to select iptables or ebtables, but the individual applications, like docker, which should either unconditionally select them, or conditionally select them, like for example:

Possibly? This change would have the potential to make things far more complicated,
as docker is just one example. I can't find a distribution (including OE) that does not always
compile firewalld with iptables.

Quoted 61 lines

seelct BR2_PACKAGE_IPTABLES if BR2_PACKAGE_FIREWALLD

Quoted 9 lines
package/firewalld/firewalld.mk new file +9 -0
+# /etc/sysconfig/firewalld is a Red Hat-ism, only referenced by
+# the Red Hat-specific init script which isn't used, so we set
+# --disable-sysconfig.
+FIREWALLD_CONF_OPTS += \
+     --disable-rpmmacros \
+     --disable-sysconfig \
+     --with-ip6tables-restore=/usr/sbin/ip6tables-restore \
+     --with-ip6tables=/usr/sbin/ip6tables \
+     --with-iptables-restore=/usr/sbin/iptables-restore \

package/firewalld/firewalld.mk line 67

Quoted 10 lines
package/firewalld/firewalld.mk new file +10 -0
+     --with-iptables=/usr/sbin/iptables \
+     --with-nft=/usr/sbin/nft \
+     --without-ebtables \
+     --without-ebtables-restore \
+     --without-ipset \
+     --without-xml-catalog
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+FIREWALLD_DEPENDENCIES += systemd
+FIREWALLD_CONF_OPTS += --with-systemd-unitdir=/usr/lib/systemd/system

We also want an explicit --enable-systemd

This was just a quick review, I may come back to it later in the WE...

Regards,
Yann E. MORIN.

Quoted 20 lines
package/firewalld/firewalld.mk new file +17 -1
+else
+FIREWALLD_CONF_OPTS += --disable-systemd
+endif
+
+define FIREWALLD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -D -m 0644 $(@D)/config/firewalld.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/firewalld.service
+endef
+
+# The bundled sysvinit file requires /etc/init.d/functions which is not
+# provided by buildroot. As such, we provide our own firewalld init file.
+define FIREWALLD_INSTALL_INIT_SYSV
+     $(INSTALL) -D -m 0755 $(FIREWALLD_PKGDIR)/S41firewalld \
+             $(TARGET_DIR)/etc/init.d/S41firewalld
+endef
+
+$(eval $(autotools-package))
--

2.25.3

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

#4 lore raw

PATCH v3 2/2 package/firewalld: new package

Adam, All,

On 2020-04-24 12:14 -0700, Adam Duskett spake thusly:

Quoted 28 lines · Yann E. MORIN
Quoted 18 lines

On 2020-04-23 10:33 -0700, aduskett at gmail.com spake thusly:

Quoted 8 lines

From: Adam Duskett <[email protected]>

Firewalld provides a dynamically managed firewall with
support for network or firewall zones to define the trust level of network connections or interfaces.

Items of note:

Quoted 7 lines

- Iptables is set as a requirement because many applications such as Docker require direct-passthrough rules which firewalld does not support.

- Setting FIREWALLD_AUTORECONF=YES results in the following error:
"error: cannot find input file: `po/Makefile.in.in'" As such, a manual call to autogen.sh is necessary with PATH=$(BR_PATH) set to ensure the script uses the host intltoolize binary.

Quoted 9 lines

I think we can do better. ;-)

    # Prpare the tree as autogen.sh would; allows using _AUTORECONF=YES
    define FIREWALLD_INTLTOOLIZE
        ls -1 $(@D)/po/*.po |sed -r -e 's:.*/::; s:.po$$::' >$(@D)/po/LINGUAS
        cd $(@D) && $(HOST_DIR)/bin/intltoolize --force --automake
    endef
    FIREWALLD_PRE_CONFIGURE_HOOKS += FIREWALLD_INTLTOOLIZE
Quoted 7 lines

I heavily disagree:
1) The existing autogen.sh script may change in the future which would make this macro
more unmaintanable.
2) package/sdl/sdl.mk has PATH=$(BR_PATH) ./autogen.sh, which means there is already
a precident for this kind of logic.

Few things:

1- the autogen.sh script calls autoreconf with a different set of
arguments as our infra does, notably it does not pass the paths to the other tools, and as such does not pass the paths to the autoconf local include directories;

2- the SDL autoreconf does not work with our AUTORECONF=YES infra,
while firewalld should work nicely after the intltoolize preparation step.

3- indeed it puts a little bit more burden on our shoulders, but in
fact all this discussion is moot is you switch to using the released tarball, rather than a git cnashot: be careful that the github helper macro will point to a github-generated tarball. However, firewalld maintainers has uploaded a released tarball:

https://github.com/firewalld/firewalld/releases/download/v0.8.2/firewalld-0.8.2.tar.gz

So, if you switch to that, we no longer need to autoreconf (unless you're going to patch one of the autotools files...)

Quoted 38 lines
Quoted 29 lines
Quoted 11 lines

- Setting PYTHON="/usr/bin/env python$(PYTHON3_VERSION_MAJOR)" prevents Firewalld from setting the shebang in the installed python files to the full path to the python interpreter used when building.

- The bundled provided SYSV init file has several bashisms and requires /etc/init.d/functions which buildroot doesn't provide. So instead, we provide a more simple init.d file in the package directory, which does not require bash.

---

[--SNIP--]

Quoted 17 lines
package/firewalld/firewalld.hash new file +3 -0
new file mode 100644
index 0000000000..93cf67ccea
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  769c57d5c49218821ad30639a3f802831f9618899e403a811802c56e30f93c79  firewalld-v0.8.2.tar.gz
+sha256  8177f97513213526df2cf6184d8ff986c675afb514d4e68a404010521b880643  COPYING
package/firewalld/firewalld.mk new file +2 -0
new file mode 100644
index 0000000000..aedc250be1
@@ -0,0 +1,84 @@
+# iptables, ip6tables, ebtables, and ipset *should* be unnecessary
+# when the nftables backend is available, because nftables supersedes all of
Quoted 9 lines

package/firewalld/firewalld.mk line 48

Quoted 3 lines
package/firewalld/firewalld.mk new file +3 -0
+# them. However we still need to build and install iptables and ip6tables
+# because application relying on direct passthrough rules (IE docker) will
+# break.

So it should nt be the responsibility of firewalld to select iptables or ebtables, but the individual applications, like docker, which should either unconditionally select them, or conditionally select them, like for example:

Quoted 5 lines

Possibly? This change would have the potential to make things far more complicated,
as docker is just one example. I can't find a distribution (including OE) that does not always
compile firewalld with iptables.

OK, so this comment of mine is moot: I read in diagonal, and too fast. Ignore it and keep your code+comment as-is, sorry...

Yet, there is still a little nit, below...

Quoted 16 lines
Quoted 16 lines

seelct BR2_PACKAGE_IPTABLES if BR2_PACKAGE_FIREWALLD

Quoted 4 lines
package/firewalld/firewalld.mk new file +4 -0
+# /etc/sysconfig/firewalld is a Red Hat-ism, only referenced by
+# the Red Hat-specific init script which isn't used, so we set
+# --disable-sysconfig.
+FIREWALLD_CONF_OPTS += \

package/firewalld/firewalld.mk line 62

Quoted 10 lines
package/firewalld/firewalld.mk new file +10 -0
+     --disable-rpmmacros \
+     --disable-sysconfig \
+     --with-ip6tables-restore=/usr/sbin/ip6tables-restore \
+     --with-ip6tables=/usr/sbin/ip6tables \
+     --with-iptables-restore=/usr/sbin/iptables-restore \
+     --with-iptables=/usr/sbin/iptables \
+     --with-nft=/usr/sbin/nft \
+     --without-ebtables \
+     --without-ebtables-restore \
+     --without-ipset \

Why are you selecting BR2_PACKAGE_EBTABLES and BR2_PACKAGE_IPSET in Config.in if you explicitly disable support for them here?

Regards,
Yann E. MORIN.

Quoted 45 lines
Quoted 45 lines

package/firewalld/firewalld.mk line 67

Quoted 5 lines
package/firewalld/firewalld.mk new file +5 -0
+     --without-xml-catalog
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+FIREWALLD_DEPENDENCIES += systemd
+FIREWALLD_CONF_OPTS += --with-systemd-unitdir=/usr/lib/systemd/system

We also want an explicit --enable-systemd

This was just a quick review, I may come back to it later in the WE...

Regards,
Yann E. MORIN.

Quoted 20 lines
package/firewalld/firewalld.mk new file +17 -1
+else
+FIREWALLD_CONF_OPTS += --disable-systemd
+endif
+
+define FIREWALLD_INSTALL_INIT_SYSTEMD
+     $(INSTALL) -D -m 0644 $(@D)/config/firewalld.service \
+             $(TARGET_DIR)/usr/lib/systemd/system/firewalld.service
+endef
+
+# The bundled sysvinit file requires /etc/init.d/functions which is not
+# provided by buildroot. As such, we provide our own firewalld init file.
+define FIREWALLD_INSTALL_INIT_SYSV
+     $(INSTALL) -D -m 0755 $(FIREWALLD_PKGDIR)/S41firewalld \
+             $(TARGET_DIR)/etc/init.d/S41firewalld
+endef
+
+$(eval $(autotools-package))
--

2.25.3

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

--
.-----------------.--------------------.------------------.--------------------.

|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |

'------------------------------^-------^------------------^--------------------'

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
#5 lore raw

PATCH v3 1/2 package/python-slip-dbus: new package

In reply to aduskett at gmail.com

Adam, All,

On 2020-04-23 10:33 -0700, aduskett at gmail.com spake thusly:

Quoted 58 lines

From: Adam Duskett <[email protected]>

This package provides a dbus.service.Object derivative that ends itself after a certain time without being used and/or if there are no clients anymore on the message bus.

The package also provides a set of convenience functions and decorators for integrating a dbus service with PolicyKit.

Firewalld depends on this package.

---
Changes v1 -> v2:
- Combine dependency comment (Yann)
- Add a more detailed commit message. (Yann)
- Add an explination for the PYTHON_SLIP_DBUS_APPEND_VERSION hook. (Yann)

 DEVELOPERS                                    |  1 +
 package/Config.in                             |  1 +
 package/python-slip-dbus/Config.in            | 27 +++++++++++++++++++
 .../python-slip-dbus/python-slip-dbus.hash    |  3 +++
 package/python-slip-dbus/python-slip-dbus.mk  | 23 ++++++++++++++++
 5 files changed, 55 insertions(+)
 create mode 100644 package/python-slip-dbus/Config.in
 create mode 100644 package/python-slip-dbus/python-slip-dbus.hash
 create mode 100644 package/python-slip-dbus/python-slip-dbus.mk
DEVELOPERS +1 -0
index 56178ba100..e0ab2f61bf 100644
@@ -74,6 +74,7 @@ F:	package/python-nested-dict/
 F:	package/python-pbr/
 F:	package/python-pip/
 F:	package/python-psycopg2/
+F:	package/python-slip-dbus/
 F:	package/python-smmap2/
 F:	package/python-sqlalchemy/
 F:	package/python-sqlparse/
package/Config.in +1 -0
index a9c6f6fcbc..918052bc38 100644
@@ -1149,6 +1149,7 @@ menu "External python modules"
 	source "package/python-singledispatch/Config.in"
 	source "package/python-sip/Config.in"
 	source "package/python-six/Config.in"
+	source "package/python-slip-dbus/Config.in"
 	source "package/python-slob/Config.in"
 	source "package/python-smbus-cffi/Config.in"
 	source "package/python-smmap2/Config.in"
package/python-slip-dbus/Config.in new file +0 -0
new file mode 100644
index 0000000000..3e1c8adc03

package/python-slip-dbus/Config.in line 6

Quoted 6 lines
package/python-slip-dbus/Config.in new file +6 -0
@@ -0,0 +1,27 @@
+config BR2_PACKAGE_PYTHON_SLIP_DBUS
+	bool "python-slip-dbus"
+	depends on BR2_USE_MMU # libglib2, gobject-introspection
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS # gobject-introspection
+	depends on BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 # gobject-introspection
+	depends on BR2_TOOLCHAIN_HAS_THREADS

Is it a real dependency of py-slip-dbus, or is it inherited from dbus?

package/python-slip-dbus/Config.in line 8

Quoted 2 lines
package/python-slip-dbus/Config.in new file +2 -0
+	depends on BR2_TOOLCHAIN_USES_GLIBC # gobject-introspection
+	depends on BR2_PACKAGE_PYTHON3 # gobject-introspection

gobject-introspection, really? You're not selecting it below, but you are selecting python-gobject. So you should reference the inheritance being on python-gobject, not goi:

depends on BR2_PACKAGE_PYTHON3 # python-gobject

package/python-slip-dbus/Config.in line 10

Quoted 2 lines
package/python-slip-dbus/Config.in new file +2 -0
+	select BR2_PACKAGE_DBUS # runtime
+	select BR2_PACKAGE_DBUS_PYTHON # runtime

You must inherit the wchar dependency from dbus-python.

Quoted 32 lines
package/python-slip-dbus/Config.in new file +17 -0
+	select BR2_PACKAGE_PYTHON_DECORATOR  # runtime
+	select BR2_PACKAGE_PYTHON_GOBJECT  # runtime
+	select BR2_PACKAGE_PYTHON_SIX # runtime
+	help
+	  A dbus.service.Object derivative that ends
+	  itself after a certain time without being used and/or if there
+	  are no clients anymore on the message bus, as well as
+	  convenience functions and decorators for integrating a dbus
+	  service with PolicyKit.
+
+	  https://github.com/nphilipp/python-slip
+
+comment "python-slip-dbus needs python3, and a glibc toolchain w/ gcc >= 4.9, threads"
+	depends on BR2_USE_MMU
+	depends on BR2_PACKAGE_HOST_QEMU_ARCH_SUPPORTS
+	depends on !BR2_TOOLCHAIN_GCC_AT_LEAST_4_9 || !BR2_TOOLCHAIN_USES_GLIBC \
+		|| !BR2_TOOLCHAIN_HAS_THREADS || !BR2_PACKAGE_PYTHON3
package/python-slip-dbus/python-slip-dbus.hash new file +3 -0
new file mode 100644
index 0000000000..8a88533169
@@ -0,0 +1,3 @@
+# Locally computed
+sha256  7a52ebe49945cd27d06a1172042a55eb5c79cfda49b742153fa076d1d9bd99a1  python-slip-0.6.5.tar.gz
+sha256  1ca3e8f71b7de618968e7ea9fe47822d9e704dc476aef8544033abedec355225  COPYING
package/python-slip-dbus/python-slip-dbus.mk new file +0 -0
new file mode 100644
index 0000000000..5c2f416f5d

package/python-slip-dbus/python-slip-dbus.mk line 9

Quoted 9 lines
package/python-slip-dbus/python-slip-dbus.mk new file +9 -0
@@ -0,0 +1,23 @@
+################################################################################
+#
+# python-slip-dbus
+#
+################################################################################
+
+PYTHON_SLIP_DBUS_VERSION = 0.6.5
+PYTHON_SLIP_DBUS_SOURCE = python-slip-$(PYTHON_SLIP_DBUS_VERSION).tar.gz
+PYTHON_SLIP_DBUS_SITE = https://github.com/nphilipp/python-slip/archive

This line is the expeansion of the github helper.

However, you should not use that, but the relased tarball, which is only available as a .tar.bz2:

    PYTHON_SLIP_DBUS_SOURCE = python-slip-$(PYTHON_SLIP_DBUS_VERSION).tar.bz2
    PYTHON_SLIP_DBUS_SITE = https://github.com/nphilipp/python-slip/releases/download/python-slip-$(PYTHON_SLIP_DBUS_VERSION)

package/python-slip-dbus/python-slip-dbus.mk line 19

Quoted 10 lines
package/python-slip-dbus/python-slip-dbus.mk new file +10 -0
+PYTHON_SLIP_DBUS_LICENSE = GPL-2.0+
+PYTHON_SLIP_DBUS_LICENSE_FILES = COPYING
+PYTHON_SLIP_DBUS_SETUP_TYPE = distutils
+PYTHON_SLIP_DBUS_DEPENDENCIES = python-gobject
+
+# Python-slip-dbus only packages a setup.py.in file with a @VERSION@ variable,
+# so we must create the file ourselves and sed the appropriate version number.
+define PYTHON_SLIP_DBUS_APPEND_VERSION
+	cd $(@D) && \
+		sed -e 's/@VERSION@/$(PYTHON_SLIP_DBUS_VERSION)/g' setup.py.in > setup.py

Useless use of cd:

    sed -e 's/@VERSION@/$(PYTHON_SLIP_DBUS_VERSION)/g' \
        $(@D)/setup.py.in >$(@D)/setup.py

Regards,
Yann E. MORIN.

Quoted 11 lines
package/python-slip-dbus/python-slip-dbus.mk new file +4 -0
+endef
+PYTHON_SLIP_DBUS_PRE_CONFIGURE_HOOKS += PYTHON_SLIP_DBUS_APPEND_VERSION
+
+$(eval $(python-package))
Signature · 6 lines
2.25.3

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'