Bug 255600 - Mk/bsd.port.mk: Set XDG_CACHE_HOME in CONFIGURE_ENV and MAKE_ENV
Summary: Mk/bsd.port.mk: Set XDG_CACHE_HOME in CONFIGURE_ENV and MAKE_ENV
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Ports Framework (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Tobias Kortkamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-04 21:57 UTC by Yuri Victorovich
Modified: 2021-10-06 12:06 UTC (History)
2 users (show)

See Also:
antoine: exp-run+


Attachments
XDG_CACHE_HOME.patch (1.16 KB, patch)
2021-05-04 21:57 UTC, Yuri Victorovich
no flags Details | Diff
XDG_CACHE_HOME-with-cache-subdir.patch (1.17 KB, patch)
2021-06-20 17:06 UTC, Yuri Victorovich
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuri Victorovich freebsd_committer freebsd_triage 2021-05-04 21:57:05 UTC
Created attachment 224670 [details]
XDG_CACHE_HOME.patch

Currently XDG_DATA_HOME and XDG_CONFIG_HOME are set in CONFIGURE_ENV and MAKE_ENV.

The attached patch also sets XDG_CACHE_HOME.

Without XDG_CACHE_HOME some software (for ex. https://github.com/coursier/coursier) still writes into /home/{user}/.cache. My guess is that they compute the string /home/{user}/.cache based on the current user name, because it isn't mentioned anywhere else in the environment.

XDG_CACHE_HOME is described in the XDG Base Directory Specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html).

Setting XDG_CACHE_HOME along with CONFIGURE_ENV and MAKE_ENV is a natural thing to do.
Comment 1 Tobias Kortkamp freebsd_committer freebsd_triage 2021-06-08 13:11:56 UTC
So is an exp-run the next step here?
Comment 3 Tobias Kortkamp freebsd_committer freebsd_triage 2021-06-18 06:00:50 UTC
(In reply to Antoine Brodin from comment #2)
So AFAICT the easiest solutions to this are to either

a) replace ${WRKDIR}/.cache with ${WRKDIR} in editors/vscode

b) move XDG_CACHE_HOME to ${WRKDIR}/.cache generally.  Part of the
spec is that applications should create that directory if it does
not exist, so I guess we do not have to create it.  Maybe this is
also slightly less messy than dumping the cache straight into
${WRKDIR}


Any preferences?
Comment 4 Yuri Victorovich freebsd_committer freebsd_triage 2021-06-20 17:06:27 UTC
Created attachment 225950 [details]
XDG_CACHE_HOME-with-cache-subdir.patch

Updating the patch to use XDG_CACHE_HOME=${WRKDIR}/.cache
Comment 5 Tobias Kortkamp freebsd_committer freebsd_triage 2021-09-01 19:15:27 UTC
Ping about exp-run with new patch?
Comment 6 Antoine Brodin freebsd_committer freebsd_triage 2021-09-22 17:44:39 UTC
Exp-run looks fine
Comment 7 commit-hook freebsd_committer freebsd_triage 2021-10-06 12:05:47 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=79ac62f35b153e536185a32d12366dc0ccdc1245

commit 79ac62f35b153e536185a32d12366dc0ccdc1245
Author:     Yuri Victorovich <yuri@FreeBSD.org>
AuthorDate: 2021-10-06 08:58:20 +0000
Commit:     Tobias Kortkamp <tobik@FreeBSD.org>
CommitDate: 2021-10-06 12:01:52 +0000

    Mk/bsd.port.mk: Export XDG_CACHE_HOME

    This adds XDG_CACHE_HOME to the set of XDG_* variables exported in
    CONFIGURE_ENV and MAKE_ENV.

    Without XDG_CACHE_HOME in the environment some software (for ex.
    https://github.com/coursier/coursier) falls back to using
    /home/{user}/.cache during the build and writes outside the working
    directory.

    XDG_CACHE_HOME is described in the XDG Base Directory Specification:
    https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html

    PR:             255600
    Exp-run by:     antoine

 Mk/Uses/gnome.mk | 2 +-
 Mk/bsd.port.mk   | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)