Poudriere: Build different versions of the same package

I am using ports-mgmt/poudriere to compile packages with just the options I need. These are then exported via a webserver for FreeBSD clients to download. One of the packages I build is lang/php71 (with lang/php71-extensions and lang/mod_php71).

Now I also want to build lang/php70, because some legacy software needs it. I would like to have it in the same package repository as lang/php71, like it is in the official package repository. When I just add it to my port-list, I get the following error when compiling lang/php70-extensions:

Code:
pkg-static: php71-7.1.7 conflicts with php70-7.0.21 (installs files into the same place).  
Problematic file: /usr/local/bin/php
My questions are:
  1. Is it possible to compile multiple versions of the same package into the same repository?
  2. How is it done for the official repository?
I have searched quite a bit on the internet, without finding a good approach. I have also tried building in two different jails with different versions of php, but that ofc gave me two different pkg repositories as well. I can build either lang/php71 or lang/php70 on different jails/machines.

I have also played around with WITH_MPM=event in the make.conf, which results in lang/php70 building. For some reason, lang/php71 builds only on one machine without it.

One thing that is left to do is to always use poudriere -c before building, even though it would take a lot of time to build then. I am testing that on the machine that builds lang/php71 without WITH_MPM=event, to see if it still works

I would be happy if someone could share his experience with poudriere (and reproducible builds) and building the same package in different versions into the same pkg repository.
 
Are you setting DEFAULT_VERSIONS? Without defining a default you should be able to build both.
 
Yes, I am indeed setting DEFAULT_VERSIONS, otherwise php56 got build, which then clashed with php71.

This is my (freebsd_11...)make.conf, used by poudriere:
Code:
DEFAULT_VERSIONS+=php=71
DEFAULT_VERSIONS+=pgsql=9.6
DEFAULT_VERSIONS+=ssl=openssl
SUEXEC_DOCROOT="/usr/local/www"
SUEXEC_USERDIR="data:public_html"
SUEXEC_UIDMIN="80"
SUEXEC_GIDMIN="80"
SUEXEC_LOGFILE="/var/log/httpd/httpd-suexec.log"
WITH_MPM=event
If I am removing the DEFAULT_VERSIONS, the following occurs when building:
Code:
pecl-pdflib-4.1.1.txz: new dependency: lang/php56
Can pecl-pdflib somehow be convinvced to build against php7X?
 
This is btw the error that occurs when pecl-pdflib is being built:
Code:
===>   pecl-pdflib-4.1.1 depends on file: /usr/local/lib/php/20131226-zts/gd.so - not found
===>   Installing existing package /packages/All/php56-gd-5.6.31.txz
...
===>   pecl-pdflib-4.1.1 depends on file: /usr/local/lib/php/20131226-zts/gd.so - not found
*** Error code 1
 
The "problem" is that ports like pecl-pdflib use whatever is set as default. The www/mod_php70 port sets PHP to 7.0 unless the default is explicitly set to something else. It's a bit of a conundrum, you need to set the default for pecl-* but doing so interferes with mod_php*.

I'm not sure if it would work but you could try something like this:
Code:
DEFAULT_VERSIONS+=pgsql=9.6
DEFAULT_VERSIONS+=ssl=openssl
.if (.CURDIR:M*/pecl-*)
  PHP_DEFAULT=7.1
.endif

The idea is to leave the PHP as default expect for ports named pecl-*, set PHP to 7.1 for those. But there may be other php-* ports that need to be set.
 
I tried this approache and still got an error. I have been bug hunting with poudriere testport -j ... -p ... -o databases/php71-pdo_sqlite -i -c :
Code:
===>   php71-pdo_sqlite-7.1.8 depends on file: /usr/local/lib/php/20160303-zts/pdo.so - not found
*** Error code 1

Stop.
make: stopped in /usr/ports/databases/php71-pdo_sqlite
=======================<phase: Interactive    >============================
[00:00:18] ====>> Installing packages
[00:00:18] ====>> Installing run-depends for databases/php71-pdo_sqlite
===>   php71-pdo_sqlite-7.1.8 depends on file: /usr/local/include/php/main/php.h - found
===>   php71-pdo_sqlite-7.1.8 depends on file: /usr/local/lib/php/20160303/pdo.so - found

Sooo. I take it ZTS is not honoured with databases/php71-pdo and therefore /usr/local/lib/php/20160303/pdo.so exists, but not the needed /usr/local/lib/php/20160303-zts/pdo.so? What can be done here?

And yes, I am using WITH_MPM=event in the make.conf.
 
What is most strange is that the PHP_EXT_DIR is apparently set appropriately:
Code:
--PLIST_SUB--
PHP_EXT_DIR=20160303-zts
OSREL=11.0
PREFIX=%D
LOCALBASE=/usr/local
RESETPREFIX=/usr/local
PORTDOCS=""
PORTEXAMPLES=""
LIB32DIR=lib
DOCSDIR="share/doc/php71"
EXAMPLESDIR="share/examples/php71"
DATADIR="share/php71"
WWWDIR="www/php71"
ETCDIR="etc/php71"
--End PLIST_SUB--

--SUB_LIST--
PHP_EXT_DIR=20160303-zts
PREFIX=/usr/local
LOCALBASE=/usr/local
DATADIR=/usr/local/share/php71
DOCSDIR=/usr/local/share/doc/php71
EXAMPLESDIR=/usr/local/share/examples/php71
WWWDIR=/usr/local/www/php71
ETCDIR=/usr/local/etc/php71
--End SUB_LIST--
But then, after the build, the directory doesnt exist:
Code:
# ls /usr/local/lib/php/20160303/
pdo.so
 
I really wonder where the directory /usr/local/lib/php/20160303/ is created. I hardcoded 20160303-zts in the Makefile, still get the same directory.

My best bet is actually /usr/local/etc/php.conf, in my jail in this case. I can see that the it is set to 20160303. I wonder how to change that for a jail.
 
The directory name depends on whether or not Zend is enabled. It's disabled by default. If you want to use it you need to make sure it's enabled on both lang/php70 and www/mod_php70 (the same is true for the corresponding PHP 7.1 ports). If it's enabled on one but not the other you get weird results like this.
 
If you mean ZTS, I have made sure that it is enabled by grepping for it in the options for the build. I am a bit stumped and don't know where the directory is being made. I have also searched in the Makefiles and tried commenting and fiddling around.

I will now make a testjail just for php70 and try just building that alone.
 
If you mean ZTS
Yes, Zend Thread Safety.

I am a bit stumped and don't know where the directory is being made. I have also searched in the Makefiles and tried commenting and fiddling around.
It's probably done by /usr/ports/Mk/Uses/php.mk. There are a bunch of 'helper' scripts in /usr/ports/Mk/ that take care of most the work.
 
/usr/ports/Mk/Uses/php.mk is the file I fiddled around with. I actually hardcoded (changed) all the directories to <dirname>-zts (for example 20160303-zts). The one without -zts still got created though. That made me wonder.
 
As I don't really know the workings of poudriere/ports, I think I'll let it rest for now. Thank you for your support, SirDice :)
 
If you happen to know how the FreeBSD Project manages to build the whole package repository without any conflicts, I would really like to know. A link would also be very appreciated; didn't find anything via google so far.
 
Back
Top