Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency
@ 2023-08-04  6:23 Bernd Kuhls
  2023-08-04 12:35 ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Bernd Kuhls @ 2023-08-04  6:23 UTC (permalink / raw)
  To: buildroot

Fixes:
http://autobuild.buildroot.net/results/506/50658c50fde8145fac320e3b17004e98c78c6c4d/

Although composer has host-php as build dependency, in the case of
BR2_PER_PACKAGE_DIRECTORIES=y host-php was not built during extract stage
of the composer package.

Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
---
 package/composer/composer.mk           |  2 +-
 package/pkg-utils.mk                   |  2 ++
 support/dependencies/check-host-php.mk |  4 ++++
 support/dependencies/check-host-php.sh | 14 ++++++++++++++
 4 files changed, 21 insertions(+), 1 deletion(-)
 create mode 100644 support/dependencies/check-host-php.mk
 create mode 100755 support/dependencies/check-host-php.sh

diff --git a/package/composer/composer.mk b/package/composer/composer.mk
index a24c020796..ad1785cba6 100644
--- a/package/composer/composer.mk
+++ b/package/composer/composer.mk
@@ -18,7 +18,7 @@ HOST_COMPOSER_DEPENDENCIES = host-php
 
 define HOST_COMPOSER_EXTRACT_CMDS
 	cp $(HOST_COMPOSER_DL_DIR)/$(COMPOSER_SOURCE) $(@D)
-	cd $(@D); $(HOST_DIR)/bin/php <<< '<?php \
+	cd $(@D); $(PHP) <<< '<?php \
 		$$p = new Phar("$(COMPOSER_SOURCE)"); \
 		$$p->extractTo(".", "LICENSE");'
 endef
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index 530638566c..353190c334 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -55,6 +55,7 @@ INFLATE.bz2  = $(BZCAT)
 INFLATE.gz   = $(ZCAT)
 INFLATE.lz   = $(LZCAT)
 INFLATE.lzma = $(XZCAT)
+INFLATE.phar = $(PHP)
 INFLATE.tbz  = $(BZCAT)
 INFLATE.tbz2 = $(BZCAT)
 INFLATE.tgz  = $(ZCAT)
@@ -64,6 +65,7 @@ INFLATE.tar  = cat
 suitable-extractor = $(INFLATE$(suffix $(1)))
 
 EXTRACTOR_PKG_DEPENDENCY.lzma = $(BR2_XZCAT_HOST_DEPENDENCY)
+EXTRACTOR_PKG_DEPENDENCY.phar = $(BR2_PHP_HOST_DEPENDENCY)
 EXTRACTOR_PKG_DEPENDENCY.xz   = $(BR2_XZCAT_HOST_DEPENDENCY)
 EXTRACTOR_PKG_DEPENDENCY.lz   = $(BR2_LZIP_HOST_DEPENDENCY)
 
diff --git a/support/dependencies/check-host-php.mk b/support/dependencies/check-host-php.mk
new file mode 100644
index 0000000000..eac98e73d9
--- /dev/null
+++ b/support/dependencies/check-host-php.mk
@@ -0,0 +1,4 @@
+ifeq (,$(call suitable-host-package,php,$(PHP)))
+BR2_PHP_HOST_DEPENDENCY = host-php
+PHP = $(HOST_DIR)/bin/php
+endif
diff --git a/support/dependencies/check-host-php.sh b/support/dependencies/check-host-php.sh
new file mode 100755
index 0000000000..d049a89455
--- /dev/null
+++ b/support/dependencies/check-host-php.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+candidate="$1"
+
+php=`which $candidate 2>/dev/null`
+if [ ! -x "$php" ]; then
+	php=`which php 2>/dev/null`
+	if [ ! -x "$php" ]; then
+		# echo nothing: no suitable php found
+		exit 1
+	fi
+fi
+
+echo $php
-- 
2.39.2

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency
  2023-08-04  6:23 [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency Bernd Kuhls
@ 2023-08-04 12:35 ` Thomas Petazzoni via buildroot
  2023-08-04 17:22   ` Yann E. MORIN
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-04 12:35 UTC (permalink / raw)
  To: Bernd Kuhls; +Cc: buildroot

Hello Bernd,

On Fri,  4 Aug 2023 08:23:07 +0200
Bernd Kuhls <bernd@kuhls.net> wrote:

> Fixes:
> http://autobuild.buildroot.net/results/506/50658c50fde8145fac320e3b17004e98c78c6c4d/
> 
> Although composer has host-php as build dependency, in the case of
> BR2_PER_PACKAGE_DIRECTORIES=y host-php was not built during extract stage
> of the composer package.
> 
> Signed-off-by: Bernd Kuhls <bernd@kuhls.net>

Thanks for noticing this. I indeed completely overlooked that when
reviewing/merging the composer patch. However, there is one thing that
I believe isn't ideal in your proposal, indeed it's kind of "half-way"
through.

You handle part of the problem in package/pkg-utils.mk, as if .phar
extraction was supported in the generic way in the package
infrastructure, but that isn't the case: it only works with the special
_EXTRACT_CMDS defined in composer.mk. So this .phar extraction would
not work for any other package.

So instead of your change in package/pkg-utils.mk, can you do:

HOST_COMPOSER_EXTRACT_DEPENDENCIES = $(BR2_PHP_HOST_DEPENDENCY)

in composer.mk ? This would make the entire handling of .phar
extraction a problem of composer.mk.

Of course, should we progressively have more and more of these, we
could look at making this generic. But right now, let's handle this as
a composer.mk specific concern.

What do you think?

Thanks a lot!

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency
  2023-08-04 12:35 ` Thomas Petazzoni via buildroot
@ 2023-08-04 17:22   ` Yann E. MORIN
  2023-08-07 15:37     ` Thomas Petazzoni via buildroot
  0 siblings, 1 reply; 4+ messages in thread
From: Yann E. MORIN @ 2023-08-04 17:22 UTC (permalink / raw)
  To: Thomas Petazzoni; +Cc: Bernd Kuhls, buildroot

Bernd, All,

On 2023-08-04 14:35 +0200, Thomas Petazzoni via buildroot spake thusly:
> On Fri,  4 Aug 2023 08:23:07 +0200
> Bernd Kuhls <bernd@kuhls.net> wrote:
> > Fixes:
> > http://autobuild.buildroot.net/results/506/50658c50fde8145fac320e3b17004e98c78c6c4d/
> > 
> > Although composer has host-php as build dependency, in the case of
> > BR2_PER_PACKAGE_DIRECTORIES=y host-php was not built during extract stage
> > of the composer package.
> > 
> > Signed-off-by: Bernd Kuhls <bernd@kuhls.net>
> 
> Thanks for noticing this. I indeed completely overlooked that when
> reviewing/merging the composer patch. However, there is one thing that
> I believe isn't ideal in your proposal, indeed it's kind of "half-way"
> through.
> 
> You handle part of the problem in package/pkg-utils.mk, as if .phar
> extraction was supported in the generic way in the package
> infrastructure, but that isn't the case: it only works with the special
> _EXTRACT_CMDS defined in composer.mk. So this .phar extraction would
> not work for any other package.
> 
> So instead of your change in package/pkg-utils.mk, can you do:
> 
> HOST_COMPOSER_EXTRACT_DEPENDENCIES = $(BR2_PHP_HOST_DEPENDENCY)
> 
> in composer.mk ? This would make the entire handling of .phar
> extraction a problem of composer.mk.
> 
> Of course, should we progressively have more and more of these, we
> could look at making this generic. But right now, let's handle this as
> a composer.mk specific concern.
> 
> What do you think?

I agree that we do not want to introduce it in the generic infra for
now, until we have at least a few packages that need it.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency
  2023-08-04 17:22   ` Yann E. MORIN
@ 2023-08-07 15:37     ` Thomas Petazzoni via buildroot
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Petazzoni via buildroot @ 2023-08-07 15:37 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Bernd Kuhls, buildroot

On Fri, 4 Aug 2023 19:22:13 +0200
"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:

> > What do you think?  
> 
> I agree that we do not want to introduce it in the generic infra for
> now, until we have at least a few packages that need it.

Agreed, but to me the issue was not so much that it was made generic
here: my concern was that the proposed solution was half generic, half
in the composer package.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-08-07 15:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-04  6:23 [Buildroot] [PATCH 1/1] package/pkg-generic: handle host-php as an extract dependency Bernd Kuhls
2023-08-04 12:35 ` Thomas Petazzoni via buildroot
2023-08-04 17:22   ` Yann E. MORIN
2023-08-07 15:37     ` Thomas Petazzoni via buildroot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox