Skip to contentSkip to conversation

package/multipath-tools: new package

PATCH Superseded Alexander Egorenkov 2 participants 3 messages Aug 29, 2020 – Aug 31, 2020

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/multipath-tools: new package

---
 package/Config.in                             |  1 +
 .../0001-Cross-compilation-fixes.patch        | 45 +++++++++++++++++
 .../0002-Fix-parallel-make.patch              | 49 +++++++++++++++++++
 .../multipath-tools/0003-systemd-fix.patch    | 28 +++++++++++
 .../0004-udev-rules-path.patch                | 13 +++++
 ...005-libdmmp_private.h-add-TRUE-FALSE.patch | 17 +++++++
 package/multipath-tools/Config.in             | 12 +++++
 package/multipath-tools/S60multipathd         | 39 +++++++++++++++
 package/multipath-tools/multipath-tools.hash  |  3 ++
 package/multipath-tools/multipath-tools.mk    | 34 +++++++++++++
 10 files changed, 241 insertions(+)
 create mode 100644 package/multipath-tools/0001-Cross-compilation-fixes.patch
 create mode 100644 package/multipath-tools/0002-Fix-parallel-make.patch
 create mode 100644 package/multipath-tools/0003-systemd-fix.patch
 create mode 100644 package/multipath-tools/0004-udev-rules-path.patch
 create mode 100644 package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch
 create mode 100644 package/multipath-tools/Config.in
 create mode 100644 package/multipath-tools/S60multipathd
 create mode 100644 package/multipath-tools/multipath-tools.hash
 create mode 100644 package/multipath-tools/multipath-tools.mk
package/Config.in +1 -0
index d7e79f4795..9044829696 100644
@@ -2378,6 +2378,7 @@ menu "System tools"
 	source "package/mender-grubenv/Config.in"
 	source "package/mfoc/Config.in"
 	source "package/monit/Config.in"
+	source "package/multipath-tools/Config.in"
 	source "package/ncdu/Config.in"
 	source "package/netifrc/Config.in"
 	source "package/numactl/Config.in"
package/multipath-tools/0001-Cross-compilation-fixes.patch new file +45 -0

45 lines not on this page · raw message

package/multipath-tools/0002-Fix-parallel-make.patch new file +49 -0

49 lines not on this page · raw message

package/multipath-tools/0003-systemd-fix.patch new file +28 -0
new file mode 100644
index 0000000000..15e708b2ca
@@ -0,0 +1,28 @@
+Index: multipath-tools-0.8.4/Makefile.inc
+===================================================================
+--- multipath-tools-0.8.4.orig/Makefile.inc
++++ multipath-tools-0.8.4/Makefile.inc
+@@ -36,13 +36,8 @@ ifndef RUN
+ endif
+ 
+ ifndef SYSTEMD
+-	ifeq ($(shell pkg-config --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
+-		SYSTEMD = $(shell pkg-config --modversion libsystemd)
+-	else
+-		ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
+-			SYSTEMD = $(shell systemctl --version 2> /dev/null | \
+-				sed -n 's/systemd \([0-9]*\).*/\1/p')
+-		endif
++	ifeq ($(shell $(PKG_CONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
++		SYSTEMD = $(shell $(PKG_CONFIG) --modversion libsystemd)
+ 	endif
+ endif
+ 
+@@ -76,6 +71,7 @@ GZIP		= gzip -9 -c
+ RM		= rm -f
+ LN		= ln -sf
+ INSTALL_PROGRAM	= install
++PKG_CONFIG     ?= pkg-config
+ 
+ # $(call TEST_CC_OPTION,option,fallback)
+ # Test if the C compiler supports the option.
package/multipath-tools/0004-udev-rules-path.patch new file +13 -0
new file mode 100644
index 0000000000..a53be4004c
@@ -0,0 +1,13 @@
+Index: multipath-tools-0.8.4/Makefile.inc
+===================================================================
+--- multipath-tools-0.8.4.orig/Makefile.inc
++++ multipath-tools-0.8.4/Makefile.inc
+@@ -49,7 +49,7 @@ prefix		=
+ exec_prefix	= $(prefix)
+ usr_prefix	= $(prefix)
+ bindir		= $(exec_prefix)/sbin
+-libudevdir	= $(prefix)/$(SYSTEMDPATH)/udev
++libudevdir	= $(prefix)/lib/udev
+ udevrulesdir	= $(libudevdir)/rules.d
+ multipathdir	= $(TOPDIR)/libmultipath
+ man8dir		= $(prefix)/usr/share/man/man8
package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch new file +17 -0
new file mode 100644
index 0000000000..4d6f71cb86
@@ -0,0 +1,17 @@
+--- a/libdmmp/libdmmp_private.h	2020-06-29 08:29:04.308560526 +0200
++++ b/libdmmp/libdmmp_private.h	2020-06-29 08:29:12.196605583 +0200
+@@ -34,6 +34,14 @@
+ 
+ #include "libdmmp/libdmmp.h"
+ 
++#ifndef FALSE
++#define FALSE   (0)
++#endif
++
++#ifndef TRUE
++#define TRUE    (!FALSE)
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif
package/multipath-tools/Config.in new file +12 -0
new file mode 100644
index 0000000000..54f670089c
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_MULTIPATH_TOOLS
+	bool "multipath-tools"
+	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HAS_UDEV
+	select BR2_PACKAGE_LIBURCU
+	select BR2_PACKAGE_JSON_C
+	select BR2_PACKAGE_LIBAIO
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_LVM2
+	select BR2_PACKAGE_LVM2_STANDARD_INSTALL
+	help
+	  Makes a small dumpfile of kdump.
package/multipath-tools/S60multipathd new file +39 -0
new file mode 100644
index 0000000000..1c687901c7
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# Starts multipathd.
+#
+
+start() {
+    printf "Starting multipathd: "
+    umask 077
+
+    start-stop-daemon -S -q -p /var/run/multipathd.pid \
+		      --exec /sbin/multipathd
+    [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+stop() {
+    printf "Stopping multipathd: "
+    start-stop-daemon -K -q -p /var/run/multipathd.pid
+    [ $? = 0 ] && echo "OK" || echo "FAIL"
+}
+restart() {
+    stop
+    start
+}
+
+case "$1" in
+    start)
+	start
+	;;
+    stop)
+	stop
+	;;
+    restart|reload)
+	restart
+	;;
+    *)
+	echo "Usage: $0 {start|stop|restart}"
+	exit 1
+esac
+
+exit $?
package/multipath-tools/multipath-tools.hash new file +3 -0
new file mode 100644
index 0000000000..7eaf246094
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256  ccd73bf67621161d9e42d1a770c3a7efff6e252433e8b8ed5f64a88cb5e7151d  multipath-tools-0.8.4.tar.gz
+sha256  b7993225104d90ddd8024fd838faf300bea5e83d91203eab98e29512acebd69c  COPYING
package/multipath-tools/multipath-tools.mk new file +34 -0
new file mode 100644
index 0000000000..2572172895
@@ -0,0 +1,34 @@
+################################################################################
+#
+# multipath-tools
+#
+################################################################################
+
+MULTIPATH_TOOLS_VERSION = 0.8.4
+MULTIPATH_TOOLS_SITE = $(call github,openSUSE,multipath-tools,$(MULTIPATH_TOOLS_VERSION))
+MULTIPATH_TOOLS_LICENSE = LGPL-2.0
+MULTIPATH_TOOLS_LICENSE_FILES = COPYING
+MULTIPATH_TOOLS_DEPENDENCIES = lvm2 json-c readline udev
+
+MULTIPATH_TOOLS_MAKE_FLAGS =
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+MULTIPATH_TOOLS_DEPENDENCIES += systemd
+endif
+
+define MULTIPATH_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC)" PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+		OPTFLAGS="$(TARGET_CFLAGS)"
+endef
+
+define MULTIPATH_TOOLS_INSTALL_TARGET_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) $(TARGET_CONFIGURE_OPTS) install \
+		DESTDIR="$(TARGET_DIR)" $(MULTIPATH_TOOLS_MAKE_FLAGS)
+endef
+
+define MULTIPATH_TOOLS_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 package/multipath-tools/S60multipathd \
+		$(TARGET_DIR)/etc/init.d/S60multipathd
+endef
+
+$(eval $(generic-package))
Signature · 1 line
2.28.0
#1 lore raw

PATCH 1/1 package/multipath-tools: new package

Hello Alexander,

Again, thanks for your contribution! See below for a number of comments.

Quoted 13 lines · On Sat, 29 Aug 2020 10:26:32 +0200 Alexander Egorenkov…
---
 package/Config.in                             |  1 +
 .../0001-Cross-compilation-fixes.patch        | 45 +++++++++++++++++
 .../0002-Fix-parallel-make.patch              | 49 +++++++++++++++++++
 .../multipath-tools/0003-systemd-fix.patch    | 28 +++++++++++
 .../0004-udev-rules-path.patch                | 13 +++++
 ...005-libdmmp_private.h-add-TRUE-FALSE.patch | 17 +++++++
 package/multipath-tools/Config.in             | 12 +++++
 package/multipath-tools/S60multipathd         | 39 +++++++++++++++
 package/multipath-tools/multipath-tools.hash  |  3 ++
 package/multipath-tools/multipath-tools.mk    | 34 +++++++++++++
 10 files changed, 241 insertions(+)

As usual, we need an entry in the DEVELOPERS file.

Quoted 5 lines
 create mode 100644 package/multipath-tools/0001-Cross-compilation-fixes.patch
 create mode 100644 package/multipath-tools/0002-Fix-parallel-make.patch
 create mode 100644 package/multipath-tools/0003-systemd-fix.patch
 create mode 100644 package/multipath-tools/0004-udev-rules-path.patch
 create mode 100644 package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch

All those patches should have a description, Signed-off-by line, and be generated with git format-patch.

Quoted 23 lines
package/multipath-tools/0001-Cross-compilation-fixes.patch new file +17 -0
new file mode 100644
index 0000000000..8914b3bae7
@@ -0,0 +1,45 @@
+Index: multipath-tools-0.8.4/libmultipath/Makefile
+===================================================================
+--- multipath-tools-0.8.4.orig/libmultipath/Makefile
++++ multipath-tools-0.8.4/libmultipath/Makefile
+@@ -20,21 +20,10 @@ ifdef SYSTEMD
+ 	endif
+ endif
+ 
+-ifneq ($(call check_func,dm_task_no_flush,/usr/include/libdevmapper.h),0)
+-	CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
+-endif
+-
+-ifneq ($(call check_func,dm_task_set_cookie,/usr/include/libdevmapper.h),0)
+-	CFLAGS += -DLIBDM_API_COOKIE
+-endif
+-
+-ifneq ($(call check_func,udev_monitor_set_receive_buffer_size,/usr/include/libudev.h),0)

package/multipath-tools/0001-Cross-compilation-fixes.patch line 27

Quoted 10 lines
package/multipath-tools/0001-Cross-compilation-fixes.patch new file +10 -0
+-	CFLAGS += -DLIBUDEV_API_RECVBUF
+-endif
+-
+-ifneq ($(call check_func,dm_task_deferred_remove,/usr/include/libdevmapper.h),0)
+-	CFLAGS += -DLIBDM_API_DEFERRED
+-endif
++CFLAGS += -DLIBDM_API_FLUSH -D_GNU_SOURCE
++CFLAGS += -DLIBDM_API_COOKIE
++CFLAGS += -DLIBUDEV_API_RECVBUF
++CFLAGS += -DLIBDM_API_DEFERRED

Hum, this is not the best solution. Can we find something that works also for cross-compilation ?

package/multipath-tools/0002-Fix-parallel-make.patch

Quoted 5 lines
package/multipath-tools/0002-Fix-parallel-make.patch new file +0 -0
new file mode 100644
index 0000000000..8d493659bd

This one can be submitted upstream. Did you do it already?

Quoted 14 lines
package/multipath-tools/0003-systemd-fix.patch new file +8 -0
new file mode 100644
index 0000000000..15e708b2ca
@@ -0,0 +1,28 @@
+Index: multipath-tools-0.8.4/Makefile.inc
+===================================================================
+--- multipath-tools-0.8.4.orig/Makefile.inc
++++ multipath-tools-0.8.4/Makefile.inc
+@@ -36,13 +36,8 @@ ifndef RUN
+ endif
+ 
+ ifndef SYSTEMD

package/multipath-tools/0003-systemd-fix.patch line 18

Quoted 10 lines
package/multipath-tools/0003-systemd-fix.patch new file +10 -0
+-	ifeq ($(shell pkg-config --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
+-		SYSTEMD = $(shell pkg-config --modversion libsystemd)
+-	else
+-		ifeq ($(shell systemctl --version >/dev/null 2>&1 && echo 1), 1)
+-			SYSTEMD = $(shell systemctl --version 2> /dev/null | \
+-				sed -n 's/systemd \([0-9]*\).*/\1/p')
+-		endif
++	ifeq ($(shell $(PKG_CONFIG) --modversion libsystemd >/dev/null 2>&1 && echo 1), 1)
++		SYSTEMD = $(shell $(PKG_CONFIG) --modversion libsystemd)
+ 	endif

I like that you're using $(PKG_CONFIG), but it's a bit annoying that you're dropping the systemctl usage because it makes the patch probably unsuitable for upstream. Should there be a way to avoid the systemctl usage if we're cross-compiling ?

Quoted 6 lines
package/multipath-tools/0004-udev-rules-path.patch new file +0 -0
new file mode 100644
index 0000000000..a53be4004c

package/multipath-tools/0004-udev-rules-path.patch line 10

Quoted 10 lines
package/multipath-tools/0004-udev-rules-path.patch new file +10 -0
@@ -0,0 +1,13 @@
+Index: multipath-tools-0.8.4/Makefile.inc
+===================================================================
+--- multipath-tools-0.8.4.orig/Makefile.inc
++++ multipath-tools-0.8.4/Makefile.inc
+@@ -49,7 +49,7 @@ prefix		=
+ exec_prefix	= $(prefix)
+ usr_prefix	= $(prefix)
+ bindir		= $(exec_prefix)/sbin
+-libudevdir	= $(prefix)/$(SYSTEMDPATH)/udev
++libudevdir	= $(prefix)/lib/udev

Not sure why this change is needed. Perhaps to support non-systemd situations ?

Quoted 13 lines
package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch new file +7 -0
new file mode 100644
index 0000000000..4d6f71cb86
@@ -0,0 +1,17 @@
+--- a/libdmmp/libdmmp_private.h	2020-06-29 08:29:04.308560526 +0200
++++ b/libdmmp/libdmmp_private.h	2020-06-29 08:29:12.196605583 +0200
+@@ -34,6 +34,14 @@
+ 
+ #include "libdmmp/libdmmp.h"
+ 
++#ifndef FALSE

package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch line 17

Quoted 10 lines
package/multipath-tools/0005-libdmmp_private.h-add-TRUE-FALSE.patch new file +10 -0
++#define FALSE   (0)
++#endif
++
++#ifndef TRUE
++#define TRUE    (!FALSE)
++#endif
++
+ #ifdef __cplusplus
+ extern "C" {
+ #endif

This should be submitted upstream too.

package/multipath-tools/Config.in line 5

Quoted 11 lines
package/multipath-tools/Config.in new file +5 -0
new file mode 100644
index 0000000000..54f670089c
@@ -0,0 +1,12 @@
+config BR2_PACKAGE_MULTIPATH_TOOLS
+	bool "multipath-tools"
+	depends on BR2_PACKAGE_LIBURCU_ARCH_SUPPORTS
+	depends on BR2_PACKAGE_HAS_UDEV
+	select BR2_PACKAGE_LIBURCU

So you need to replicate:

depends on BR2_TOOLCHAIN_HAS_THREADS

package/multipath-tools/Config.in line 6

Quoted 1 line
package/multipath-tools/Config.in new file +1 -0
+	select BR2_PACKAGE_JSON_C

So you need to replicate:

depends on BR2_TOOLCHAIN_HAS_SYNC_4

package/multipath-tools/Config.in line 7

Quoted 1 line
package/multipath-tools/Config.in new file +1 -0
+	select BR2_PACKAGE_LIBAIO

Is libaio directly used by multipath-tools, or just as a dependency of lvm2 ?

package/multipath-tools/Config.in line 9

Quoted 2 lines
package/multipath-tools/Config.in new file +2 -0
+	select BR2_PACKAGE_READLINE
+	select BR2_PACKAGE_LVM2

You also need to replicate:

depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # needs fork()
depends on !BR2_STATIC_LIBS # It fails to build statically

package/multipath-tools/Config.in line 10

Quoted 1 line
package/multipath-tools/Config.in new file +1 -0
+	select BR2_PACKAGE_LVM2_STANDARD_INSTALL

And:

depends on !BR2_TOOLCHAIN_USES_MUSL

package/multipath-tools/Config.in line 12

Quoted 2 lines
package/multipath-tools/Config.in new file +2 -0
+	help
+	  Makes a small dumpfile of kdump.

This description is wrong.

The upstream URL of the project at the end of the Config.in help text is missing.

Hint: run "make check-package".

You're also missing a Config.in comment about the dependencies.

package/multipath-tools/S60multipathd

Quoted 5 lines
package/multipath-tools/S60multipathd new file +0 -0
new file mode 100644
index 0000000000..1c687901c7

Could you take package/busybox/S01syslogd as a template for the init script ?

Quoted 16 lines
package/multipath-tools/multipath-tools.hash new file +3 -0
new file mode 100644
index 0000000000..7eaf246094
@@ -0,0 +1,3 @@
+# Locally computed:
+sha256  ccd73bf67621161d9e42d1a770c3a7efff6e252433e8b8ed5f64a88cb5e7151d  multipath-tools-0.8.4.tar.gz
+sha256  b7993225104d90ddd8024fd838faf300bea5e83d91203eab98e29512acebd69c  COPYING
package/multipath-tools/multipath-tools.mk new file +1 -0
new file mode 100644
index 0000000000..2572172895
@@ -0,0 +1,34 @@
+################################################################################

package/multipath-tools/multipath-tools.mk line 11

Quoted 10 lines
package/multipath-tools/multipath-tools.mk new file +10 -0
+#
+# multipath-tools
+#
+################################################################################
+
+MULTIPATH_TOOLS_VERSION = 0.8.4
+MULTIPATH_TOOLS_SITE = $(call github,openSUSE,multipath-tools,$(MULTIPATH_TOOLS_VERSION))
+MULTIPATH_TOOLS_LICENSE = LGPL-2.0
+MULTIPATH_TOOLS_LICENSE_FILES = COPYING
+MULTIPATH_TOOLS_DEPENDENCIES = lvm2 json-c readline udev

In the Config.in file, you are selecting liburcu, libaio, but you don't have them as build dependencies here. Could you check that ?

Also, since you're using pkg-config, you probably want host-pkgconf in the dependencies.

package/multipath-tools/multipath-tools.mk line 13

Quoted 1 line
package/multipath-tools/multipath-tools.mk new file +1 -0
+MULTIPATH_TOOLS_MAKE_FLAGS =

An empty variable is quite useless.

package/multipath-tools/multipath-tools.mk line 21

Quoted 8 lines
package/multipath-tools/multipath-tools.mk new file +8 -0
+
+ifeq ($(BR2_PACKAGE_SYSTEMD),y)
+MULTIPATH_TOOLS_DEPENDENCIES += systemd
+endif
+
+define MULTIPATH_TOOLS_BUILD_CMDS
+	$(TARGET_MAKE_ENV) $(MAKE) -C $(@D) CC="$(TARGET_CC)" PKG_CONFIG="$(PKG_CONFIG_HOST_BINARY)" \
+		OPTFLAGS="$(TARGET_CFLAGS)"

Could you try to use $(TARGET_CONFIGURE_OPTS) to pass CC, PKG_CONFIG, etc. ?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#2 lore raw

PATCH 1/1 package/multipath-tools: new package

Quoted 2 lines

As usual, we need an entry in the DEVELOPERS file.

Fixed.

Quoted 4 lines

All those patches should have a description, Signed-off-by line, and be generated with git format-patch.

Fixed.

Quoted 4 lines

Hum, this is not the best solution. Can we find something that works also for cross-compilation ?

Fixed.

Quoted 3 lines

This one can be submitted upstream. Did you do it already?

Found a patch which has been submitted upstream but not yet released.

Quoted 5 lines

I like that you're using $(PKG_CONFIG), but it's a bit annoying that you're dropping the systemctl usage because it makes the patch probably unsuitable for upstream. Should there be a way to avoid the systemctl usage if we're cross-compiling ?

Fixed.

Quoted 4 lines

Not sure why this change is needed. Perhaps to support non-systemd situations ?

Fixed.

Quoted 3 lines

This should be submitted upstream too.

Found a patch which has been submitted upstream but not yet released.

Quoted 4 lines

So you need to replicate:

depends on BR2_TOOLCHAIN_HAS_THREADS

Fixed.

Quoted 5 lines

So you need to replicate:

depends on BR2_TOOLCHAIN_HAS_SYNC_4

Fixed.

Quoted 4 lines

Is libaio directly used by multipath-tools, or just as a dependency of lvm2 ?

Directly.

Quoted 7 lines

You also need to replicate:

depends on BR2_TOOLCHAIN_HAS_THREADS
depends on BR2_USE_MMU # needs fork()
depends on !BR2_STATIC_LIBS # It fails to build statically

Fixed.

Quoted 5 lines

And:

depends on !BR2_TOOLCHAIN_USES_MUSL

Fixed.

Quoted 10 lines

This description is wrong.

The upstream URL of the project at the end of the Config.in help text is missing.

Hint: run "make check-package".

You're also missing a Config.in comment about the dependencies.

Fixed.

Quoted 4 lines

Could you take package/busybox/S01syslogd as a template for the init script ?

Done.

Quoted 7 lines

In the Config.in file, you are selecting liburcu, libaio, but you don't have them as build dependencies here. Could you check that ?

Also, since you're using pkg-config, you probably want host-pkgconf in the dependencies.

Fixed.

Quoted 3 lines

An empty variable is quite useless.

Fixed.

Quoted 4 lines

Could you try to use $(TARGET_CONFIGURE_OPTS) to pass CC, PKG_CONFIG, etc. ?

Fixed.

Thanks for take the time to review it.
Regards
Alex