On Wed, Dec 18, 2019 at 1:55 PM Neil Bothwick <n...@digimed.co.uk> wrote:
>
> On Wed, 18 Dec 2019 19:24:03 +0100, tu...@posteo.de wrote:
>
> > What is the mechanism and how does it work, which
> > cares, that a certain package of a certain version
> > gets installed only once?
>
> The package database is at /var/db/pkg
>

It is probably worth noting that there really isn't anything
preventing a package from being re-installed over the same version of
itself.  Portage shouldn't generally try to do this unless there is
some reason to rebuild it (slot op dep change/etc).  However, you can
force it to do so (harmlessly) at any time just by running emerge -1
<atom>.

In general when a package is installed and another package exists in
the same slot (whether the same version or not), first portage
installs the new package, and then it removes the old version.
However, portage tracks files by hash and modification date so when it
goes to remove the old package, any files that were overwritten by the
new package will no longer match, and thus will not be removed.  Any
files installed by the old version which were not overwritten by the
new version (which could be the same version) will get removed.  This
also allows updates to system/toolchain/etc packages in-place without
too much disruption to running processes (obviously already open files
are unaffected regardless due to unix mechanics, but you could get
race conditions with files that aren't actually open if it were done
the other way around).

-- 
Rich

Reply via email to