mbox series

[0/8] python: clean up host version logic.

Message ID 20180102163337.6334-1-aduskett@gmail.com
Headers show
Series python: clean up host version logic. | expand

Message

Adam Duskett Jan. 2, 2018, 4:33 p.m. UTC
Currently, packages that rely on host-python, and are compatible with both
python2 and 3, only build python3 if python3 is selected for the target.

This causes a problem in the following scenario:

- A user does not have a target python selected.
- Package A depends on host-python3
- Package B is compatible with host-python and host-python3

In this scenario, host-python is not needed, as package A and B are
both compatible with python3. However; both host-python and host-python3 will
be built because no target-python has been selected.

To fix this, the following patch series introduces a few minimal changes
that will allow the user to manually select a host version of python.
(Note: I have changed only the packages that I personally use and have tested.)

Adam Duskett (8):
  python: add host-entry
  python3: add host-entry
  python-setuptools: check host-python version
  pkg-waf.mk: check host-python version
  ninja: check host-python version
  libselinux: check host-python version
  setools: check host-python version
  libselinux: check host-python version

 package/Config.in.host                         |  2 ++
 package/libselinux/libselinux.mk               |  2 +-
 package/libsemanage/libsemanage.mk             |  2 +-
 package/ninja/ninja.mk                         |  2 +-
 package/pkg-waf.mk                             | 20 +++++++++++++-------
 package/python-setuptools/python-setuptools.mk | 10 +++++++++-
 package/python/Config.in.host                  |  6 ++++++
 package/python3/Config.in.host                 |  6 ++++++
 package/setools/setools.mk                     |  6 ++++++
 9 files changed, 45 insertions(+), 11 deletions(-)
 create mode 100644 package/python/Config.in.host
 create mode 100644 package/python3/Config.in.host

Comments

Thomas Petazzoni Jan. 2, 2018, 8:40 p.m. UTC | #1
Hello,

On Tue,  2 Jan 2018 11:33:29 -0500, Adam Duskett wrote:
> Currently, packages that rely on host-python, and are compatible with both
> python2 and 3, only build python3 if python3 is selected for the target.
> 
> This causes a problem in the following scenario:
> 
> - A user does not have a target python selected.
> - Package A depends on host-python3
> - Package B is compatible with host-python and host-python3
> 
> In this scenario, host-python is not needed, as package A and B are
> both compatible with python3. However; both host-python and host-python3 will
> be built because no target-python has been selected.
> 
> To fix this, the following patch series introduces a few minimal changes
> that will allow the user to manually select a host version of python.
> (Note: I have changed only the packages that I personally use and have tested.)

I will have to think a lot to fully grasp the potential consequences of
your changes.

However, there is one thing that I believe is missing in your patch
series: BR2_PACKAGE_PYTHON3 should select BR2_PACKAGE_HOST_PYTHON3, and
BR2_PACKAGE_PYTHON should select BR2_PACKAGE_HOST_PYTHON.

Best regards,

Thomas
Yann E. MORIN Jan. 2, 2018, 9:40 p.m. UTC | #2
Thomas, Adam, All,

On 2018-01-02 21:40 +0100, Thomas Petazzoni spake thusly:
> On Tue,  2 Jan 2018 11:33:29 -0500, Adam Duskett wrote:
> > Currently, packages that rely on host-python, and are compatible with both
> > python2 and 3, only build python3 if python3 is selected for the target.
> > 
> > This causes a problem in the following scenario:
> > 
> > - A user does not have a target python selected.
> > - Package A depends on host-python3
> > - Package B is compatible with host-python and host-python3
> > 
> > In this scenario, host-python is not needed, as package A and B are
> > both compatible with python3. However; both host-python and host-python3 will
> > be built because no target-python has been selected.
> > 
> > To fix this, the following patch series introduces a few minimal changes
> > that will allow the user to manually select a host version of python.
> > (Note: I have changed only the packages that I personally use and have tested.)
> 
> I will have to think a lot to fully grasp the potential consequences of
> your changes.
> 
> However, there is one thing that I believe is missing in your patch
> series: BR2_PACKAGE_PYTHON3 should select BR2_PACKAGE_HOST_PYTHON3, and
> BR2_PACKAGE_PYTHON should select BR2_PACKAGE_HOST_PYTHON.

Furthermore, I believe the prompt should be hidden, because it does not
make sense for the user to actually select the host version for python.

Besides, the current series allows for building both host-python and
host-python3 in the same configuration, and we do not support this for
now (or we would have made it possible for the target variant too).

Regards,
Yann E. MORIN.
Thomas Petazzoni Jan. 2, 2018, 9:44 p.m. UTC | #3
Hello,

On Tue, 2 Jan 2018 22:40:32 +0100, Yann E. MORIN wrote:

> > However, there is one thing that I believe is missing in your patch
> > series: BR2_PACKAGE_PYTHON3 should select BR2_PACKAGE_HOST_PYTHON3, and
> > BR2_PACKAGE_PYTHON should select BR2_PACKAGE_HOST_PYTHON.  
> 
> Furthermore, I believe the prompt should be hidden, because it does not
> make sense for the user to actually select the host version for python.

If the prompt is not user-selectable, then I don't see the point of the
patch series. Indeed, you can already do:

<pkg>_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python)

to use host-python3 if already built as part of the python3 build
process, or fallback to host-python otherwise. We already use this
construct in a number of places.

> Besides, the current series allows for building both host-python and
> host-python3 in the same configuration, and we do not support this for
> now (or we would have made it possible for the target variant too).

Of course we support building both host-python and host-python3. What
we don't support is:

 - python and python3 in the same configuration

 - building third-party host python modules for a host python version
   different from the selected target python version

Best regards,

Thomas