Gentoo Archives: gentoo-portage-dev

From: michael.lienhardt@×××××××.net
To: Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re : Re: [gentoo-portage-dev] precisions on installed packages' dependencies
Date: Mon, 23 Mar 2020 22:21:26
Message-Id: 869515804.6231453.1585002075418.JavaMail.zimbra@laposte.net
In Reply to: Re: [gentoo-portage-dev] precisions on installed packages' dependencies by Zac Medico
1 ----- Zac Medico <zmedico@g.o> a écrit :
2
3 > > 3. before removing a library, "ebuild unmerge" always checks if it is used by another package: this means that installed packages' dependencies are never broken.
4 >
5 > That's true if the package is removed via emerge --depclean, but emerge
6 > --unmerge does not account for dependencies.
7 >
8 > Also, it's possible for dependencies of installed packages to be
9 > temporarily broken by upgrades. In cases like this, the breakage will
10 > eventually be resolved by a rebuild (which occurs automatically for slot
11 > operator := deps), upgraded, or by emerge --depclean (which removes
12 > unneeded packages).
13
14 Many thanks for your answers.
15 They made me realize that the problem I'm facing is a bit more tricky than I first quickly though.
16
17 I'll try to explain the problem, tell me if I'm not clear somewhere.
18
19 The goal of my tool is to have correct manipulation of package dependencies, and in particular here, I focus on the packages that are installed but not in the portage tree/a local overlay anymore (the problem does not occur for other packages).
20 It seems that installed packages do not store which are the actual cpv they depend on. Correct?
21 Hence, when an installed package cannot be updated/recompiled because it is not in the tree anymore, like you said, its dependencies can be broken (due to the package it depends on being updated).
22 Currently, this issue is circumvented (only using depclean) by keeping the libs: the package's dependencies are broken, but it's ok because it can still run (which, in the end of the day, is what we want).
23 However, from your answer, it seems that this fix is not entirely integrated in the emerge/portage toolchain (like you said, emerge --unmerge removes everything, and emerge -u removes the old libs).
24
25 To sum up, the problem I'm facing is that with the current way installed packages are managed, we can break dependencies (and the only way to fix them is to remove the installed package with the broken dependencies, that can never be installed again).
26
27 Hence, for my tool, I have two solutions for that problem: either I forbid for dependencies to ever be broken, or I allow it.
28
29 Solution 1: forbid broken dependencies.
30 This requires to extend the information stored on installed package with the list of the actual cpvs they depend (or at least the cp+slot, which is enough to get back the cpvs).
31 That way, I can say in the solver "if you want to keep that package, you need to keep these packages as they currently are".
32 However, I have no idea on how to do that, and doing this only for my tool would mean that one cannot switch between emerge (quick) and my tool (correct), which is a feature I think is essential.
33 Do you think adding this new information to installed packages could be integrated into emerge/portage itself? I could work on it (expect question ^^), test it on my prototype, and do a pull request when everything's working.
34
35 Solution 2: allow broken dependencies.
36 Here, the idea is to use the same fix as is currently done with depclean, but in my tool's planner (i.e., the part that install/unistall the packages) directly.
37 That way, I say in the solver "that installed package has no dependency", but when I upgrade/remove packages, I say "Oh but wait, that other package still need these libs, let's keep them".
38 This solution may not require any change in portage/emerge, but I have no idea on how to know which libs are needed by a package, and how to track these libs owners without looking at every installed package's files (which are stored in the CONTENT file, if I'm not mistaken).
39 Also, I wanted to use the ebuild tool to install/uninstall package, which is not possible with this solution apparently.
40 In case I need to implement this, could you give me some clue on how to achieve it?
41
42
43 Among these two solutions, I prefer the first one: we stay at the level of package dependencies (and it looks simpler to implement).
44 However, it is maybe easier/better to use the second approach, I don't know.
45 Do you have some suggestions?
46
47 Thanks!
48 Michael

Replies