Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 924125

Summary: sys-apps/portage - emerge --root=... -e @world rebuilds host packages
Product: Portage Development Reporter: Victor Costache <victor.costache>
Component: CoreAssignee: Portage team <dev-portage>
Status: UNCONFIRMED ---    
Severity: normal CC: chewi, victor.costache, zmedico
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 137867    
Attachments: emerge-aarch64-unknown-linux-gnu
emerge on the host target

Description Victor Costache 2024-02-08 22:13:32 UTC
Created attachment 884575 [details]
emerge-aarch64-unknown-linux-gnu

crossdev version: 20240117

Executing "emerge-aarch64-unknown-linux-gnu -av -e @world" shows that 274 host packages (x86_64-pc-linux-gnu) will be reinstalled and 182 target packages (/usr/aarch64-unknown-linux-gnu/) are new builds (see attached). I don't know whether this is the desired (normal) behavior or a bug. I was expecting only the ARM packages to be built. Please advise. 

It is worth mentioning that before emerging the crossdev package and creating the "aarch64-unknown-linux-gnu" target, I updated the @world packages (emerge -avuDN @world).

I have followed this tutorial: https://wiki.gentoo.org/wiki/Binary_package_guide#Advanced_topics
Comment 1 Victor Costache 2024-02-09 13:16:32 UTC
Created attachment 884604 [details]
emerge on the host target

It's also worth mentioning that "emerge -av -e @world" shows 310 packages to be reinstalled on the host target (see attached). Shouldn't the same packages be built for the target architecture (aarch64-unknown-linux-gnu), considering that both host and target have the same profile "default/linux/amd64/17.1/systemd/merged-usr"?
Comment 2 James Le Cuirot gentoo-dev 2024-02-09 21:39:38 UTC
This is expected because some dependencies are BDEPEND aka build host dependencies, so a) the build host is being updated because it affects the build, and b) these dependencies do not need to be installed to the target host.

Having said that, I have long wanted options to a) not update build dependencies unless it's really necessary (while keeping target host dependencies updated) and b) install build host dependencies to the target host. The options we already have are confusing and inconsistent though because Portage's functionality has outgrown them, so it probably needs a big breaking redesign.
Comment 3 Victor Costache 2024-02-09 22:51:36 UTC
(In reply to James Le Cuirot from comment #2)
> This is expected because some dependencies are BDEPEND aka build host
> dependencies, so a) the build host is being updated because it affects the
> build, and b) these dependencies do not need to be installed to the target
> host.
> 
> Having said that, I have long wanted options to a) not update build
> dependencies unless it's really necessary (while keeping target host
> dependencies updated) and b) install build host dependencies to the target
> host. The options we already have are confusing and inconsistent though
> because Portage's functionality has outgrown them, so it probably needs a
> big breaking redesign.

Thanks for the explanation. I was expecting that might be the reason. However, since the profile (systemd/merged-usr) is the same on both host and target, shouldn't the same packages be built for x86_64 and aarch64? 310 (x86_64) vs. 180 (aarch64) is quite a difference.
Comment 4 Victor Costache 2024-02-10 07:10:01 UTC
I thought that the "systemd/merged-usr" profiles could be different on host (x86_64) and target (aarch64), so I did the following:

1. Clean install Gentoo (x86_64 host), including emaint -a sync && emerge -avuDN @world
2. emerge -av -e @world - Total: 310 packages (310 reinstalls)
3. emerge sys-devel/crossdev
4. emerge -av -e @world - Total: 312 packages (312 reinstalls)
5. Create crossdev overlay (https://wiki.gentoo.org/wiki/Crossdev#Crossdev_overlay)
6. crossdev --stable -t x86_64-unknown-linux-gnu
7. PORTAGE_CONFIGROOT=/usr/x86_64-unknown-linux-gnu eselect profile set 23 ("systemd/merged-usr" profile)
8. emerge-x86_64-unknown-linux-gnu -av -e @world - Total: 456 packages (182 new, 274 reinstalls) - those 182 are for x86_64-unknown-linux-gnu and the other 274 for host

Note that I had to add "sys-apps/util-linux -systemd -udev" to /usr/x86_64-unknown-linux-gnu/etc/portage/package.use to solve the circular dependencies.

Since I got the same results for aarch64-unknown-linux-gnu (182 new, 274 reinstalls), we may conclude it's not related to the profile. Moreover, I was expecting all 310 packages to be built for the target, not just 182.
Comment 5 Victor Costache 2024-02-10 07:51:39 UTC
I noticed that the bug was renamed to "sys-apps/portage - emerge --root=... -e @world".

Related to that, it might be worth considering the output of these two commands:
- emerge --root /new-root -pv -e @world => Total: 467 packages (184 new, 283 reinstalls)
- emerge -pv -e @world => Total: 310 packages (310 reinstalls)

I might be wrong, but shouldn't the output of the first command be "Total: 310 packages (310 new)"?