diff mbox series

[1/1] package/php-pam: new package

Message ID 20211014121350.2266078-1-herve.codina@bootlin.com
State Accepted
Headers show
Series [1/1] package/php-pam: new package | expand

Commit Message

Herve Codina Oct. 14, 2021, 12:13 p.m. UTC
The php-pam package provides a PHP PAM (Pluggable Authentication
Modules) integration.

https://pecl.php.net/package/PAM

Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>

Signed-off-by: Herve Codina <herve.codina@bootlin.com>
---
 DEVELOPERS                                    |  4 +++
 package/Config.in                             |  1 +
 package/php-pam/Config.in                     | 15 +++++++++
 package/php-pam/php-pam.hash                  |  3 ++
 package/php-pam/php-pam.mk                    | 26 +++++++++++++++
 support/testing/tests/package/test_php_pam.py | 32 +++++++++++++++++++
 6 files changed, 81 insertions(+)
 create mode 100644 package/php-pam/Config.in
 create mode 100644 package/php-pam/php-pam.hash
 create mode 100644 package/php-pam/php-pam.mk
 create mode 100644 support/testing/tests/package/test_php_pam.py

Comments

Thomas Petazzoni Dec. 17, 2021, 9:49 p.m. UTC | #1
On Thu, 14 Oct 2021 14:13:50 +0200
Herve Codina <herve.codina@bootlin.com> wrote:

> The php-pam package provides a PHP PAM (Pluggable Authentication
> Modules) integration.
> 
> https://pecl.php.net/package/PAM
> 
> Based on initial work from Nicolas Carrier <nicolas.carrier@orolia.com>
> 
> Signed-off-by: Herve Codina <herve.codina@bootlin.com>
> ---
>  DEVELOPERS                                    |  4 +++
>  package/Config.in                             |  1 +
>  package/php-pam/Config.in                     | 15 +++++++++
>  package/php-pam/php-pam.hash                  |  3 ++
>  package/php-pam/php-pam.mk                    | 26 +++++++++++++++
>  support/testing/tests/package/test_php_pam.py | 32 +++++++++++++++++++
>  6 files changed, 81 insertions(+)
>  create mode 100644 package/php-pam/Config.in
>  create mode 100644 package/php-pam/php-pam.hash
>  create mode 100644 package/php-pam/php-pam.mk
>  create mode 100644 support/testing/tests/package/test_php_pam.py

Applied to master, thanks.

Thomas
diff mbox series

Patch

diff --git a/DEVELOPERS b/DEVELOPERS
index b1439391ca..8bbac82936 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1154,8 +1154,10 @@  F:	package/dtbocfg/
 F:	package/libdbi/
 F:	package/libdbi-drivers/
 F:	package/lua-augeas/
+F:	package/php-pam/
 F:	support/testing/tests/package/test_dtbocfg.py
 F:	support/testing/tests/package/test_lua_augeas.py
+F:	support/testing/tests/package/test_php_pam.py
 
 N:	Hiroshi Kawashima <kei-k@ca2.so-net.ne.jp>
 F:	package/gauche/
@@ -1994,6 +1996,7 @@  F:	package/bmap-tools/
 F:	package/libdbi/
 F:	package/libdbi-drivers/
 F:	package/lua-augeas/
+F:	package/php-pam/
 F:	package/php-xdebug/
 F:	package/python-augeas/
 F:	package/python-flask-expects-json/
@@ -2004,6 +2007,7 @@  F:	support/testing/tests/package/sample_python_augeas.py
 F:	support/testing/tests/package/sample_python_flask_expects_json.py
 F:	support/testing/tests/package/sample_python_git.py
 F:	support/testing/tests/package/test_bmap_tools.py
+F:	support/testing/tests/package/test_php_pam.py
 F:	support/testing/tests/package/test_python_augeas.py
 F:	support/testing/tests/package/test_python_flask_expects_json.py
 F:	support/testing/tests/package/test_python_git.py
diff --git a/package/Config.in b/package/Config.in
index 7971726875..b00d7b1475 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -868,6 +868,7 @@  menu "External php extensions"
 	source "package/php-gnupg/Config.in"
 	source "package/php-imagick/Config.in"
 	source "package/php-memcached/Config.in"
+	source "package/php-pam/Config.in"
 	source "package/php-ssh2/Config.in"
 	source "package/php-xdebug/Config.in"
 	source "package/php-yaml/Config.in"
diff --git a/package/php-pam/Config.in b/package/php-pam/Config.in
new file mode 100644
index 0000000000..5eae1ba1c2
--- /dev/null
+++ b/package/php-pam/Config.in
@@ -0,0 +1,15 @@ 
+config BR2_PACKAGE_PHP_PAM
+	bool "php-pam"
+	depends on BR2_ENABLE_LOCALE # linux-pam
+	depends on BR2_USE_WCHAR # linux-pam
+	depends on BR2_USE_MMU # linux-pam
+	depends on !BR2_STATIC_LIBS # linux-pam
+	select BR2_PACKAGE_LINUX_PAM
+	help
+	  PHP PAM (Pluggable Authentication Modules) integration
+
+	  https://pecl.php.net/package/PAM
+
+comment "php-pam needs a toolchain w/ wchar, locale, dynamic library"
+	depends on !(BR2_ENABLE_LOCALE && BR2_USE_WCHAR) \
+		|| BR2_STATIC_LIBS
diff --git a/package/php-pam/php-pam.hash b/package/php-pam/php-pam.hash
new file mode 100644
index 0000000000..c3eb49fbe7
--- /dev/null
+++ b/package/php-pam/php-pam.hash
@@ -0,0 +1,3 @@ 
+# Locally calculated:
+sha256  fda3b5f719d51cb278351eedd3d7a96db75661324d81fdcf8072a4309121bc92  pam-2.2.3.tgz
+sha256  0967ad6cf4b7fe81d38709d7aaef3fecb3bd685be7eebb37b864aa34c991baa7  LICENSE
diff --git a/package/php-pam/php-pam.mk b/package/php-pam/php-pam.mk
new file mode 100644
index 0000000000..8e20095d86
--- /dev/null
+++ b/package/php-pam/php-pam.mk
@@ -0,0 +1,26 @@ 
+################################################################################
+#
+# php-pam
+#
+################################################################################
+
+PHP_PAM_VERSION = 2.2.3
+PHP_PAM_SITE = http://pecl.php.net/get
+PHP_PAM_SOURCE = pam-$(PHP_PAM_VERSION).tgz
+PHP_PAM_LICENSE = PHP-3.01
+PHP_PAM_LICENSE_FILES = LICENSE
+PHP_PAM_DEPENDENCIES = php linux-pam host-autoconf host-pkgconf
+
+PHP_PAM_CONF_OPTS = \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php-config \
+	--with-pam=$(STAGING_DIR)/usr
+
+define PHP_PAM_PHPIZE
+	(cd $(@D); \
+		PHP_AUTOCONF=$(HOST_DIR)/usr/bin/autoconf \
+		PHP_AUTOHEADER=$(HOST_DIR)/usr/bin/autoheader \
+		$(STAGING_DIR)/usr/bin/phpize)
+endef
+PHP_PAM_PRE_CONFIGURE_HOOKS += PHP_PAM_PHPIZE
+
+$(eval $(autotools-package))
diff --git a/support/testing/tests/package/test_php_pam.py b/support/testing/tests/package/test_php_pam.py
new file mode 100644
index 0000000000..c4c1412e10
--- /dev/null
+++ b/support/testing/tests/package/test_php_pam.py
@@ -0,0 +1,32 @@ 
+import os
+
+import infra.basetest
+
+
+class TestPhpPam(infra.basetest.BRTest):
+    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+        """
+        BR2_PACKAGE_PHP=y
+        BR2_PACKAGE_PHP_SAPI_CLI=y
+        BR2_PACKAGE_PHP_PAM=y
+        BR2_TARGET_ROOTFS_CPIO=y
+        # BR2_TARGET_ROOTFS_TAR is not set
+        """
+
+    def test_run(self):
+        img = os.path.join(self.builddir, "images", "rootfs.cpio")
+        self.emulator.boot(arch="armv5",
+                           kernel="builtin",
+                           options=["-initrd", img])
+        self.emulator.login()
+
+        self.assertRunOk("mkdir /etc/php.d")
+        self.assertRunOk("echo 'extension=pam.so'> /etc/php.d/pam.ini")
+
+        output, exit_code = self.emulator.run("php --ri pam | sed '/^$/d'")
+        self.assertEqual(exit_code, 0)
+        self.assertEqual(output[0], "pam")
+        self.assertEqual(output[1], "PAM support => enabled")
+        # Do not check the version value in order to avoid test failure when
+        # bumping package version
+        self.assertEqual(output[2][0:21], "Extension version => ")