Overwrite nested config options on command line - snakemake

Is it possible to overwrite nested config options with Snakemake's --config command line option? For example: an option accessed internally with config['step_a']['opt_b']. Is there some syntax to specify this when starting the Snakemake workflow?

This works but you would need to supply other elements of the step_a dict:
--config "step_a={'opt_b':'c'}"
I think the proper way is to have a different config file using --configfile.
If there is some config that is relatively static and some that is changeable, use two config files. You can supply multiple config files using --configfile.

Related

How to use include directives with specific config files in snakemake?

How can we define specific config files for includes in snakemake workflows?
I have a pipeline with the following structure.
The main entrypoint of the pipeline:
workflow/Snakefile
Other smk files:
workflow/rules/Snakefile_0.smk
workflow/rules/Snakefile_1.smk
workflow/rules/Snakefile_2.smk
Inside Snakefile, I include them using
include: "rules/Snakefile_0.smk"
include: "rules/Snakefile_1.smk"
include: "rules/Snakefile_2.smk"
I access and use the config file within these smk files, too. How can I specify config files for each smk file I include?
Snakemake does not support different configfiles for different rules or rule files if they are within the same main Snakefile. All rules of the include: *.smk files have access to the same configfile and config dict.
If you want to use different config-files for each .smk file, you can use the following workaround:
Instead of using the include directive, import the rules of the .smk files as module. You can specify a different configfile for each module imported.

How to use an environment variable in the odoo.conf

I am trying to use an environment variable in the odoo.conf
file to specify the path where the logs are stored.
So far I have tried:
logfile = ${test.rueda}/odoo.log
But it does not work.
Is there any way to achieve this?
The Odoo configuration files do not support access to environment variables.
I can think of 2 possible approaches:
Use relative paths. The file names in the configuration are relative to the working directory of the Odoo server process. Start the Odoo server in different directories, one for every purpose, and keep the same structure relative to that.
Use environment variables in the command line. When starting the Odoo server, any configuration option can be passed using -- (2 dash signs) as a prefix. In the start script, you can then use environment variables as in any other shell script.
See https://www.odoo.com/documentation/11.0/reference/cmdline.html for details.
For referencing files or path:
When i work without external disk (where i can find my datadir):
i use in odoo config file data_dir = my_absolute_path_in_my_local_disk.
This path have a symbolic redirection to where is my local physical location of my local data directory
When my external disk come back, i change the symbolic link:
my_absolute_path_in_my_local_disk -> my_external_disk_..._data

How u-boot generation the dot config file

Under the u-boot tree, after make my_defconfig, a .config is generated. By comparing the defconfig and dot config files, it seems that all config items in my_defconfig are included in .config, and there are some extra config items added into .config. I am wondering where are those extra config items come from?
Thanks a lot.
The configuration options are defined in the Kconfig files. The defconfig file just replaces the entries that you could make in
make menuconfig

Uglify RequireJS modules without concatenating them

Is it possible to uglify all the RequireJS modules without concatenating them into a single file? (I know the other way round is possible with optimize: "none").
I know uglifyjs-folder have this option, with parameters -e and -o referencing a folder (not a file).
ex:
uglifyjs-folder "%CD%" -e -o "%CD%\subfolder"
(obs: %CD% in Windows gets the current folder)
It is possible use r.js to uglify the files without concatenating them. If you do not provide any module name in the configuration options (i.e. you don't use modules nor specify name), then r.js will process each file from baseUrl individually, and thus will uglify each file without concatenation. For instance, this trivial build configuration:
{
baseUrl: "js",
dir: "build",
}
causes r.js to process each file from js individually and copy it into build after uglifying the file. No concatenation happens no matter how many files you have in js. With the configuration above, r.js will not trace any dependencies between modules because it does not need to trace dependencies to do its work.
This being said, I would not use r.js for the purpose of uglifying the files individually unless there was some additional feature of r.js I'd need to use. For instance, it may be expedient to use cjsTranslate: true to have r.js convert CommonJS modules to AMD, and perform the uglification at the same time.

How to modify files in post-build script depending on a menuconfig flag?

I need to find a way to modify/edit a given file after Buildroot compilation and right before the creation of the rootfs depending on a menuconfig flag selection. I could find in the Buildroot documentation that it is possible to do that by using post-build scripts.
My problem is that I would do the script action only if I selected something in menuconfig, for example:
(x) Enable my_login_system;
If I select my_login_system, then I need to change the nsswitch.conf file according:
passwd: my_login files
If I don't select in menuconfig the "my_login_system", then the nsswitch.conf should be:
passwd: files my_login
So, my main question is how to know if the "my_login_system" was selected or not in the post-build script.
When a post-build scripts is executed, it can access the BR2_CONFIG environment variable, which holds the path to the Buildroot .config file. Your script can parse that file and act accordingly.
Thus you could have a condition like:
if grep -q ^BR2_MY_LOGIN_SYSTEM=y ${BR2_CONFIG}
then
# do some tweaks
else
# do other tweaks
fi
Alternatively, you could use the BR2_ROOTFS_POST_SCRIPT_ARGS configuration variable to pass arbitrary command line parameters (as opposed to environment variables) to the post-build scripts.
Both possibilities are documented in the Buildroot manual, at section Customizing the generated target filesystem.