From: michael.lienhardt@laposte.net
To: Zac Medico <zmedico@gentoo.org>
Cc: gentoo-portage-dev@lists.gentoo.org
Subject: Re : Re: [gentoo-portage-dev] precisions on installed packages' dependencies
Date: Mon, 23 Mar 2020 23:21:15 +0100 (CET) [thread overview]
Message-ID: <869515804.6231453.1585002075418.JavaMail.zimbra@laposte.net> (raw)
In-Reply-To: <2f3e382c-67d5-3bc5-e1c0-8df1c8b5f7ab@gentoo.org>
----- Zac Medico <zmedico@gentoo.org> a écrit :
> > 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.
>
> That's true if the package is removed via emerge --depclean, but emerge
> --unmerge does not account for dependencies.
>
> Also, it's possible for dependencies of installed packages to be
> temporarily broken by upgrades. In cases like this, the breakage will
> eventually be resolved by a rebuild (which occurs automatically for slot
> operator := deps), upgraded, or by emerge --depclean (which removes
> unneeded packages).
Many thanks for your answers.
They made me realize that the problem I'm facing is a bit more tricky than I first quickly though.
I'll try to explain the problem, tell me if I'm not clear somewhere.
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).
It seems that installed packages do not store which are the actual cpv they depend on. Correct?
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).
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).
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).
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).
Hence, for my tool, I have two solutions for that problem: either I forbid for dependencies to ever be broken, or I allow it.
Solution 1: forbid broken dependencies.
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).
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".
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.
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.
Solution 2: allow broken dependencies.
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.
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".
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).
Also, I wanted to use the ebuild tool to install/uninstall package, which is not possible with this solution apparently.
In case I need to implement this, could you give me some clue on how to achieve it?
Among these two solutions, I prefer the first one: we stay at the level of package dependencies (and it looks simpler to implement).
However, it is maybe easier/better to use the second approach, I don't know.
Do you have some suggestions?
Thanks!
Michael
next prev parent reply other threads:[~2020-03-23 22:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 0:38 [gentoo-portage-dev] precisions on installed packages' dependencies michael.lienhardt
2020-03-23 1:01 ` Zac Medico
2020-03-23 22:21 ` michael.lienhardt [this message]
2020-03-24 4:13 ` Re : " Zac Medico
2020-03-24 18:31 ` michael.lienhardt
2020-03-26 8:06 ` Alec Warner
2020-03-27 13:59 ` michael.lienhardt
2020-03-28 6:48 ` Alec Warner
2020-03-30 21:55 ` michael.lienhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=869515804.6231453.1585002075418.JavaMail.zimbra@laposte.net \
--to=michael.lienhardt@laposte.net \
--cc=gentoo-portage-dev@lists.gentoo.org \
--cc=zmedico@gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox