Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 930974 - sys-apps/baselayout should create bin dirs
Summary: sys-apps/baselayout should create bin dirs
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: usrmerge, usrmerge-fixes
  Show dependency tree
 
Reported: 2024-04-30 11:36 UTC by Étienne Buira
Modified: 2024-05-02 00:50 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Étienne Buira 2024-04-30 11:36:52 UTC
Current sys-apps/baselayouts does not create {,/usr}/{bin,sbin}.

Profile 23.0 expects /bin to be a symlink, or die.

Reproducible: Always

Steps to Reproduce:
1. ROOT=/wherever/ PORTAGE_CONFIGROOT=/wherever/ emerge sys-apps/baselayout @system
2. chroot to /wherever/ and try to merge @world (that includes virtual/editor)
3. Don't know how other packages could be merged, but virtual/editor bails out when sourcing profile 23.0 bashrc
Actual Results:  
emerge fails

Expected Results:  
emerge succeeds

Something like the following should do the trick

mkdir -p "${EROOT}/usr/bin" "${EROOT}/usr/sbin"
if use split-usr; then
    mkdir -p "${EROOT}/bin" "${EROOT}/sbin"
else
    ln -s ../bin "${EROOT}/bin"
    ln -s ../sbin "${EROOT}/sbin"
fi
Comment 1 Étienne Buira 2024-04-30 11:54:36 UTC
(In reply to Étienne Buira from comment #0)
>     ln -s ../bin "${EROOT}/bin"
>     ln -s ../sbin "${EROOT}/sbin"

This obviously should read
ln -s usr/bin "${EROOT}/bin"
ln -s usr/sbin "${EROOT}/sbin"
Comment 2 Mike Gilbert gentoo-dev 2024-05-01 01:37:36 UTC
When setting up a fresh ROOT, you should install sys-apps/baselayout with the "build" USE flag set. This will cause the directories to be created via pkg_postinst.

For example: 

USE=build emerge -v1O --root=/whereever sys-apps/baselayout

Creating the directories in src_install would require the use of the keepdir function, and would just end up creating a pointless .keep file.
Comment 3 Mike Gilbert gentoo-dev 2024-05-01 01:41:44 UTC
(In reply to Mike Gilbert from comment #2)
> This will cause the directories to be created via pkg_postinst.

This actually happens in pkg_preinst, my mistake.
Comment 4 Matt Whitlock 2024-05-01 05:26:41 UTC
(In reply to Mike Gilbert from comment #2)
> When setting up a fresh ROOT, you should install sys-apps/baselayout with
> the "build" USE flag set.

One annoyance with doing that is then your first `emerge -uDU @world` is going to want to remerge sys-apps/baselayout with USE="-build". Seems as though one-off functionality like this ought to be invoked via pkg_config() rather than toggled by a USE flag, except that's not possible since pkg_config() requires that the package is already installed before it can be run. It might be nice if we had a pkg_prepare() phase function akin to src_prepare() but to prepare the target ROOT outside of the normal build cycle. Or maybe one-off functionality in pkg_preinst() simply ought to be controlled by an environment variable rather than by a USE flag.
Comment 5 Mike Gilbert gentoo-dev 2024-05-01 19:50:20 UTC
(In reply to Matt Whitlock from comment #4)
> One annoyance with doing that is then your first `emerge -uDU @world` is
> going to want to remerge sys-apps/baselayout with USE="-build".

baselayout is a trivially small package, so rebuilding it seems like a non-issue to me.

That said, we could potentially adjust baselayout so that the steps performed by USE=build can be instead be executed based on the current contents of ${ROOT}, or even unconditionally.
Comment 6 Étienne Buira 2024-05-01 22:23:59 UTC
(In reply to Mike Gilbert from comment #5)
> (In reply to Matt Whitlock from comment #4)
> > One annoyance with doing that is then your first `emerge -uDU @world` is
> > going to want to remerge sys-apps/baselayout with USE="-build".
> 
> baselayout is a trivially small package, so rebuilding it seems like a
> non-issue to me.
> 
> That said, we could potentially adjust baselayout so that the steps
> performed by USE=build can be instead be executed based on the current
> contents of ${ROOT}, or even unconditionally.

It still can scare to rebuild a 'base' package.

However, i vote for build use-flag removal, as it is a weird one (but thank you Mike for the trick). Executing depending on what is found seems the most sensible way (then, removing rm -fr /bin /sbin /usr/sbin [or trying a simple unlink] from layout-usrmerge target)

OT: if someone is more in mood to add a useflag, a couple could be of use #916244
Comment 7 Matt Whitlock 2024-05-02 00:50:52 UTC
(In reply to Mike Gilbert from comment #5)
> baselayout is a trivially small package, so rebuilding it seems like a
> non-issue to me.

Right, I agree in the case of baselayout, but my comments apply more generally to the several packages in the tree that have IUSE="build". It just seems like "there ought to be a better way."