Solved DEFAULT_VERSIONS+=BDB=18 breaks build in poudriere

The problem:

I set
Code:
DEFAULT_VERSIONS+=BDB=18
in make.conf in order to force upgrade to databases/db18 from databases/db5. This immediately caused problems. When building updated ports with poudriere, ports which depended on bdb via
Code:
USES= bdb
would not build, claiming that no compatible version was available.

The solution:

Add
Code:
WITH_BDB6_PERMITTED=yes
to make.conf.

The reason:

In file /usr/ports/Mk/Uses/bdb.mk version 18 is not appended to the variable
Code:
_DB_DEFAULTS
without this variable being set.
Code:
_DB_PORTS=        5 18
_DB_DEFAULTS=    5
#
#   Since 2020-12-02, this name is not fitting too much but
#   retained for now for compatibility. The name of this variable
#   is subject to change especially once db6 were removed.
.  if defined(WITH_BDB6_PERMITTED) || ${_bdb_ARGS} == 18
_DB_DEFAULTS+=    18
.  endif

When building from the ports tree, if databases/db18 is already installed it is detected and there is no problem. Likewise, if the port Makefile specifies version 18 it also works. Since poudriere will attempt to install required packages from its repository, bdb.mk will generate an error and the build will fail without this additional variable being set.

IDK if it's a bug or works as intended. However, this is the easy fix for anyone trying to do what I did.
 
DEFAULT_VERSIONS+=BDB=18
Shouldn't this be DEFAULT_VERSIONS+=bdb=18? All DEFAULT_VERSIONS variables are lower case, scripts do some magic to translate it to various *_DEFAULT values.
 
I guess I didn't know that. I got the variable from bsd.default-version.mk and used what I saw there. Would that make a difference?

EDIT: Tried and failed

I changed the variable to use lowercase and commented out the WITH_BDB6_PERMITTED=yes line in make.conf and it failed to build textproc/redland as before. Running make debug-bdb in the jail's port directory gives the same output as before:
Code:
root@joliet-jamestown:/usr/ports/textproc/redland # make debug-bdb
--INPUTS----------------------------------------------------
REDLAND_WITH_BDB_VER: 
BDB_DEFAULT: 18
BDB_BUILD_DEPENDS: 
bdb_ARGS (original): 
WITH_BDB_HIGHEST (original): 
--PROCESSING------------------------------------------------
supported versions: 18
invalid versions: 
installed versions: 
eligible versions: 
bdb_ARGS (effective): 18
WITH_BDB_HIGHEST (override): yes
--OUTPUTS---------------------------------------------------
IGNORE=cannot install: no eligible BerkeleyDB version. Requested: 18, incompatible: . Try: make debug-bdb
BDB_VER=
BDB_INCLUDE_DIR=
BDB_LIB_NAME=
BDB_LIB_CXX_NAME=
BDB_LIB_DIR=
BUILD_DEPENDS=
LIB_DEPENDS=
------------------------------------------------------------
 
Would that make a difference?
I'm honestly not sure if it does. There's some upper/lower case magic happening everywhere. Those Mk/ ports infrastructure makefiles are notoriously difficult to debug. But it's easy enough to try and test. I've avoided this ordeal by simply eliminating the BDB dependency.

If it still doesn't work, then I'd say it's a bug. Ports that have a USES= bdb should respect setting DEFAULT_VERSIONS+=bdb=18. That said, individual problems with the ports themselves are an entirely different matter. I'm not sure if one is a clean 'drop-in' replacement for the other. Individual ports might need specific patches in order to build/work correctly with a different version of BDB.
 
Those Mk/ ports infrastructure makefiles are notoriously difficult to debug.
Indeed. Took me at least 2 hours to figure it out, mostly due to being unfamiliar with the guts of the beast -- but also because it's hard to keep track of all the .if .else. .endif's in there.

So far, I haven't had a problem with any of the ports I use after upgrading them all to use databases/db18 and removing databases/db5. Since it's supposed to have worked out of the box, and WITH_BDB6_PERMITTED is potentially going away according to the comments, I'll open a PR for it. I've seen mention elsewhere that the extra variable was motivated by a difference in the license of databases/db6. Perhaps it's no longer an issue.

Of course, if a port won't work with databases/db18 then USES+= bdb:5 can be set by the maintainer or the user to fall back to the older version.
 
Apparently I used the wrong approach in searching for a PR for this. It was all explained in PR 261638 which is still open. It references an issue with the license which is still apparently a problem.
 
Back
Top