Re: How to port a PHP application that uses Composer?

2022-05-17 Thread Chris

On 2022-05-16 21:19, Mel Pilgrim wrote:

On 2022-05-16 20:14, Peter Beckman wrote:

PHP is an interpreted language, Unless there are compiled portions, there
is no porting necessary.


There are many reasons to port a PHP application.  Bringing in extensions 
and
tracking those dependencies, for example.  I've also seen a bunch of 
applications
that need patches to shell commands because they assume Linuxisms that don't 
work

on FreeBSD.


How does the "application" run? Is it just a directory that is configured
as a root directory for a webserver?


Web and command-line


Consider that it is something the installer needs to do, or build the
package as a deterministic set of packages already installed.


Yes, that's exactly the point I'm stuck on.  The fetch-extract-fetch and
toe-stepping problems mentioned in my original email came from me trying to 
solve

this either way:

"If I ran [composer] as part of the pkg building process, there's a 
fetch-extract
race as it needs network access, but also a file extracted from the 
distfile.


If I left it to user config, the autoloader script creation will change a 
file

managed by pkg."
You may have already solved this. But IMHO you would do well to have a look 
at

the way Python programs use (the) pip (store) to install their needed/desired
bits and pieces. Most things that use of Composer use a YAML format file to
describe it's needs. Can't you use that to drive your port?

HTH

l8r,
Chris



0xBDE49540.asc
Description: application/pgp-keys


Re: How to port a PHP application that uses Composer?

2022-05-17 Thread Stefan Esser
Am 17.05.22 um 06:19 schrieb Mel Pilgrim:
> On 2022-05-16 20:14, Peter Beckman wrote:
[...]
>> Consider that it is something the installer needs to do, or build the
>> package as a deterministic set of packages already installed.
> 
> Yes, that's exactly the point I'm stuck on.  The fetch-extract-fetch and
> toe-stepping problems mentioned in my original email came from me trying to
> solve this either way:
> 
> "If I ran [composer] as part of the pkg building process, there's a
> fetch-extract race as it needs network access, but also a file extracted from
> the distfile.

You can override the do-fetch target with a more complex sequence of commands.
Those have network access and you could extract the required json file to some
temporary location to let the composer do its job.

The composer.phar script could be made a separate port referenced as a fetch
dependency (FETCH_DEPENDS=...) in the port you are working on.

In combination, the composer.phar would be installed first, then the initial
distfile fetched and the composer.json file extracted to be operated on by
the composer script.

I'd assume that composer will download the extra distfiles to the directory
where the json file is found, and you'll have to move them to the correct
distfiles directory (where "make extract" expects to find them ...).

Regards, STefan


OpenPGP_signature
Description: OpenPGP digital signature