Re: Re: news item: Introduction of app-alternatives/coreutils

Ulrich Müller <[email protected]>
Newsgroups gmane.linux.gentoo.devel
Message-ID <[email protected]>
>>>>> On Mon, 23 Mar 2026, moltonel 3x Combo wrote:

> AFAIU, switching using a virtual would require
> * Switching USE flags on the two coreutils packages
> * A reemerge of FooUtils to disown the unprefixed binaries/symlinks
>   Using the UNINSTALL_IGNORE+pkg_postint trick to avoid breaking the system
> * An emerge of BarUtils to own the unprefixed binaries/symlinks
>   Dutifully ignoring the file collision warning
> * A few minutes of compilation each time
> * More complex logic in both coreutil ebuilds
> * Even users never switching will need a one-off recompile of gnu coreutils

That's not at all what I had suggested. With my suggestion the original
coreutils would not be changed at all, only uutils would get a use flag
to make it install the symlinks (and enable the blocker). You won't get
any file collision that way. See below.

And really, compilation time as an argument? When uutils depends on
Rust, which has at least an order of magnitude longer compile time than
coreutils?

Anyway, I've actually tested things, with the following two packages
(here I've omitted the boring boilerplate parts from the ebuilds):

,----[ app-misc/foo-1 ]
| RDEPEND="!app-misc/prefixed-foo[symlinks]"
| src_install() {
| 	insinto /usr/share/foo
| 	newins - foo <<< 'foo'
| }
`----

,----[ app-misc/prefixed-foo-1 ]
| IUSE="symlinks"
| RDEPEND="symlinks? ( !app-misc/foo )"
| src_install() {
| 	insinto /usr/share/foo
| 	newins - prefixed-foo <<< 'prefixed foo'
| 	use symlinks && dosym prefixed-foo /usr/share/foo/foo
| }
`----

Let's first install the two packages in parallel, without any symlinks:

   # emerge -1 -v app-misc/foo app-misc/prefixed-foo
   ...
   [ebuild  N     ] app-misc/foo-1::local  0 KiB
   [ebuild  N     ] app-misc/prefixed-foo-1::local  USE="-symlinks" 0 KiB

   Total: 1 package (1 new), Size of downloads: 0 KiB
   ...
   
   >>> Emerging (1 of 2) app-misc/foo-1::local
   ...
   >>> Installing (1 of 2) app-misc/foo-1::local
    * checking 1 files for package collisions
   >>> Merging app-misc/foo-1 to /
   --- /usr/
   --- /usr/share/
   >>> /usr/share/foo/
   >>> /usr/share/foo/foo
   >>> app-misc/foo-1 merged.
   ...

   >>> Emerging (2 of 2) app-misc/prefixed-foo-1::local
   ...
   >>> Installing (2 of 2) app-misc/prefixed-foo-1::local
    * checking 1 files for package collisions
   >>> Merging app-misc/prefixed-foo-1 to /
   --- /usr/
   --- /usr/share/
   --- /usr/share/foo/
   >>> /usr/share/foo/prefixed-foo
   >>> app-misc/prefixed-foo-1 merged.
   ...

Now let's enable symlinks for prefixed-foo:

   # USE=symlinks emerge -1 -v app-misc/prefixed-foo
   ...
   [ebuild   R    ] app-misc/prefixed-foo-1::local  USE="symlinks*" 0 KiB
   [uninstall     ] app-misc/foo-1::local 
   [blocks b      ] app-misc/foo ("app-misc/foo" is soft blocking app-misc/prefixed-foo-1)
   [blocks b      ] app-misc/prefixed-foo[symlinks] ("app-misc/prefixed-foo[symlinks]" is soft blocking app-misc/foo-1)

   Total: 1 package (1 reinstall, 1 uninstall), Size of downloads: 0 KiB
   Conflict: 2 blocks (all satisfied)
   ...

   >>> Emerging (1 of 1) app-misc/prefixed-foo-1::local
   ...
   >>> Installing (1 of 1) app-misc/prefixed-foo-1::local
    * checking 2 files for package collisions
   >>> Merging app-misc/prefixed-foo-1 to /
   --- /usr/
   --- /usr/share/
   --- /usr/share/foo/
   === /usr/share/foo/prefixed-foo
   >>> /usr/share/foo/foo -> prefixed-foo
   >>> Safely unmerging already-installed instance...
   --- replaced obj /usr/share/foo/prefixed-foo
   --- replaced dir /usr/share/foo
   --- replaced dir /usr/share
   --- replaced dir /usr
   >>> Original instance of package unmerged safely.
   >>> app-misc/prefixed-foo-1 merged.
   ...

   >>> Uninstalling app-misc/foo-1::local
   ...
   >>> Unmerging app-misc/foo-1...
   ...

The (soft) blocker does what it is supposed to do, and there are no file
collisions. Now let's emerge the original foo again:

   # emerge -1 -v app-misc/foo
   ...
   [ebuild  N     ] app-misc/foo-1::local  0 KiB
   [uninstall     ] app-misc/prefixed-foo-1::local  USE="symlinks" 
   [blocks b      ] app-misc/prefixed-foo[symlinks] ("app-misc/prefixed-foo[symlinks]" is soft blocking app-misc/foo-1)
   [blocks b      ] app-misc/foo ("app-misc/foo" is soft blocking app-misc/prefixed-foo-1)

   Total: 1 package (1 new, 1 uninstall), Size of downloads: 0 KiB
   Conflict: 2 blocks (all satisfied)
   ...

   >>> Emerging (1 of 1) app-misc/foo-1::local
   ...
   >>> Installing (1 of 1) app-misc/foo-1::local
    * checking 1 files for package collisions
   >>> Merging app-misc/foo-1 to /
   --- /usr/
   --- /usr/share/
   --- /usr/share/foo/
   >>> /usr/share/foo/foo
   >>> app-misc/foo-1 merged.
   ...

   >>> Uninstalling app-misc/prefixed-foo-1::local
   ...
   >>> Unmerging app-misc/prefixed-foo-1...
   <<<          obj /usr/share/foo/prefixed-foo
   --- !empty   dir /usr/share/foo
   --- !empty   dir /usr/share
   --- !empty   dir /usr

Again, everything went smoothly, and no file collisions happened.
signature.asc (application/pgp-signature, 544 B)
-----BEGIN PGP SIGNATURE-----

iQFfBAEBCABJFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmnCnM0bFIAAAAAABAAO
bWFudTIsMi41KzEuMTIsMiwyDxx1bG1AZ2VudG9vLm9yZwAKCRBRiDNQiEFeLmIo
CACXJgIhh0ZP15YSDGa6PF9RpC2J/dVhTTNB0wBof6tnaxgGE9VLA48xsz6Cobyb
iklcooa+qNAudPDNHDXvcyIndpsjJxBjolB4tmGmYWXjOBfE9vNPfcvkgUsprWx7
Zr8WuUlfUTnzTnLynpKV8TEf89VGbwGCUd0mQhI+BLLbeDqW7QTqR8LQpqkrA+3+
ZGUBP+Zp+oXBe6P56GTUy0bxnTbQAt7LV0pcng9DdiD5eiHz3JSnBuOutOE6zBHk
mr8rTUnN0tO8ec7c9/aGfGP12ACvqD9E1R353OCWdd6k1ry3Yr/WIJUXvMPw4PB2
vfW9oWfU+xizcJ+pLOO9SU1q
=J9D7
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.