v4.0.0-rc4 - add config parsing

This commit is contained in:
Liam Waldron 2024-10-18 17:58:23 -04:00
parent 619e4bc346
commit 407d61a908
3 changed files with 37 additions and 4 deletions

View File

@ -41,3 +41,23 @@ GLACIER_VERBOSE = false;
### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ### ### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ###
### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ### ### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ###
### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ### ### DO NOT EDIT ANY SETTINGS BELOW THIS LINE ###
# This system profile is only present for testing purposes.
# Package repository
# This is the URL which glacier-update-pkgdb will clone
GLACIER_REPO = "https://git.everestlinux.org/EverestLinux/epkgs-x86_64-musl";
# System architecture
# The architecture of your system's CPU
GLACIER_ARCH = "x86_64";
# Target compilation triplet
# The triplet to be used during compilation
GLACIER_TARGET = "x86_64-linux-musl";
# System profile
# This variable tells Glacier about your system and which packages can be installed.
# This setting depends on the three above and should not be changed manually.
# If you wish to migrate system profiles, see https://www.everestlinux.org/docs/musl-or-glibc
GLACIER_SYSTEM_PROFILE = "x86_64-musl";

View File

@ -70,6 +70,7 @@ int load_all_from_config();
/**************************************************************************************************************/ /**************************************************************************************************************/
/* /*
* [[[ DEPRECATED ]]]
* load_setting_from_config * load_setting_from_config
* DESCRIPTION: Initialize a specified from glacier.cfg. * DESCRIPTION: Initialize a specified from glacier.cfg.
* PARAMETERS: * PARAMETERS:
@ -82,6 +83,6 @@ int load_all_from_config();
* load_setting_from_config(); * load_setting_from_config();
*/ */
int load_setting_from_config(char SETTING[]); /* int load_setting_from_config(char SETTING[]); */
#endif #endif

View File

@ -185,7 +185,7 @@ init_config()
{ {
config_init(&cfg); config_init(&cfg);
if (! config_read_file(&cfg, "glacier.cfg")) { if (! config_read_file(&cfg, runtime_files[0])) {
fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg), fprintf(stderr, "%s:%d - %s\n", config_error_file(&cfg),
config_error_line(&cfg), config_error_text(&cfg)); config_error_line(&cfg), config_error_text(&cfg));
config_destroy(&cfg); config_destroy(&cfg);
@ -222,6 +222,18 @@ die_config()
* *
*/ */
int
load_all_from_config()
{
config_lookup_bool(&cfg, "GLACIER_DO_INT_CHECK", &GLACIER_DO_INT_CHECK);
config_lookup_bool(&cfg, "GLACIER_VERBOSE", &GLACIER_VERBOSE);
config_lookup_string(&cfg, "GLACIER_REPO", &GLACIER_REPO);
config_lookup_string(&cfg, "GLACIER_ARCH", &GLACIER_ARCH);
config_lookup_string(&cfg, "GLACIER_TARGET", &GLACIER_TARGET);
config_lookup_string(&cfg, "GLACIER_SYSTEM_PROFILE", &GLACIER_SYSTEM_PROFILE);
}
/* issues with this idk /* issues with this idk
int int
load_all_from_config() load_all_from_config()
@ -252,9 +264,9 @@ load_all_from_config()
* *
*/ */
int /* int
load_setting_from_config(char SETTING[]) load_setting_from_config(char SETTING[])
{} {} */
/* /*
* mkworkspace * mkworkspace