[HEADSUP] Flavors, and specifically, Python flavors landing today

Mathieu Arnold mat at FreeBSD.org
Thu Nov 30 16:22:42 UTC 2017


On 30/11/2017 à 16:32, Mathieu Arnold wrote a beautiful email and something
messed it up completely, so he's trying again.:

Hi,

TL;DR:
  See https://wiki.freebsd.org/Ports/FlavorsAndSubPackages
  Tool developers, see https://wiki.freebsd.org/Ports/FlavorsTools
  All Python dependencies must have @${PY_FLAVOR} appended to them
 

Flavors are a way to have multiple variations of a port.  The port is built
multiple times, with the variations.  To declare flavors, set the FLAVORS
variable to the flavors you want defined.  The first flavor will be the
default:
   
  FLAVORS=   flavor1 flavor2
   
The flavors MUST be lowercase, and can contain [[:lower:][:digit:]_].
   
Then, when building the port, pass the FLAVOR as an argument after make to
select the flavor.
   
  $ make install FLAVOR=flavor2
   
In the port, you can then change the behavior depending on the value of the
FLAVOR variable.  Note that the different flavors MUST have different
PKGNAMEs.  Be sure to guard against an empty FLAVOR variable by using
${FLAVOR:U}:
   
  .if ${FLAVOR:U} == flavor2
  PKGNAMESUFFIX=      -foo
  OPTIONS_DEFAULT+=   FOO
  .endif
 
Right now, adding FLAVORS to a port will need portmgr's approval, until we
figure precise guidelines so that the number of packages does not grow
exponentially.
 

 

=== Tools ===
   
Flavor support for ports-mgmt/poudriere was added in 3.2, be sure to
upgrade to the latest version.

 
=== Helpers ===
 
To help with flavored ports, helpers are available.  In these, replace <*>
with the flavor name.
   
*_PKGNAMEPREFIX *_PKGNAMESUFFIX *_PLIST *_DESCR will overwrite the variable.
   
*_CONFLICTS *_CONFLICTS_BUILD *_CONFLICTS_INSTALL *_PKG_DEPENDS
*_EXTRACT_DEPENDS *_PATCH_DEPENDS *_FETCH_DEPENDS *_BUILD_DEPENDS
*_LIB_DEPENDS *_RUN_DEPENDS *_TEST_DEPENDS will append to the variable.
   
For example:
   
  flavor2_PKGNAMESUFFIX=      -foo
   
can replace:
   
  .if ${FLAVOR:U} == flavor2
  PKGNAMESUFFIX=      -foo
  .endif
 

 

 
=== Python ===

Ports using Python via USES=python are now flavored.  All the py3-* ports
have been removed and folded into their py-* master ports.
   
People using Poudriere and binary packages do not have to do anything.
   
For other people, to build the Python 3.6 version of, for example,
databases/py-gdbm, you need to run:
   
  # make FLAVOR=py36 install
 
 
Ports using USE_PYTHON=distutils are now flavored.  They will automatically
flavors (py27, py34, py35, py36) depending on what versions they support.

There is also a USE_PYTHON=flavors for ports that do not use distutils but
need FLAVORS to be set.  A USE_PYTHON=noflavors can be set if the port is
using distutils but flavors are not wanted.
   
A new USE_PYTHON=optsuffix that adds PYTHON_PKGNAMESUFFIX has been added
to cope with Python ports that did not have the Python PKGNAMEPREFIX but are
flavored.
   
USES=python now also exports a PY_FLAVOR variable that contains the current
python flavor.  It can be used in dependency lines when the port itself is
not python flavored, for example, deskutils/calibre.
   
By default it will only generate flavors for the versions in PYTHON2_DEFAULT
and PYTHON3_DEFAULT.  Define BUILD_ALL_PYTHON_FLAVORS in your make.conf to
generate all possible flavors.  A port can set USE_PYTHON=allflavors to have
all the flavors and not simply the default ones.
 
In all the ports with Python dependencies, the *_DEPENDS entries MUST end
with the flavor so that the framework knows which to build/use.  This is
done
by appending '@${PY_FLAVOR}' after the origin (or @${FLAVOR} if in a Python
module with Python flavors, as the content will be the same).  For example:

  RUN_DEPENDS=        ${PYTHON_PKGNAMEPREFIX}six>0:devel/py-six@${PY_FLAVOR}




-- 
Mathieu Arnold


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20171130/079b373f/attachment.sig>


More information about the freebsd-ports mailing list