Gentoo Archives: gentoo-dev

From: Bernd Steinhauser <gentoo@×××××××××××××××××.de>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Re: Re: Multislot dependencies
Date: Sat, 28 Jun 2008 19:28:07
Message-Id: 486690BC.8020005@bernd-steinhauser.de
In Reply to: [gentoo-dev] Re: Re: Multislot dependencies by "Tiziano Müller"
1 Tiziano Müller schrieb:
2 > Bernd Steinhauser wrote:
3 >
4 >> Tiziano Müller schrieb:
5 >>> Bernd Steinhauser wrote:
6 >>>
7 >>>> Tiziano Müller schrieb:
8 >>>>> Hi everyone
9 >>>>>
10 >>>>> I'd like to bring bug #229521 to your attention and see whether we can
11 >>>>> come up with a solution for it.
12 >>>>>
13 >>>>> The problem:
14 >>>>> A package "foo" depends on a slotted package "bar" _and_ more than one
15 >>>>> slot of "bar" can satisfy this dependency.
16 >>>>>
17 >>>>> Why this is a problem:
18 >>>>> If the dependency looks like one of the following:
19 >>>>> * DEPEND=">=cat/bar-2"
20 >>>>> * DEPEND="<=cat/bar-3"
21 >>>>> * DEPEND="|| ( cat/bar:2 cat/bar:3 )
22 >>>>> then the package manager doesn't know after building "foo" which slot
23 >>>>> of "bar" has been used to build "foo". On the other hand might this
24 >>>>> information be needed to debug problems with package "foo".
25 >>>>>
26 >>>>> The problem gets even worse as soon as RDEPEND comes in:
27 >>>>> (assuming the same examples from above but with RDEPEND)
28 >>>>> * The package manager currently doesn't record which slot has been used
29 >>>>> and can't therefore track whether the user will destroy something in
30 >>>>> case he uninstalls one of the slots of "bar"
31 >>>>> * The package manager can't sanely consider whether an update for a
32 >>>>> slot is actually needed
33 >>>> There is a section in PMS, that tries to address this.
34 >>>>
35 >>>> =================
36 >>>> Slot Dependencies
37 >>>> A named slot dependency consists of a colon followed by a slot name. A
38 >>>> specification with
39 >>>> a named slot dependency matches only if the slot of the matched package
40 >>>> is equal to the slot
41 >>>> specified. If the slot of the package to match cannot be determined
42 >>>> (e.g. because it is not a
43 >>>> supported EAPI), the match is treated as unsuccessful.
44 >>>> An operator slot dependency consists of a colon followed by one of the
45 >>>> following operators:
46 >>>> * Indicates that any slot value is acceptable. In addition, for runtime
47 >>>> dependencies, indicates
48 >>>> that the package will not break if the matched package is uninstalled
49 >>>> and replaced by a
50 >>>> different matching package in a different slot.
51 >>>> = Indicates that any slot value is acceptable. In addition, for runtime
52 >>>> dependencies, indicates
53 >>>> that the package will break unless a matching package with slot equal to
54 >>>> the slot of the
55 >>>> best installed version at the time the package was installed is
56 >>>> available. To implement the equals slot operator, the package manager
57 >>>> will need to store the slot of the
58 >>>> best installed version of the matching package. The package manager may
59 >>>> do this by appending
60 >>>> the appropriate slot after the equals sign when saving the package?s
61 >>>> dependencies. This syntax
62 >>>> is only for package manager use and must not be used by ebuilds.
63 >>>> =================
64 >>>>
65 >>>> So, if you go with that, the dependency would look like this:
66 >>>> DEPEND=">=cat/bar-2:="
67 >>>>
68 >>>> That means, that it accepts any slot of versions above version 2, but
69 >>>> restricts it to the slot it has been built against, at runtime.
70 >>>> The combination of >= and := might look a bit ugly, so maybe it might
71 >>>> indeed be useful to specify a way to provide a list of slots.
72 >>>> But it would work in most cases.
73 >>> hmm, this is kdebuild-1...
74 >> Indeed, but it is a proposal.
75 >>
76 >>> I miss two things here:
77 >>> a) What happens in case of DEPEND="", RDEPEND=">=cat/bar-2:=" ? Is that
78 >>> defined? If yes, what does it mean? If not, what shall be the package
79 >>> managers behaviour?
80 >> I don't think, that RDEPEND matters here.
81 >> If a dep is not in DEPEND, that means, that it doesn't affect the build
82 >> process of the package. So in case the dep spec matches more than one
83 >> slot, the package should be able to use both without a rebuild.
84 >> (Which means, that the package manager can switch the dep.)
85 >> If changing the slot would mean, that a rebuild is required, then the
86 >> dep affects the package at build time and should be in DEPEND.
87 > Oh, my point is much simpler:
88 > The kdebuild-1 spec says: "[...] that the package will break unless a
89 > matching package with slot equal to the slot of the best installed version
90 > at the time the package was installed is available."
91 > But: RDEPEND doesn't have to be evaluated before installing the package and
92 > DEPEND doesn't contain this package. So, there is no record of such a
93 > package. What now?
94 tbh, I don't get what you are on about.
95 The slot restrictions only matter in cases where a rebuild what be
96 required, because the package would break, if you change the installed
97 slot. But in that case the dep affects runtime and should be in DEPEND.
98 For runtime-only deps, the package manager should be allowed to change
99 the slot, if multiple slots are allowed.
100
101 >> Regarding the || ( cat/bar:2 cat/bar:3 ) construction, if a package
102 >> manager chooses one out of the two, it should restrict the package to
103 >> this dep at runtime.
104 > Hmm, this is the point: What happens if the package chooses cat/bar:2 to
105 > link against and the package manager records cat/bar:3 since it assumes
106 > this is the better match? Is it it allowed to do the following (it's an
107 > example):
108 >
109 > DEPEND="|| ( sys-libs/db:4.5 sys-libs/db:4.6 )"
110 >
111 > pkg_setup() {
112 > DB_VER=""
113 > # both major versions work but prefer 4.5 if available
114 > has_version "sys-libs/db:4.5" && DB_VER="4.5"
115 > }
116 >
117 > Questions:
118 > a) should DEPEND be valid?
119 > b) will has_version evaluate to true?
120 > c) how will the pm know that the package chose sys-libs/db:4.5
121 > d) should this be allowed or not?
122 > e) if yes, can the package tell the pm about the choice?
123 That would (in my opinion) a bug in the ebuild.
124 You handle only the case where db:4.5 is available and not the other case.
125 Nevertheless, I think what we might need here is something like a reference.
126 For example, there could be a tag introduced.
127 ||[db] ( sys-libs/db:4.5 sys-libs/db:4.6 )
128
129 and then:
130 if_pulled db[1] && DB_VER="4.5"
131 if_pulled db[2] && DB_VER="4.6"
132
133 Then, if the package manager restricts || ( ) constructions to the
134 selected dep, you would have a way to ensure, that the correct dep is
135 installed.
136 Tbh, the whole "check-if-a-package-(version)-is-installed" thing is a
137 bit of a hack.
138
139 >>> I think that problem a) is a bit nasty, but it might become better if
140 >>> we'd split the dependency variables into DEPEND, RDEPEND, C(OMMON_)DEPEND
141 >>> (where the last one would be used for packages needed at compile time and
142 >>> runtime).
143 >> I would rather vote for labels, which clear the whole dependency thing
144 >> up a bit and doesn't splatter them over several vars.
145 >> Unfortunately that is not compatible with the current way of specifying
146 >> deps.
147 >
148 > Labels as proposed by kdebuild-1 are only for PDEPEND, right?
149 Yes, because kdebuild-1 uses the gentoo way of specifying deps (DEPEND,
150 RDEPEND etc.).
151 But labels in general aren't restricted to PDEPEND.
152 Actually labels (if fully implemented) obsolete DEPEND, RDEPEND etc.
153 See https://bugs.gentoo.org/show_bug.cgi?id=201499#c21 for an example.
154
155 The result is, that it is better readable and gives more possibilities.
156 --
157 gentoo-dev@l.g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Re: Re: Multislot dependencies Enrico Weigelt <weigelt@×××××.de>