kas icon indicating copy to clipboard operation
kas copied to clipboard

$HOME variable is overwritten

Open mo-krauti opened this issue 1 year ago • 2 comments

Why is the $HOME environment variable being overwritten to something in tmp (like /tmp/tmpak07rj9a)? Even with --preserve-env. I have my yocto sstate cache and downloads set up like this:

local_conf_header:
  # use shared downloads and cache directories
  meta-custom: |
    DL_DIR="${HOME}/.local/share/bitbake/downloads"
    SSTATE_DIR="${HOME}/.local/share/bitbake/sstate-cache"

which then oviously will not work. I did not see anything related to this in the documentation.

mo-krauti avatar Apr 02 '25 12:04 mo-krauti

Kas sandboxes the build env which includes defining a temporary home dir. But you can define shared DL_DIR or SSTATE_DIR in your shell env. kas and kas-container will carry those into the build.

Yes, we probable should make that clearer in the docs.

jan-kiszka avatar Apr 02 '25 12:04 jan-kiszka

is use subfolder of home for DL_DIR and SSTATE_DIR to share them between multiple projects of the same user.

Setting DL_DIR and SSTATE_DIR before entering kas-shell requires setup/configuration before use. This is something i try to prevent by using kas. Roughly along the lines of "here is a yaml file describing the project, use it with kas as kas build foo_config.yaml"

I ended up writing a python function that resolves home via pwd.getpwuid(os.getuid()).pw_dir during module load time and exposes it as a new variable in local.conf USERHOME="${@acokas.home()}". Maybe kas could expose the original home as a custom variable by default?

fragfutter avatar May 06 '25 08:05 fragfutter