1 - Introduction
2 - Installation
In order to install
libcolor
libconfig
Once these libraries are installed, clone the
$ git clone https://git.everestlinux.org/EverestLinux/libglacier
Enter the repository and edit the make configuration file:
$ cd libglacier
$ ${EDITOR} config.mk
Before proceeding with ANY other step, make sure you define
By default this variable is not defined. Results will be unexpected if the library is compiled without
Build the library:
$ make lib
If you wish to compile a shared library instead, you must edit the Makefile
3 - Using libglacier in a program
To use
#include <glacier_config.h>
#include <glacier_data.h>
#include <glacier_log.h>
#include <glacier_pkgops.h>
#include <glacier_runtime.h>
To compile
-lconfig
4 - Configuration Functions
4.1 init_config
No parameters are accepted by
#include <glacier_config.h>
int
main()
{
init_config();
}
4.2 die_config
No parameters are accepted by
#include <glacier_config.h>
int
main()
{
die_config();
}
4.3 load_all_from_config
No parameters are accepted by
#include <glacier_config.h>
int
main()
{
init_config();
}
5 - Data structure functions
Since Glacier is a package manager,
5.1 create_node
char *data (the name of the node to create)
#include <glacier_data.h>
int
main()
{
struct node package = create_node("Package");
}
5.2 add_child
struct node *parent (the parent node which the child will be added to)struct node *child (the child node which will be added to the parent node)
#include <glacier_data.h>
int
main()
{
struct node pack = create_node("pack");
struct node dep1 = create_node("dep1");
add_child(pack, dep1);
}
5.3 print_tree
struct node *root (the root node of the tree to printint level (the number of levels to descend)
#include <glacier_data.h>
int
main()
{
struct node pack = create_node("pack");
struct node dep1 = create_node("dep1");
add_child(pack, dep1);
print_tree(pack, 0);
}
6 - Logging Functions
The logging functions
The following logging functions are included:
infolog warnlog errlog successlog
These four functions accept the following parameters:
char MSG (the message to output
Logging functions do not require a newline character ('\n'), they will automatically place one after the message.
#include <glacier_log.h>
int
main()
{
infolog("This is an info message");
warnlog("This is a warning message");
errlog("This is an error message");
successlog("This is a success message");
}
7 - Package Operation Functions
This section describes the numerous functions related to operations on packages.
7.1 mkworkspace
0 on success
2 on library error
#include <glacier_pkgops.h>
int
main()
{
mkworkspace();
}
7.2 prepare_pkg
char PACKAGE[] (the package file to prepare)
0 on success
1 on package does not exist, or error untarring
#include <glacier_pkgops.h>
int
main()
{
prepare_pkg("/glacier/localdb/epkgs-x86_64-musl/foo.tar");
}
This example presented is not the best. Instead of manually specifying the package directory, you should be calling the system profile.
7.3 run_make_task
char TASK[] (the make task to run
0 on success
1 on failure
#include <glacier_pkgops.h>
int
main()
{
prepare_pkg("/glacier/localdb/epkgs-x86_64-musl/foo.tar");
run_make_task("installpkg");
}
8 - Runtime Functions
The functions described here are used for various runtime checks.
8.1 runtime_exists
#include <glacier_runtime.h>
int
main()
{
runtime_exists();
}
8.2