According to the README:
"CachePath (default: ~/.cache)
Path to package cache location. Will be overridden by --xdg-cache-home argument or environment variable XDG_CACHE_HOME, if set."
The actual cache path resolution order is then as follow:
Command line options (--xdg-cache-home)
Environment variables (XDG_CACHE_HOME)
Config setting (cachepath = ..)
This leads to a situation where CachePath is mostly never used, unless XDG_CACHE_HOME is unset.
Proposed change
Command line options (--xdg-cache-home)
Config setting (cachepath = ..)
Environment variables (XDG_CACHE_HOME)
This proposition invert the priority given to XDG_CACHE_HOME with the one given to cachepath.
Reasoning
Under Linux, the XDG_CACHE_HOME is a global variable that is used to set a default base cache path for any and all applications requiring a default path. Since it is set by default, it should be used as a last resort if no other option, either by a config file or a command line option, is set. As it is right now, any value given to cachepath in the config file is never used unless XDG_CACHE_HOME is unset.
Specifying a variable in a config file should be seen as a way to divert from the default XDG_CACHE_HOME value for a given application. Thus, any CachePath value set in the config file should be used over XDG_CACHE_HOME.
Lastly, using the command line option should be treated as a special case where the user wants to use a different path in a specific situation or context (a specific package may need a lot of space, where it will exceed the available space left in a home partition. For example, the cosmic-session package is used to build many sub-packages and the resulting build folder takes).
Using this reasoning, pikaur should:
Prioritize the command line option --xdg-cache-home. To be noted: this command line option could/should be renamed to something else, because setting this option for pikaur has nothing to do from that point with the environment variable XDG_CACHE_HOME; it would be better to use a name like "cache-path" or something similar for the command line option;
If no command line option is used, it should use the cachepath variable set in its config file;
If the cachepath variable is empty, it should use the XDG_CACHE_HOME variable;
If XDG_CACHE_HOME is not set (it shouldn't happen, but we may never know), it should use a hardcoded/default value (which could be ~/.cache/).
Current situation
According to the README: "CachePath (default: ~/.cache) Path to package cache location. Will be overridden by --xdg-cache-home argument or environment variable XDG_CACHE_HOME, if set."
The actual cache path resolution order is then as follow:
This leads to a situation where CachePath is mostly never used, unless XDG_CACHE_HOME is unset.
Proposed change
This proposition invert the priority given to XDG_CACHE_HOME with the one given to cachepath.
Reasoning
Under Linux, the XDG_CACHE_HOME is a global variable that is used to set a default base cache path for any and all applications requiring a default path. Since it is set by default, it should be used as a last resort if no other option, either by a config file or a command line option, is set. As it is right now, any value given to cachepath in the config file is never used unless XDG_CACHE_HOME is unset.
Specifying a variable in a config file should be seen as a way to divert from the default XDG_CACHE_HOME value for a given application. Thus, any CachePath value set in the config file should be used over XDG_CACHE_HOME.
Lastly, using the command line option should be treated as a special case where the user wants to use a different path in a specific situation or context (a specific package may need a lot of space, where it will exceed the available space left in a home partition. For example, the cosmic-session package is used to build many sub-packages and the resulting build folder takes).
Using this reasoning, pikaur should: