Skip to content

Environment config in Shamrock

In Shamrock to ease configuration we provide environment script, the goal is for them to ease setup on known machines.

  • Activate file with exports in build folder, configure environment behavior through exports and register functions
  • Helper script to generate the env : env/new-env

Functions registered by the env : - shammake that call ninja or make automatically - shamconfigure that call cmake and forward argument to the cmake call

Typicall workflow would be :

env/new-env --machine psmn-cascade --builddir build
cd build
. activate
shamconfigure
shammake

new env script

> env/new-env --help
usage: new-env [-h] --machine MACHINE --builddir BUILDDIR -- (argument for the env)

Environment utility for Shamrock

options:
  -h, --help           show this help message and exit
  --machine MACHINE    machine assumed for the environment
  --builddir BUILDDIR  build directory to use
  --                   Everything after this will be forwarded to the env.

This call will print the help of the debian-generic environment env/new-env --machine debian-generic --builddir build -- --help

Environment reset functionality

A new function reset_env is now provided in the environment activation scripts generated by env/new-env. This function allows you to reset your environment setup in the current build directory. It is useful if you want to clean and regenerate the environment configuration without manually deleting files or rerunning the setup commands by hand.

What does reset_env do?

  • Removes the .env directory in your build folder (where environment state is stored)
  • Re-runs the env/new-env command with the original arguments used to set up the environment
  • Prints a message reminding you to re-source the activate script

How to use it

After activating your environment (i.e., after running source ./activate in your build directory), you can simply run:

reset_env

This will reset the environment setup for your current build directory. After it completes, you should re-run:

source ./activate

to re-activate the environment with the fresh configuration.

Note: The reset_env function is available in all environments generated with the updated env/new-env script. If you do not see this function, try regenerating your environment with the latest version of Shamrock.