|
|
|
|
@ -185,6 +185,68 @@ char *yon_packages_get_description(enum YON_PACKAGES_DB_TYPE type, const char *p
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char *yon_packages_get_groups(enum YON_PACKAGES_DB_TYPE type, const char *package){
|
|
|
|
|
if (yon_char_is_empty(package)) return NULL;
|
|
|
|
|
alpm_list_t *databases = _yon_packages_get_db_list(type);
|
|
|
|
|
|
|
|
|
|
alpm_list_t *iter = NULL;
|
|
|
|
|
for (iter = databases; iter; iter=iter->next){
|
|
|
|
|
alpm_pkg_t *pkg = alpm_db_get_pkg(iter->data,package);
|
|
|
|
|
if (!pkg) continue;
|
|
|
|
|
const char *name = alpm_pkg_get_name(pkg);
|
|
|
|
|
if (!strcmp(name,package)){
|
|
|
|
|
alpm_list_t *groups = alpm_pkg_get_groups(pkg);
|
|
|
|
|
alpm_list_t *iter;
|
|
|
|
|
config_str groups_list = NULL;
|
|
|
|
|
int parsed_size;
|
|
|
|
|
int size = alpm_list_count(groups);
|
|
|
|
|
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
if (yon_char_parsed_check_exist(groups_list,parsed_size,groups->data)==-1){
|
|
|
|
|
yon_char_parsed_add_or_create_if_exists(groups_list,&parsed_size,yon_char_new(groups->data));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
char *final = yon_char_parsed_to_string(groups_list,parsed_size,", ");
|
|
|
|
|
return yon_char_new(final);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long yon_packages_get_installed_size(enum YON_PACKAGES_DB_TYPE type, const char *package){
|
|
|
|
|
if (yon_char_is_empty(package)) return 0;
|
|
|
|
|
alpm_list_t *databases = _yon_packages_get_db_list(type);
|
|
|
|
|
|
|
|
|
|
alpm_list_t *iter = NULL;
|
|
|
|
|
for (iter = databases; iter; iter=iter->next){
|
|
|
|
|
alpm_pkg_t *pkg = alpm_db_get_pkg(iter->data,package);
|
|
|
|
|
if (!pkg) continue;
|
|
|
|
|
const char *name = alpm_pkg_get_name(pkg);
|
|
|
|
|
if (!strcmp(name,package)){
|
|
|
|
|
long size = alpm_pkg_get_isize(pkg);
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long yon_packages_get_size(enum YON_PACKAGES_DB_TYPE type, const char *package){
|
|
|
|
|
if (yon_char_is_empty(package)) return 0;
|
|
|
|
|
alpm_list_t *databases = _yon_packages_get_db_list(type);
|
|
|
|
|
|
|
|
|
|
alpm_list_t *iter = NULL;
|
|
|
|
|
for (iter = databases; iter; iter=iter->next){
|
|
|
|
|
alpm_pkg_t *pkg = alpm_db_get_pkg(iter->data,package);
|
|
|
|
|
if (!pkg) continue;
|
|
|
|
|
const char *name = alpm_pkg_get_name(pkg);
|
|
|
|
|
if (!strcmp(name,package)){
|
|
|
|
|
long size = alpm_pkg_get_size(pkg);
|
|
|
|
|
return size;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
char* yon_alpm_list_to_char(alpm_list_t *list){
|
|
|
|
|
if (!list) return NULL;
|
|
|
|
|
int size = 0;
|
|
|
|
|
|