new: full implementation of remove and install functions
This commit is contained in:
@ -27,9 +27,19 @@ bool lm_ctx_remove(lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_remove_callback_t callba
|
||||
if(!lm_ctx_database_init(ctx))
|
||||
return false;
|
||||
|
||||
lm_pkg_t cur;
|
||||
|
||||
while (lm_database_package_next(ctx->db, &cur)) {
|
||||
if(lm_package_depends(&cur, pkg->name)){
|
||||
lm_error_set(LM_ERR_PkgBreaks, cur.name);
|
||||
lm_database_package_next_free(ctx->db, &cur);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
char *path = NULL, *hash = NULL, *fpath = NULL;
|
||||
size_t total = 0, current = 0;
|
||||
bool in_keep = false, ret = false;
|
||||
size_t total = 0, current = 0;
|
||||
|
||||
total = lm_database_files_count(ctx->db, pkg);
|
||||
|
||||
@ -54,7 +64,7 @@ bool lm_ctx_remove(lm_ctx_t *ctx, lm_pkg_t *pkg, lm_ctx_remove_callback_t callba
|
||||
next:
|
||||
free(fpath);
|
||||
fpath = NULL;
|
||||
|
||||
|
||||
if(NULL != callback && !callback(ctx, pkg, fpath, ++current, total, data))
|
||||
goto end;
|
||||
}
|
||||
|
Reference in New Issue
Block a user