new: cleaning up functions, base implementation of install function

This commit is contained in:
ngn
2024-07-04 03:12:33 +03:00
parent 43cf7d26c8
commit 38b99eda79
25 changed files with 568 additions and 253 deletions

View File

@ -60,7 +60,7 @@ bool lm_pool_info_load(lm_pool_t *pool) {
return true;
}
bool lm_pool_info_get(lm_pool_t *pool) {
bool lm_pool_info_download(lm_pool_t *pool) {
if(NULL == pool){
lm_error_set(LM_ERR_ArgNULL);
return false;

View File

@ -85,7 +85,7 @@ end:
return ret;
}
bool lm_pool_list_get(lm_pool_t *pool) {
bool lm_pool_list_download(lm_pool_t *pool) {
if(NULL == pool){
lm_error_set(LM_ERR_ArgNULL);
return false;

View File

@ -35,6 +35,8 @@ bool lm_pool_package_add(lm_pool_t *pool, lm_pkg_t *pkg){
return false;
}
pkg->pool = pool;
if(!lm_pool_path_is_empty(pool)){
size_t path_size = strlen(pool->paths.dir)+strlen(pkg->name)+strlen(pkg->version);
size_t name_size = path_size - strlen(pool->paths.dir);
@ -52,24 +54,13 @@ bool lm_pool_package_add(lm_pool_t *pool, lm_pkg_t *pkg){
lm_package_path_set_signature(pkg, sig_path);
}
if(NULL == pool->pkg){
pool->pkg = pkg;
return true;
}
lm_pkg_t *cur = pool->pkg;
while(NULL != cur){
if(NULL == cur->next){
cur->next = pkg;
return true;
}
cur = cur->next;
}
return false;
// add to the start
pkg->next = pool->pkg;
pool->pkg = pkg;
return true;
}
bool lm_pool_package_get(lm_pool_t *pool, lm_pkg_t *pkg){
bool lm_pool_package_download(lm_pool_t *pool, lm_pkg_t *pkg){
if(NULL == pool || NULL == pkg){
lm_error_set(LM_ERR_ArgNULL);
return false;

View File

@ -10,7 +10,7 @@ lm_pool_t *lm_pool_new(char *name, char *url) {
lm_pool_t *pool = malloc(sizeof(lm_pool_t));
bzero(pool, sizeof(lm_pool_t));
pool->available = true;
pool->available = false;
pool->name = name;
if (NULL != url && !lm_url_init(&pool->url, url)) {