Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 772380 - sys-apps/portage: implement an ebuild generator for "ebins" which are inspired by paludis "pbins" and IUSE_RUNTIME (GLEP 62)
Summary: sys-apps/portage: implement an ebuild generator for "ebins" which are inspire...
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Binary packages support (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL: https://archives.gentoo.org/gentoo-de...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-02-24 11:53 UTC by Zac Medico
Modified: 2022-07-19 00:07 UTC (History)
2 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 Zac Medico gentoo-dev 2021-02-24 11:53:47 UTC
The idea is to implement an ebuild generator which combines the ideas of IUSE_RUNTIME (GLEP 62) and paludis "pbins" (https://paludis.exherbo.org/overview/pbins.html). The generated ebuilds are dubbed "ebins" because they are inspired by paludis "pbins". IUSE_RUNTIME is interesting because it offers the possibility for binhost users to modify the runtime USE configuration of binary packages.

The idea for ebins is to go further than IUSE_RUNTIME, and allow binhost users to modify both runtime and buildtime USE flags for binary packages. In order to do this, each ebin will use SRC_URI metadata to index pre-built content for multiple combinations of USE flags. For example, for 3 USE flags, up to 8 combinations will be indexed. Things like installsources and splitdebug can be split out into separate distfiles for each of the 8 combinations:

IUSE="a b c installsources splitdebug"
SRC_URI="
  !a? !b? !c? ( ( ( mirror://binhost/24fe6bd377 ) ) )
  !a? !b?  c? ( ( ( mirror://binhost/fbe14cbb02 ) ) )
  !a?  b? !c? ( ( ( mirror://binhost/1dfff1f2ac ) ) )
  !a?  b?  c? ( ( ( mirror://binhost/ae60f2940d ) ) )
   a? !b? !c? ( ( ( mirror://binhost/2976e1acc0 ) ) )
   a? !b?  c? ( ( ( mirror://binhost/f4809db70c ) ) )
   a?  b? !c? ( ( ( mirror://binhost/ecd08466cf ) ) )
   a?  b?  c? ( ( ( mirror://binhost/0c00f33b2e ) ) )
  installsources? (
    !a? !b? !c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
    !a? !b?  c? ( ( ( mirror://binhost/f67c311625 ) ) )
    !a?  b? !c? ( ( ( mirror://binhost/1dfff1f2ac ) ) )
    !a?  b?  c? ( ( ( mirror://binhost/17a673e16a ) ) )
     a? !b? !c? ( ( ( mirror://binhost/914d1cecfe ) ) )
     a? !b?  c? ( ( ( mirror://binhost/ca18d86a2b ) ) )
     a?  b? !c? ( ( ( mirror://binhost/6bce13471a ) ) )
     a?  b?  c? ( ( ( mirror://binhost/3a6bdcd228 ) ) )
  )
  splitdebug? (
    !a? !b? !c? ( ( ( mirror://binhost/29b2f38c41 ) ) )
    !a? !b?  c? ( ( ( mirror://binhost/8adc9bef51 ) ) )
    !a?  b? !c? ( ( ( mirror://binhost/954d2ce484 ) ) )
    !a?  b?  c? ( ( ( mirror://binhost/32a614aaca ) ) )
     a? !b? !c? ( ( ( mirror://binhost/3548a2302d ) ) )
     a? !b?  c? ( ( ( mirror://binhost/e0c02cdc88 ) ) )
     a?  b? !c? ( ( ( mirror://binhost/f9cbd3c181 ) ) )
     a?  b?  c? ( ( ( mirror://binhost/31d4c03474 ) ) )
  )
"

The pre-built content can be stored in a content-hash distfiles mirror layout, like the one implemented for bug 756778. For installsources, we can automate deduplication, so that we can distribute the same file content for multiple USE combinations when appropriate. If all of the combinations have identical content, then they will look like this:

  installsources? (
    !a? !b? !c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
    !a? !b?  c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
    !a?  b? !c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
    !a?  b?  c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
     a? !b? !c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
     a? !b?  c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
     a?  b? !c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
     a?  b?  c? ( ( ( mirror://binhost/063a14d6c7 ) ) )
  )

In order to ensure that an ebin is not selected for a USE combination that has not been built yet, combinations for existing builds will be listed in REQUIRED_USE:

REQUIRED_USE="
|| (
  ( !a !b !c )
  ( !a !b  c )
  ( !a  b !c )
  ( !a  b  c )
  (  a !b !c )
  (  a !b  c )
  (  a  b !c )
  (  a  b  c )
)
"

 Once we have designed an ebin generation process that we're happy with, we should consider making it part of an EAPI, so that package managers can generate "ebins" on request. The EAPI should include ways to split out files and distribute them separately based on USE flags, so that binhost users can easily filter which files are installed based on chosen USE configuration.
Comment 1 Zac Medico gentoo-dev 2021-02-24 12:25:08 UTC
The ebuild generator script can take an existing $PKGDIR or unpacked image directory (like a stage3) as input, and generate an "ebin" binhost as output. It will automatically split out pre-built content bundles for installsources and splitdebug as shown in comment #0. If there is more than one build for a particular package version and USE combination, then the script will choose the package instance with latest BUILD_TIME metadata (in alignment with FEATURES=binpkg-multi-instance).
Comment 2 Zac Medico gentoo-dev 2021-02-28 17:49:26 UTC
For the ebuild environment used to execute ebin pkg_setup and pkg_preinst phases, we should use the regular environment.bz2 from the binary package that was built for the corresponding USE combination. The environment.bz2 will come from an xpak or gkpkg format bundle. The installsources and splitdebug bundles can also be formatted as xpak or gkpkg, in order to carry metadata (they don't need to carry environment.bz2).
Comment 3 Zac Medico gentoo-dev 2021-03-18 19:47:48 UTC
In order to obtain the closest possible build USE match, it would be useful for emerge to score binary packages based on how much their USE configuration differs from the local USE configuration. We can use difflib to implement this, in the same way as emerge --search uses it to implement fuzzy search.