1 |
On 23/11/2019 16:48, Michał Górny wrote: |
2 |
> Hello, |
3 |
> |
4 |
> Some aspects of the current design of python-single-r1 are gross hack. |
5 |
> I'd like to discuss potential alternatives to them. |
6 |
> |
7 |
> |
8 |
> Preamble |
9 |
> ======== |
10 |
> For the purpose of this mail, let's establish two terms. |
11 |
> |
12 |
> 'Single' will refer to packages allowing the user to select 1 out of N |
13 |
> supported Python implementations. This generally means programs linking |
14 |
> to libpython, foreign build systems and end-user apps where installing |
15 |
> multiple copies of the code makes no sense. Those are the packages |
16 |
> using python-single-r1. |
17 |
> |
18 |
> 'Multi' will refer to packages allowing the user to select M out of N |
19 |
> supported Python implementations. This generally means ebuilds for |
20 |
> Python packages (modules, extensions). Those are the packages using |
21 |
> python-r1 (usually via distutils-r1). |
22 |
> |
23 |
> 'Single' packages can PYTHON_USEDEP-end either on other 'single' |
24 |
> or on 'multi' packages. However, 'multi' packages can only |
25 |
> PYTHON_USEDEP-end on other 'multi' packages (because 'single' wouldn't |
26 |
> ever be able to satisfy >1 impl). |
27 |
> |
28 |
> |
29 |
> Current status |
30 |
> ============== |
31 |
> Currently, 'single' packages use two sets of USE flags: PYTHON_TARGETS |
32 |
> and PYTHON_SINGLE_TARGET. The latter is used to select |
33 |
> the implementation used, and the former is used only for technical |
34 |
> reasons. Selected PST is required to be also enabled in PT. |
35 |
> |
36 |
> All dependencies enforce both PST and PT match. The PYTHON_USEDEP is |
37 |
> generally a giant hack that's meant to work both for depending |
38 |
> on 'single' and 'multi' packages. I'm not convinced this was the best |
39 |
> choice anymore. |
40 |
> |
41 |
> In single-to-single deps, PYTHON_USEDEP enforces both PST and PT flags |
42 |
> to match. This means that if two packages have matching PST but for |
43 |
> some reason were built with different PT, users end up having to switch |
44 |
> PT and rebuild the package without any real change. |
45 |
> |
46 |
> In single-to-multi deps, PYTHON_USEDEP enforces PT flags. For this |
47 |
> reason, we need to enforce that selected PST is always present in PT, |
48 |
> and users always have to put both flags in package.use. |
49 |
> |
50 |
> There's also a gross hack in PYTHON_USEDEP in 'multi' packages that |
51 |
> means to prevent multi-to-single deps. However, the dep mismatch it |
52 |
> causes is not very readable. |
53 |
> |
54 |
> |
55 |
> Alternative 1: PYTHON_TARGETS only |
56 |
> ================================== |
57 |
> The first alternative I'd like to explore is removing |
58 |
> PYTHON_SINGLE_TARGET flags. Why were they added in the first place? |
59 |
> The primary goal was to be able to set PT to 2.7+3.x without requiring |
60 |
> people to adjust flags for every 'single' package out there. Plus, it |
61 |
> turned out very convenient for Python team members who want to enable |
62 |
> all PT but obviously can't do the same for PST. |
63 |
> |
64 |
> Originally I brought this proposal in context of automated REQUIRED_USE |
65 |
> conflict resolution. However, that was rejected by the Council. Still, |
66 |
> it may start making sense again in the near future when we start |
67 |
> removing py2.7 and pypy2.7 support. If we can limit PT to one |
68 |
> implementation, and handle the remaining packages via IUSE defaults |
69 |
> and package.use, this may just work. |
70 |
> |
71 |
> The inconvenience to people enabling multiple PT will remain though. |
72 |
> |
73 |
> |
74 |
> Alternative 2: new dependency API |
75 |
> ================================= |
76 |
> If PST is going to stay, we may look into removing PT from 'single' |
77 |
> packages instead. The idea is to provide new method of generating |
78 |
> cross-package deps that doesn't require fake flags. |
79 |
> |
80 |
> PYTHON_USEDEP would continue working through a transitional period. |
81 |
> When it's entirely gone, we can remove PYTHON_TARGETS from 'single' |
82 |
> packages. |
83 |
> |
84 |
> Single-to-single deps would switch to PYTHON_SINGLE_USEDEP, that only |
85 |
> enforces PST and disregards PT entirely. |
86 |
> |
87 |
> Single-to-multi deps would have to use a new generator function, |
88 |
> $(python_gen_multi_dep ...) that would create appropriate USE-mapping |
89 |
> from PST to PT. |
90 |
> |
91 |
> Example ebuild would have: |
92 |
> |
93 |
> RDEPEND="app-foo/singlepkg[${PYTHON_SINGLE_USEDEP}] |
94 |
> $(python_gen_multi_dep ' |
95 |
> dev-python/foo[${PYTHON_USEDEP}] |
96 |
> dev-python/bar[${PYTHON_USEDEP}] |
97 |
> ')" |
98 |
> |
99 |
> This will generate something like: |
100 |
> |
101 |
> pst_python2_7? ( |
102 |
> dev-python/foo[pt_python2_7(-)] |
103 |
> dev-python/bar[pt_python2_7(-)] |
104 |
> ) |
105 |
> pst_python3_7? ( |
106 |
> dev-python/foo[pt_python3_7(-)] |
107 |
> dev-python/bar[pt_python3_7(-)] |
108 |
> ) |
109 |
> |
110 |
> |
111 |
> Your opinions |
112 |
> ============= |
113 |
> So, WDYT? Do you think this approach is worthwhile? Do you see other |
114 |
> options? |
115 |
> |
116 |
> |
117 |
|
118 |
The new dependency API proposal looks nicer to me. |
119 |
|
120 |
lu |