Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] Guidelines for using slot and sub-slot dependencies
Date: Wed, 16 Oct 2013 12:59:52
Message-Id: 20131016145945.018434e4@gentoo.org
1 Hello, all.
2
3 Considering the past experiences wrt slot, sub-slot and slot operator
4 dependencies, I'd like to write some kind of guidelines for using them.
5 I'd like to know your opinion on my 'draft' and possibly someone more
6 fluent in English to put them somewhere on the Wiki.
7
8
9 First of all, please remember that slots and sub-slots are just generic
10 tools. How they end up being used is up to the maintainer's discretion.
11 Therefore, always check how the package is slotted and sub-slotted
12 before depending on it. If it doesn't use sub-slots yet, use your
13 common sense or -- when in doubt -- ask the maintainer.
14
15 The goal of slot (and rarely sub-slot) dependencies is to limit
16 the number of package versions that can satisfy a dependency. The goal
17 of slot operator is to bind the package to the currently installed
18 version of a dependency and rebuild it when uninstalling that version.
19
20 So, the following questions need to be answered:
21
22 1. can any (current or possibly future) version of the package satisfy
23 your dependency?
24
25 2. does your package need to rebuilt when slot/sub-slot changes?
26
27 Of course, the answers depend on what exact purpose slots
28 and sub-slots serve on a package.
29
30
31 1. You almost always want to depend on a specific slot of a library.
32
33 This came up during the multilib work. If we are to support prebuilt
34 binary software, we need to be able to install the specific versions of
35 dependent libraries. As a result, so-called binary-only (runtime,
36 compat) slots are introduced.
37
38 An example of this is media-video/ffmpeg. It has a :0 slot that
39 corresponds to a complete ffmpeg install, and a :0.10 slot that
40 installs the libraries only. So every package that is being built
41 against ffmpeg, need to depend on slot :0.
42
43 It is likely that many more packages will grow binary-only slots
44 in the future. Therefore, it seems reasonable to depend on slot :0
45 (or a similar single slot) already.
46
47 Please specifically note that this not only applies to linking to
48 a library but also to using the tools provided by it during run-time.
49 So if your package uses 'ffmpeg' command-line tool, and depends on
50 'media-video/ffmpeg', portage will be able to uninstall the 'ffmpeg'
51 executable and leave your package silently broken.
52
53
54 2. You most often want := deps when linking to libraries.
55
56 Just check first how the library is sub-slotted. The commonly repeated
57 example, app-text/poppler, uses sub-slot for its low-level library
58 only. The high-level libraries that most programs use have stable APIs
59 and aren't supposed to have := deps.
60
61 If a particular package does not use sub-slots yet, use your common
62 sense. If it installs a single library only, you can use := dep. If it
63 installs libraries that changes their ABIs in approximately same
64 intervals, you can use the := dep.
65
66 Please remember to combine this with (1), so you'll often have :0=
67 as the actual dep.
68
69
70 3. You *can* depend on a specific sub-slot.
71
72 Most people seem not to know that but you can depend on sub-slots
73 the same way you depend on slots. This makes it possible to have
74 sub-slot versioned virtuals.
75
76 For example, virtual/udev-206-r3 (sub-slot 0) depends on:
77
78 || ( ...
79 >=sys-apps/systemd-206:0/1[...]
80 >=sys-apps/systemd-206:0/0[...]
81 )
82
83 which means that systemd sub-slots 1 & 0 have the same ABI of libudev.
84 Packages can depend on virtual/udev:= and expect the rebuild to be
85 propagated.
86
87
88 4. You *can not* trust portage's --dynamic-deps anymore.
89
90 This one is fairly important. In the past, we often assumed that
91 portage will 'update' deps from ebuilds automatically. This is no
92 longer correct if sub-slots are used -- since portage simply can't know
93 which sub-slot of the dependency was used to build the package.
94
95 This makes the point (1) above pretty important (see: the python-exec:2
96 issues). Since we don't have any proper tools to update dependencies of
97 installed packages (there's a future-eapi bug for that [1]), we need to
98 try harder to get them right.
99
100 [1]:https://bugs.gentoo.org/show_bug.cgi?id=486778
101
102 --
103 Best regards,
104 Michał Górny

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies