• [gentoo-dev] Portage and languages with built-in cache support

    From Anna (cybertailor) Vyalkova@21:1/5 to All on Tue Apr 25 10:10:01 2023
    Hello,

    Portage can use ccache and sccache to speed up builds, but some
    languages (like Go and Nim) support caches out-of-the-box. It's not fair
    that we can't use them.

    I'd like to start discussion on this topic. What should be the preferred
    method of handling build caches?

    I think adding more stuff to Portage is a bad idea, and caches should be handled by corresponding "${lang}-utils" eclasses. It can be as simple
    as checking some variable, passing necessary flags and placing a couple
    of 'addwrite' calls for sandbox.

    Of course, such feature needs to be strictly opt-in.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anna (cybertailor) Vyalkova@21:1/5 to All on Wed Apr 26 15:50:01 2023
    On 2023-04-25 16:09, Maciej Barć wrote:
    You would also have to have correct permissions on cache dirs
    (root:portage or portage:portage) this also means that the cache dir
    will have to be set during build explicitly.
    Do both Nim and Go support setting it?

    Yes. For Nim it would be something like that:

    # nim.cfg
    --nimcache:"${EPREFIX}/var/cache/nim/${CATEGORY}/${PN}"

    And for Go:

    export GOCACHE="${EPREFIX}/var/cache/go"

    on some condition.

    The only problem is, they don't support cleaning cache automatically. So
    it needs to be done manually or with cron.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From William Hubbs@21:1/5 to All on Thu Jun 1 18:10:01 2023
    On Wed, Apr 26, 2023 at 06:43:04PM +0500, Anna (cybertailor) Vyalkova wrote:
    On 2023-04-25 16:09, Maciej Barć wrote:
    You would also have to have correct permissions on cache dirs (root:portage or portage:portage) this also means that the cache dir
    will have to be set during build explicitly.
    Do both Nim and Go support setting it?

    Yes. For Nim it would be something like that:

    # nim.cfg
    --nimcache:"${EPREFIX}/var/cache/nim/${CATEGORY}/${PN}"

    And for Go:

    export GOCACHE="${EPREFIX}/var/cache/go"

    This would be very easy to do in the go-module eclass, but we would need
    to test how it works with go upgrades. This cache is for compiled
    objects, so I hope it would clean the cache and restart it with
    every go upgrade since compiled go objects are not compatible between go versions.

    William

    -----BEGIN PGP SIGNATURE-----

    iF0EABECAB0WIQTVeuxEZo4uUHOkQAluVBb0MMRlOAUCZHjBQAAKCRBuVBb0MMRl OI4SAJ9IjGrukSZCV6Y1uGs85eILMsrITgCfaTczeQRuyQ+ojSkMdnvCHKHC5sQ=
    =PTEz
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)