Skip to contentSkip to conversation

yp-tools, ypbind-mt: new packages

PATCH New Jonathan Ben-Avraham 2 participants 6 messages Jan 26, 2016 – Mar 6, 2016

lore
Share & tools
lore
#0 lore raw

v6 cover yp-tools, ypbind-mt: new packages

This patch series adds the yp-tools and yp-bind packages to Buildroot.

Changes v5 -> v6:
- Removed the patch to yp-tools configure.ac that squelches gcc -Wcast-align as it is no longer needed in yp-tools_3_5 following application of the patch to fix the problem by the upstream maintainer.
- Added host-gettext to yp-tools dependencies.
- Added ypbind-mt.hash.
- Retested build dependencies using absolute minimal configuration and

    gcc-linaro-4.9-2014.11-x86_64_arm-linux-gnueabihf toolchain

Changes v4 -> v5:
- Bumped yp-tools version from 3_4 to 3_5 and tested runtime functionality on arm Cortex-A9 hardware platform.
- Added the package/Config.in changes for each new package to the new package patches for each package rather than as a separate patch. The ypbind-mt patch now depends on the yp-tools patch because they both modify the same patch context lines in package/Config.in.
- Moved the patch of linux-pam.mk after the yp-tools patch and before the ypbind-mt patch.

Changes v3 -> v4:
- Added comment to my yp-tools configure.ac patch 0000-remove-Wcast-align-\
from-configure.ac.patch to indicate that my original patch that actually fixes the cast align problem was applied to the upstream.
- Changed the Config.in web site URL's for yp-tools and yp-bind from the github repo URL's to the http://www.linux-nis.org/nis URL's.
- Added comments in the *.mk files for yp-tools and ypbind-mt to explain the reason for choosing github over the web site Download links for the package sources.
- Replaced the S70ypbind rc script with an original work based on the upstream author's rc script for SuSe. The current version is designed for simplicity.
- Re-ordered the patches by 1) package/Config.in changes required by both of the new packages, 2) changes to other packages required by ypbind-mt, 3) the yp-tools package with all of its files and 4) the ypbind-mt package with all of its files.

Changes v2 -> v3:
- Not changed: I retained the mapv4v6addr.h in its entirety rather than patching nis-hosts.c as per TP's request. The reason for this is that the two files have different licensing, as explained in the comments in yp-tools.mk. I think that patching an BSD-style licensed file in in its entirety, with it's copyright and license, into a GPLv2 file is not correct policy, and extracting the map_v4v6_address from mapv4v6addr.h without the copyright and license notice is a clear violation of license.
- At TP's request, I added the 0000-remove-Wcast-align-from-configure\
.ac.patch to squelch the -Wcast-align warning that causes the ARM build to fail, instead of the original 0001-Change-do_ypcall_tr-\
param-resp-to-ypresp_val.patch that actually fixed the bug. My personal opinion is that it would have been better to leave the fix rather than to squelch the warning.
- Added "comment" to the Config.in regarding glibc dependency.
- Added a patch to linux-pam.mk to enable NIS support if yp-tools is selected.
- Performed menuconfig UI testing and build testing for absolute minimal configurations using the following toolchains:
- br-arm-basic-2015.11-rc1
- br-arm-full-2015.11-rc1
- br-arm-cortex-a9-musl-2015.11-rc1
- br-arm11-full-nothread-2015.11-rc1
- br-arm-full-static-2015.11-rc1
- ia32-2012.09-62-i686-pc-linux-gnu-i386-linux
- crosstool-ng GCC 5.1 arm-mxs-linux-gnueabihf

Jonathan Ben-Avraham (3):
yp-tools: new package
linux-pam: enable NIS support if yp-tools selected
ypbind-mt: new package

 package/Config.in                                  |  2 +
 package/linux-pam/linux-pam.mk                     |  9 ++-
 package/yp-tools/Config.in                         | 15 ++++
 package/yp-tools/mapv4v6addr.h                     | 69 ++++++++++++++++
 package/yp-tools/yp-tools.hash                     |  2 +
 package/yp-tools/yp-tools.mk                       | 30 +++++++
 .../ypbind-mt/0001-Remove_man_dir_from_build.patch | 16 ++++
 package/ypbind-mt/Config.in                        | 17 ++++
 package/ypbind-mt/S70ypbind                        | 93 ++++++++++++++++++++++
 package/ypbind-mt/ypbind-mt.hash                   |  2 +
 package/ypbind-mt/ypbind-mt.mk                     | 24 ++++++
 11 files changed, 278 insertions(+), 1 deletion(-)
 create mode 100644 package/yp-tools/Config.in
 create mode 100644 package/yp-tools/mapv4v6addr.h
 create mode 100644 package/yp-tools/yp-tools.hash
 create mode 100644 package/yp-tools/yp-tools.mk
 create mode 100644 package/ypbind-mt/0001-Remove_man_dir_from_build.patch
 create mode 100644 package/ypbind-mt/Config.in
 create mode 100755 package/ypbind-mt/S70ypbind
 create mode 100644 package/ypbind-mt/ypbind-mt.hash
 create mode 100644 package/ypbind-mt/ypbind-mt.mk
Signature · 1 line
2.1.4
#1 lore raw

PATCH v6 1/3 yp-tools: new package

Adds the yp-tools package that provides various NIS (yp) utilities.

---
 package/Config.in              |  1 +
 package/yp-tools/Config.in     | 15 +++++++++
 package/yp-tools/mapv4v6addr.h | 69 ++++++++++++++++++++++++++++++++++++++++++
 package/yp-tools/yp-tools.hash |  2 ++
 package/yp-tools/yp-tools.mk   | 30 ++++++++++++++++++
 5 files changed, 117 insertions(+)
 create mode 100644 package/yp-tools/Config.in
 create mode 100644 package/yp-tools/mapv4v6addr.h
 create mode 100644 package/yp-tools/yp-tools.hash
 create mode 100644 package/yp-tools/yp-tools.mk
package/Config.in +1 -0
index 09c2b40..6d8caf7 100644
@@ -1482,6 +1482,7 @@ endif
 	source "package/xinetd/Config.in"
 	source "package/xl2tp/Config.in"
 	source "package/xtables-addons/Config.in"
+	source "package/yp-tools/Config.in"
 	source "package/znc/Config.in"
 
 endmenu
package/yp-tools/Config.in new file +15 -0
new file mode 100644
index 0000000..846bb1e
@@ -0,0 +1,15 @@
+config BR2_PACKAGE_YP_TOOLS
+	bool "yp-tools"
+	depends on BR2_TOOLCHAIN_USES_GLIBC # rpcsvc/nis.h
+	select BR2_PACKAGE_GETTEXT if BR2_NEEDS_GETTEXT
+	select BR2_PACKAGE_RPCBIND # runtime
+	help
+	  The yp-tools package contains the programs domainname,
+	  nisdomainname, ypcat, ypchfn, ypchsh, ypdomainname, ypmatch,
+	  yppoll, ypset, ypwhich and yppasswd. yp-tools 3.x is a port of
+	  yp-tools 2.x to support IPv6.
+
+	  http://www.linux-nis.org/nis/yp-tools/
+
+comment "yp-tools needs an (e)glibc toolchain with rpcsvc/nis.h"
+	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
package/yp-tools/mapv4v6addr.h new file +69 -0

69 lines not on this page · raw message

package/yp-tools/yp-tools.hash new file +2 -0
new file mode 100644
index 0000000..9e8b532
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 2dfa7ddfb797f2a5b4b7baaef7d6ee6fda41fe7066695fc7e3db998a32c1c698  yp-tools-yp-tools-3_5.tar.gz
package/yp-tools/yp-tools.mk new file +30 -0
new file mode 100644
index 0000000..c0e775c
@@ -0,0 +1,30 @@
+################################################################################
+#
+# yp-tools
+#
+################################################################################
+
+# The github release tags are one to two releases ahead of the "Download"
+# links on http://www.linux-nis.org/nis/yp-tools/
+YP_TOOLS_VERSION = yp-tools-3_5
+YP_TOOLS_SITE = $(call github,thkukuk,yp-tools,$(YP_TOOLS_VERSION))
+YP_TOOLS_LICENSE = GPLv2
+YP_TOOLS_LICENSE_FILES = COPYING
+YP_TOOLS_AUTORECONF = YES
+YP_TOOLS_DEPENDENCIES = host-pkgconf host-gettext
+YP_TOOLS_PRE_CONFIGURE_HOOKS += YP_TOOLS_LOCAL_MAPV4V6ADDR_H
+
+# If mapv4v6addr.h is not otherwise available we provide it here. It provides a
+# single function, map_v4v6_address is needed by a single yp-tools file,
+# nis-hosts.c. This mapv4v6addr.h code has BSD style licensing, whereas yp-tools
+# has GPLv2 licensing. In order not to confuse the licensing we maintain
+# mapv4v6addr.h as a separate file rather than patching the entire file with
+# it's copyright and license notice into nis-hosts.c, which is licensed under
+# GPLv2.
+
+define YP_TOOLS_LOCAL_MAPV4V6ADDR_H
+	$(INSTALL) -D -m 0644 $(YP_TOOLS_PKGDIR)/mapv4v6addr.h \
+		$(STAGING_DIR)/usr/include/resolv/mapv4v6addr.h
+endef
+
+$(eval $(autotools-package))
Signature · 1 line
2.1.4
#2 lore raw

PATCH v6 1/3 yp-tools: new package

Dear Jonathan Ben-Avraham,

Quoted 7 lines · Jonathan Ben-Avraham

Adds the yp-tools package that provides various NIS (yp) utilities.

---
 package/Config.in              |  1 +
 package/yp-tools/Config.in     | 15 +++++++++
 package/yp-tools/mapv4v6addr.h | 69 ++++++++++++++++++++++++++++++++++++++++++

This mapv4v6addr.h thing always annoyed me. But luckily, yp-tools 4.1 has been released, and removes the need for this file completely.

Unfortunately, yp-tools 4.1 doesn't build, I've filled an issue upstream:

https://github.com/thkukuk/yp-tools/issues/2

Could you follow-up with this and submit an updated patch when yp-tools 4.1 has been fixed ?

package/yp-tools/yp-tools.mk line 15

Quoted 9 lines
package/yp-tools/yp-tools.mk new file +9 -0
+# The github release tags are one to two releases ahead of the "Download"
+# links on http://www.linux-nis.org/nis/yp-tools/
+YP_TOOLS_VERSION = yp-tools-3_5
+YP_TOOLS_SITE = $(call github,thkukuk,yp-tools,$(YP_TOOLS_VERSION))
+YP_TOOLS_LICENSE = GPLv2
+YP_TOOLS_LICENSE_FILES = COPYING
+YP_TOOLS_AUTORECONF = YES
+YP_TOOLS_DEPENDENCIES = host-pkgconf host-gettext
+YP_TOOLS_PRE_CONFIGURE_HOOKS += YP_TOOLS_LOCAL_MAPV4V6ADDR_H

You should also add an optional dependency on libtirpc, since yp-tools can optionally use it. And in fact, since you select rpcbind, libtirpc will always be part of the build, but you don't have any guarantees on whether it will be built before or after yp-tools. So this optional dependency should be made explicit.

Thanks!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v6 2/3 linux-pam: enable NIS support if yp-tools selected

In reply to Jonathan Ben-Avraham

Enable the NIS support in linux-pam when the yp-tools package is selected.

---
 package/linux-pam/linux-pam.mk | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
package/linux-pam/linux-pam.mk +8 -1
index 26b627e..3d860d2 100644
@@ -11,7 +11,6 @@ LINUX_PAM_INSTALL_STAGING = YES
 LINUX_PAM_CONF_OPTS = \
 	--disable-prelude \
 	--disable-isadir \
-	--disable-nis \
 	--disable-db \
 	--disable-regenerate-docu \
 	--enable-securedir=/lib/security \
@@ -21,6 +20,14 @@ LINUX_PAM_AUTORECONF = YES
 LINUX_PAM_LICENSE = BSD-3c
 LINUX_PAM_LICENSE_FILES = Copyright
 
+ifeq ($(BR2_PACKAGE_YP_TOOLS),y)
+LINUX_PAM_CONF_OPTS += \
+	--enable-nis
+else
+LINUX_PAM_CONF_OPTS += \
+	--disable-nis
+endif
+
 ifeq ($(BR2_NEEDS_GETTEXT_IF_LOCALE),y)
 LINUX_PAM_DEPENDENCIES += gettext
 LINUX_PAM_MAKE_OPTS += LIBS=-lintl
Signature · 1 line
2.1.4
#4 lore raw

PATCH v6 3/3 ypbind-mt: new package

In reply to Jonathan Ben-Avraham

Adds the ypbind-mt package that contains a multi-threaded ypbind daemon for Linux. Depends on yp-tools package.

---
 package/Config.in                                  |  1 +
 .../ypbind-mt/0001-Remove_man_dir_from_build.patch | 16 ++++
 package/ypbind-mt/Config.in                        | 17 ++++
 package/ypbind-mt/S70ypbind                        | 93 ++++++++++++++++++++++
 package/ypbind-mt/ypbind-mt.hash                   |  2 +
 package/ypbind-mt/ypbind-mt.mk                     | 24 ++++++
 6 files changed, 153 insertions(+)
 create mode 100644 package/ypbind-mt/0001-Remove_man_dir_from_build.patch
 create mode 100644 package/ypbind-mt/Config.in
 create mode 100755 package/ypbind-mt/S70ypbind
 create mode 100644 package/ypbind-mt/ypbind-mt.hash
 create mode 100644 package/ypbind-mt/ypbind-mt.mk
package/Config.in +1 -0
index 6d8caf7..af9656b 100644
@@ -1483,6 +1483,7 @@ endif
 	source "package/xl2tp/Config.in"
 	source "package/xtables-addons/Config.in"
 	source "package/yp-tools/Config.in"
+	source "package/ypbind-mt/Config.in"
 	source "package/znc/Config.in"
 
 endmenu
package/ypbind-mt/0001-Remove_man_dir_from_build.patch new file +16 -0
new file mode 100644
index 0000000..10ebed7
@@ -0,0 +1,16 @@
+Remove the man directory from the build in order to avoid trying to build the
+commented targets ypbind.8 and ypconf.5
+
+Signed-off-by: Jonathan Ben Avraham <[email protected]>
+
+--- a/Makefile.am	2014-12-04 16:27:18.000000000 +0200
++++ b/Makefile.am	2015-12-16 15:00:21.950050679 +0200
+@@ -5,7 +5,7 @@
+ #
+ AUTOMAKE_OPTIONS = 1.6 gnits dist-bzip2
+ #
+-SUBDIRS = lib src man po
++SUBDIRS = lib src po
+ 
+ CLEANFILES = *~
+ 
package/ypbind-mt/Config.in new file +17 -0
new file mode 100644
index 0000000..2ac9d28
@@ -0,0 +1,17 @@
+config BR2_PACKAGE_YPBIND_MT
+	bool "ypbind-mt"
+	depends on BR2_TOOLCHAIN_USES_GLIBC # rpcsvc/nis.h
+	select BR2_PACKAGE_YP_TOOLS
+	select BR2_PACKAGE_RPCBIND # runtime
+	help
+	  The ypbind-mt package contains a multithreaded ypbind daemon
+	  for Linux. It uses threads for better response and supports
+	  the ypbind protocols version 1, 2 and 3.
+
+	  Note: You need to select package "linux-pam" for NIS
+	  authentication.
+
+	  http://www.linux-nis.org/nis/ypbind-mt/
+
+comment "ypbind-mt needs an (e)glibc toolchain with rpcsvc/nis.h"
+	depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_MUSL
package/ypbind-mt/S70ypbind new file +93 -0

93 lines not on this page · raw message

package/ypbind-mt/ypbind-mt.hash new file +2 -0
new file mode 100644
index 0000000..500eccc
@@ -0,0 +1,2 @@
+# Computed locally
+sha256 dedd2b94d01ae1a992abf1a569885c18f94ee57d9dfcc8d8cbb8d32f7f531478  ypbind-mt-ypbind-mt-2_2.tar.gz
package/ypbind-mt/ypbind-mt.mk new file +24 -0
new file mode 100644
index 0000000..08baf6e
@@ -0,0 +1,24 @@
+################################################################################
+#
+# ypbind-mt
+#
+################################################################################
+
+# The github releases of ypbind-mt are often a release or more ahead of the
+# "Download" links on http://www.linux-nis.org/nis/ypbind-mt/
+YPBIND_MT_VERSION = ypbind-mt-2_2
+YPBIND_MT_SITE = $(call github,thkukuk,ypbind-mt,$(YPBIND_MT_VERSION))
+YPBIND_MT_LICENSE = GPLv2
+YPBIND_MT_LICENSE_FILES = COPYING
+YPBIND_MT_AUTORECONF = YES
+YPBIND_MT_DEPENDENCIES = host-pkgconf yp-tools
+YPBIND_MT_CONF_ENV = \
+	PKG_CONFIG_SYSROOT_DIR="$(TARGET_DIR)" \
+	PKG_CONFIG_PATH="$(TARGET_DIR)/usr/lib/pkgconfig"
+
+define YPBIND_MT_INSTALL_INIT_SYSV
+	$(INSTALL) -D -m 755 $(YPBIND_MT_PKGDIR)/S70ypbind \
+		$(TARGET_DIR)/etc/init.d/S70ypbind
+endef
+
+$(eval $(autotools-package))
Signature · 1 line
2.1.4
#5 lore raw

PATCH v6 3/3 ypbind-mt: new package

Dear Jonathan Ben-Avraham,

Sorry for the slow answer :/

package/ypbind-mt/S70ypbind line 5

Quoted 11 lines · Jonathan Ben-Avraham
package/ypbind-mt/S70ypbind new file +5 -0
new file mode 100755
index 0000000..e73bec6
@@ -0,0 +1,93 @@
+#!/bin/sh
+# Based on /etc/init.d/ypbind from SuSe Linux by Thorsten Kukuk
+
+DAEMON=/usr/sbin/ypbind
+pidfile=/var/run/ypbind.pid

Capital letters for the variable.

package/ypbind-mt/S70ypbind line 7

Quoted 1 line
package/ypbind-mt/S70ypbind new file +1 -0
+[ -x ${DAEMON} ] || exit 0

Not needed, the daemon is guaranteed to be installed.

package/ypbind-mt/S70ypbind line 13

Quoted 5 lines
package/ypbind-mt/S70ypbind new file +5 -0
+[ -f /etc/default/ypbind ] && source /etc/default/ypbind
+
+case "$1" in
+	start)
+		echo -n "Starting ypbind: "

echo -n => printf

Quoted 18 lines
package/ypbind-mt/S70ypbind new file +18 -0
+		# Check for preset YP domainname
+		ypdomainname &> /dev/null
+		if [ $? -ne 0 ]; then
+			if [ ! -f /etc/defaultdomain ]; then
+				# No configured YP domainname
+				echo "FAIL"
+				exit 1
+			fi
+			# Assume that /etc/defaultdomain contains
+			# a valid domainname and assume ypdomainname
+			# succeeds
+			XDOMAINNAME=$(cat /etc/defaultdomain)
+			ypdomainname "${XDOMAINNAME}"
+		fi
+
+		if [ ! -f /etc/yp.conf -a "${YPBIND_BROADCAST}" != "yes" ]; then
+			# We need a local configuration if not in broadcast mode
+			echo "FAIL"

package/ypbind-mt/S70ypbind line 41

Quoted 10 lines
package/ypbind-mt/S70ypbind new file +10 -0
+			exit 1
+		fi
+
+		OPTIONS=""
+		test "${YPBIND_LOCAL_ONLY}" = "yes" && \
+			OPTIONS="-local-only ${OPTIONS}"
+		test "${YPBIND_BROADCAST}" = "yes" && \
+			OPTIONS="-broadcast ${OPTIONS}"
+		test "${YPBIND_BROKEN_SERVER}" = "yes" && \
+			OPTIONS="-broken-server ${OPTIONS}"

Why are we doing this complicated dance instead of just having YPBIND_OPTIONS defined in /etc/default/ypbind ?

package/ypbind-mt/S70ypbind line 49

Quoted 7 lines
package/ypbind-mt/S70ypbind new file +7 -0
+		start-stop-daemon --start --quiet --pidfile ${pidfile} \
+			--exec ${DAEMON} -- ${OPTIONS}
+
+		if [ $? -ne 0 ]; then
+			echo "FAIL"
+			exit 1
+		fi

You should print OK if start-stop-daemon succeeded. Look at other init scripts in Buildroot.

package/ypbind-mt/S70ypbind line 53

Quoted 4 lines
package/ypbind-mt/S70ypbind new file +4 -0
+
+		# Make sure we have a server so that later scripts can know
+		notfound=1
+		for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do

for i in $(seq 1 16)

Quoted 5 lines
package/ypbind-mt/S70ypbind new file +5 -0
+			if ypwhich &>/dev/null; then
+				notfound=0
+				break
+			fi
+			echo -n " ."

package/ypbind-mt/S70ypbind line 68

Quoted 10 lines
package/ypbind-mt/S70ypbind new file +10 -0
+			sleep 1;
+		done
+
+		if [ ${notfound} -eq 1 ]; then
+			# No NIS server found
+			echo "FAIL"
+			exit 1
+		fi
+
+		echo "OK"

Could you move all of this into a start() function ? It would nicely reduce the indentation level.

package/ypbind-mt/S70ypbind line 72

Quoted 4 lines
package/ypbind-mt/S70ypbind new file +4 -0
+		;;
+
+	stop)
+		echo "Shutting down ypbind "

printf

package/ypbind-mt/S70ypbind line 73

Quoted 1 line
package/ypbind-mt/S70ypbind new file +1 -0
+		start-stop-daemon --stop --quiet --pidfile $pidfile

And print OK / FAIL. Look at other init scripts in Buildroot to see which options we typically pass when calling start-stop-daemon to stop a daemon.

package/ypbind-mt/S70ypbind line 81

Quoted 4 lines
package/ypbind-mt/S70ypbind new file +4 -0
+	restart)
+		${0} stop
+		sleep 1
+		${0} start

Then you can use the stop() and start() functions.

Quoted 8 lines
package/ypbind-mt/S70ypbind new file +7 -0
@@ -0,0 +1,24 @@
+################################################################################
+#
+# ypbind-mt
+#
+################################################################################
+
+# The github releases of ypbind-mt are often a release or more ahead of the

package/ypbind-mt/S70ypbind line 17

Quoted 10 lines
package/ypbind-mt/S70ypbind new file +10 -0
+# "Download" links on http://www.linux-nis.org/nis/ypbind-mt/
+YPBIND_MT_VERSION = ypbind-mt-2_2
+YPBIND_MT_SITE = $(call github,thkukuk,ypbind-mt,$(YPBIND_MT_VERSION))
+YPBIND_MT_LICENSE = GPLv2
+YPBIND_MT_LICENSE_FILES = COPYING
+YPBIND_MT_AUTORECONF = YES
+YPBIND_MT_DEPENDENCIES = host-pkgconf yp-tools
+YPBIND_MT_CONF_ENV = \
+	PKG_CONFIG_SYSROOT_DIR="$(TARGET_DIR)" \
+	PKG_CONFIG_PATH="$(TARGET_DIR)/usr/lib/pkgconfig"

This is wrong. There is no reason to have .pc files in $(TARGET_DIR), and they are in fact removed at the end of the build. Can you explain why you override those variables ?

Could you rework the patch to take into account those comments and send an updated version?

Thanks a lot!

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com