1 |
On Fri, Jan 15, 2021 at 6:47 PM Matt Turner <mattst88@g.o> wrote: |
2 |
> |
3 |
> This set is the upgradable packages for which the highest visible |
4 |
> version has a different subslot than the currently installed version. |
5 |
> |
6 |
> The primary purpose of this feature is for use in catalyst builds. We |
7 |
> update the "seed" stage3 before using it to build a new stage1. |
8 |
> |
9 |
> Updating the entire stage is expensive and unnecessary (since we're |
10 |
> going to build the latest packages in stage1 and then rebuild everything |
11 |
> in stage3). |
12 |
> |
13 |
> What we definitely do need to update in the original stage3 however, is |
14 |
> any package that would trigger a subslot rebuild. |
15 |
> |
16 |
> For example: gcc links with libmpfr.so from dev-libs/mpfr. mpfr's SONAME |
17 |
> changes from libmpfr.so.4 (SLOT="0/4") to libmpfr.so.6 (SLOT="0/6"). If |
18 |
> the seed stage's dev-libs/mpfr is not updated before emerging gcc, gcc |
19 |
> will link with libmpfr.so.4, but the latest version of dev-libs/mpfr |
20 |
> will be built and libmpfr.so.6 included into the stage1. Since the old |
21 |
> libmpfr.so.4 is not included in the stage1, gcc will not work, breaking |
22 |
> subsequent stage builds. |
23 |
> |
24 |
> Our current options to update the seed are too large a hammer (e.g., |
25 |
> "--update --deep --newuse @world" or "--update --deep --newuse |
26 |
> --complete-graph --rebuild-if-new-ver gcc") and spend too much time |
27 |
> updating seed stages for no gain beyond updating only packages for whom |
28 |
> the subslot has changed. |
29 |
> |
30 |
> With this set, catalyst will likely use |
31 |
> |
32 |
> emerge @changed-subslot --ignore-built-slot-operator-deps y |
33 |
> |
34 |
> to update the seed stage. |
35 |
> |
36 |
> Thank you to Zac Medico for showing me how to do this. |
37 |
> |
38 |
> Bug: https://bugs.gentoo.org/739004 |
39 |
> Signed-off-by: Matt Turner <mattst88@g.o> |
40 |
> --- |
41 |
> cnf/sets/portage.conf | 5 +++++ |
42 |
> lib/portage/_sets/dbapi.py | 39 +++++++++++++++++++++++++++++++++++++- |
43 |
> 2 files changed, 43 insertions(+), 1 deletion(-) |
44 |
> |
45 |
> diff --git a/cnf/sets/portage.conf b/cnf/sets/portage.conf |
46 |
> index 22f0fa3a5..5651a9c53 100644 |
47 |
> --- a/cnf/sets/portage.conf |
48 |
> +++ b/cnf/sets/portage.conf |
49 |
> @@ -84,6 +84,11 @@ exclude-files = /usr/bin/Xorg |
50 |
> [rebuilt-binaries] |
51 |
> class = portage.sets.dbapi.RebuiltBinaries |
52 |
> |
53 |
> +# Installed packages for which the subslot of the highest visible ebuild |
54 |
> +# version is different than the currently installed version. |
55 |
> +[changed-subslot] |
56 |
> +class = portage.sets.dbapi.SubslotChangedSet |
57 |
> + |
58 |
> # Installed packages for which the highest visible ebuild |
59 |
> # version is lower than the currently installed version. |
60 |
> [downgrade] |
61 |
> diff --git a/lib/portage/_sets/dbapi.py b/lib/portage/_sets/dbapi.py |
62 |
> index 52367c4a6..46ba5c17d 100644 |
63 |
> --- a/lib/portage/_sets/dbapi.py |
64 |
> +++ b/lib/portage/_sets/dbapi.py |
65 |
> @@ -15,7 +15,7 @@ from portage._sets import SetConfigError, get_boolean |
66 |
> import portage |
67 |
> |
68 |
> __all__ = ["CategorySet", "ChangedDepsSet", "DowngradeSet", |
69 |
> - "EverythingSet", "OwnerSet", "VariableSet"] |
70 |
> + "EverythingSet", "OwnerSet", "SubslotChangedSet", "VariableSet"] |
71 |
> |
72 |
> class EverythingSet(PackageSet): |
73 |
> _operations = ["merge"] |
74 |
> @@ -167,6 +167,43 @@ class VariableSet(EverythingSet): |
75 |
> |
76 |
> singleBuilder = classmethod(singleBuilder) |
77 |
> |
78 |
> +class SubslotChangedSet(PackageSet): |
79 |
> + |
80 |
> + _operations = ["merge", "unmerge"] |
81 |
> + |
82 |
> + description = "Package set which contains all packages " + \ |
83 |
> + "for which the subslot of the highest visible ebuild is " + \ |
84 |
> + "different than the currently installed version." |
85 |
|
86 |
description = ("string1", |
87 |
"string2", |
88 |
"string3") |
89 |
|
90 |
vs concat + \ for line continuation? |
91 |
|
92 |
-A |
93 |
|
94 |
> + |
95 |
> + def __init__(self, portdb=None, vardb=None): |
96 |
> + super(SubslotChangedSet, self).__init__() |
97 |
> + self._portdb = portdb |
98 |
> + self._vardb = vardb |
99 |
> + |
100 |
> + def load(self): |
101 |
> + atoms = [] |
102 |
> + xmatch = self._portdb.xmatch |
103 |
> + xmatch_level = "bestmatch-visible" |
104 |
> + cp_list = self._vardb.cp_list |
105 |
> + pkg_str = self._vardb._pkg_str |
106 |
> + for cp in self._vardb.cp_all(): |
107 |
> + for cpv in cp_list(cp): |
108 |
> + pkg = pkg_str(cpv, None) |
109 |
> + slot_atom = "%s:%s" % (pkg.cp, pkg.slot) |
110 |
> + ebuild = xmatch(xmatch_level, slot_atom) |
111 |
> + if not ebuild: |
112 |
> + continue |
113 |
> + if pkg.sub_slot != ebuild.sub_slot: |
114 |
> + atoms.append(slot_atom) |
115 |
> + |
116 |
> + self._setAtoms(atoms) |
117 |
> + |
118 |
> + def singleBuilder(cls, options, settings, trees): |
119 |
> + return cls(portdb=trees["porttree"].dbapi, |
120 |
> + vardb=trees["vartree"].dbapi) |
121 |
> + |
122 |
> + singleBuilder = classmethod(singleBuilder) |
123 |
> + |
124 |
> class DowngradeSet(PackageSet): |
125 |
> |
126 |
> _operations = ["merge", "unmerge"] |
127 |
> -- |
128 |
> 2.26.2 |
129 |
> |
130 |
> |