Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 832089 - emerge: add an option to skip pkg_pretend
Summary: emerge: add an option to skip pkg_pretend
Status: CONFIRMED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal enhancement (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 835380
  Show dependency tree
 
Reported: 2022-01-26 08:36 UTC by SpanKY
Modified: 2022-03-16 00:58 UTC (History)
1 user (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 SpanKY gentoo-dev 2022-01-26 08:36:12 UTC
so far, pretty much every pkg_pretend use in the tree can be categorized into:
* filesystem size checks
* USE flag checks
* kernel config checks

in CrOS, none of these things matter.  in general, when cross-compiling, or doing large image building (i.e. in a CI environment), these things aren't that useful.  that means running all the pkg_pretend phases up front before actually merging things slows down the overall build with no gain.

can we add a --skip-pkg-pretend or similar option to emerge ?  we've just patched the portage code to return immediately in the pkg_pretend phase.
Comment 1 Alec Warner (RETIRED) archtester gentoo-dev Security 2022-01-26 21:06:11 UTC
(In reply to SpanKY from comment #0)
> so far, pretty much every pkg_pretend use in the tree can be categorized
> into:
> * filesystem size checks
> * USE flag checks
> * kernel config checks
> 
> in CrOS, none of these things matter.  in general, when cross-compiling, or
> doing large image building (i.e. in a CI environment), these things aren't
> that useful.  that means running all the pkg_pretend phases up front before
> actually merging things slows down the overall build with no gain.
> 
> can we add a --skip-pkg-pretend or similar option to emerge ?  we've just
> patched the portage code to return immediately in the pkg_pretend phase.

I was hoping bashrc would  handle it, but at first glance it appears to be sourced before ebuilds (not after.)

If we look at phase-functions.sh:

__dyn_pretend() {
        if [[ -e $PORTAGE_BUILDDIR/.pretended ]] ; then
                __vecho ">>> It appears that '$PF' is already pretended; skipping."
                __vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend."
                return 0
        fi
        __ebuild_phase pre_pkg_pretend
        __ebuild_phase pkg_pretend
        >> "$PORTAGE_BUILDDIR/.pretended" || \
                die "Failed to create $PORTAGE_BUILDDIR/.pretended"
        __ebuild_phase post_pkg_pretend
}

You could try to use your bashrc to arrange for '$PORTAGE_BUILDDIR/.pretended' to exist, and then it would skip the phase, right?

You'd be carrying a bashrc instead of a patch; not sure if one is better vs the other?

-A
Comment 2 SpanKY gentoo-dev 2022-01-27 00:48:07 UTC
(In reply to Alec Warner from comment #1)

unfortunately that wouldn't suffice to fix the pipeline bubble.  portage fetches the binpkgs & runs the pkg_pretend steps before moving on to the next set of steps.  hacking it at the bashrc step would require those fetches to finish.

by nerfing the entire step in portage, we can go back to fetching & installing binpkgs in parallel.
Comment 3 Alec Warner (RETIRED) archtester gentoo-dev Security 2022-01-27 17:06:26 UTC
(In reply to SpanKY from comment #2)
> (In reply to Alec Warner from comment #1)
> 
> unfortunately that wouldn't suffice to fix the pipeline bubble.  portage
> fetches the binpkgs & runs the pkg_pretend steps before moving on to the
> next set of steps.  hacking it at the bashrc step would require those
> fetches to finish.
> 
> by nerfing the entire step in portage, we can go back to fetching &
> installing binpkgs in parallel.

Ah I was confused you had said you had 'patched emerge to return in the pkg_pretend phase' so I was looking for a similar less-patchy method.

Can you attach your patch so we can see what you are currently using?

Does your patch also solve for the above case where it blocks fetches running your empty pkg_pretend?

-A
Comment 4 SpanKY gentoo-dev 2022-01-28 07:46:11 UTC
(In reply to Alec Warner from comment #3)

i don't give it a chance to run any code at all, so there are no pipeline issues

https://chromium.googlesource.com/chromiumos/third_party/portage_tool/+/dd1033474678f08f981e53afb24221654c1f8ff3%5E%21/#F0

it's very much a hack that works for us in CrOS, but obviously doesn't make sense upstream as-is