Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: michael.lienhardt@×××××××.net, Zac Medico <zmedico@g.o>
Cc: gentoo-portage-dev@l.g.o
Subject: Re: Re : Re: [gentoo-portage-dev] precisions on installed packages' dependencies
Date: Tue, 24 Mar 2020 04:14:05
Message-Id: 518e57d9-423c-99ee-91c1-c591dec902be@gentoo.org
In Reply to: Re : Re: [gentoo-portage-dev] precisions on installed packages' dependencies by michael.lienhardt@laposte.net
1 On 3/23/20 3:21 PM, michael.lienhardt@×××××××.net wrote:
2 > ----- Zac Medico <zmedico@g.o> a écrit :
3 >
4 >>> 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.
5 >>
6 >> That's true if the package is removed via emerge --depclean, but emerge
7 >> --unmerge does not account for dependencies.
8 >>
9 >> Also, it's possible for dependencies of installed packages to be
10 >> temporarily broken by upgrades. In cases like this, the breakage will
11 >> eventually be resolved by a rebuild (which occurs automatically for slot
12 >> operator := deps), upgraded, or by emerge --depclean (which removes
13 >> unneeded packages).
14 >
15 > Many thanks for your answers.
16 > They made me realize that the problem I'm facing is a bit more tricky than I first quickly though.
17 >
18 > I'll try to explain the problem, tell me if I'm not clear somewhere.
19 >
20 > 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).
21 > It seems that installed packages do not store which are the actual cpv they depend on. Correct?
22
23 Right, because unfortunately that's something that changes over time.
24
25 Also, we may not be able to pin it down at any given moment if we have
26 inconsistent || preferences as described here:
27
28 https://archives.gentoo.org/gentoo-dev/message/550d3859dea6d0fb0b39064628992634
29
30 > 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).
31 > 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).
32 > 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).
33 >
34 > 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).
35 >
36 > Hence, for my tool, I have two solutions for that problem: either I forbid for dependencies to ever be broken, or I allow it.
37 >
38 > Solution 1: forbid broken dependencies.
39 > 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).
40 > 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".
41 > 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.
42 > 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.
43
44 It's possible to store this information in a cache of the most recently
45 calculated dependency graph.
46
47 > Solution 2: allow broken dependencies.
48 > 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.
49 > 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".
50 > 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).
51
52 For soname dependencies, we've got PROVIDES and REQUIRES metadata.
53
54 > Also, I wanted to use the ebuild tool to install/uninstall package, which is not possible with this solution apparently.
55
56 Why not? Would the preserve-libs feature solve your problem?
57
58 > In case I need to implement this, could you give me some clue on how to achieve it?
59 >
60 >
61 > Among these two solutions, I prefer the first one: we stay at the level of package dependencies (and it looks simpler to implement).
62 > However, it is maybe easier/better to use the second approach, I don't know.
63 > Do you have some suggestions?
64
65 Well, there are a lot of upgrades that can't be performed without
66 temporarily breaking something, so the "forbid broken dependencies" idea
67 doesn't sound feasible to me.
68
69 > Thanks!
70 > Michael
71 --
72 Thanks,
73 Zac

Attachments

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

Replies

Subject Author
Re: [gentoo-portage-dev] precisions on installed packages' dependencies michael.lienhardt@×××××××.net