|
|
|
@ -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){
|
|
|
|
char* yon_alpm_list_to_char(alpm_list_t *list){
|
|
|
|
if (!list) return NULL;
|
|
|
|
if (!list) return NULL;
|
|
|
|
int size = 0;
|
|
|
|
int size = 0;
|
|
|
|
@ -199,6 +261,27 @@ char* yon_alpm_list_to_char(alpm_list_t *list){
|
|
|
|
return final;
|
|
|
|
return final;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void yon_packages_info_struct_free(yon_packages_info *info){
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->repo_name)) free(info->repo_name);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->package_name)) free(info->package_name);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->version)) free(info->version);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->description)) free(info->description);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->architecture)) free(info->architecture);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->url)) free(info->url);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->licence)) free(info->licence);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->groups)) free(info->groups);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->provides)) free(info->provides);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->depends)) free(info->depends);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->optional_depends)) free(info->optional_depends);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->conflicts)) free(info->conflicts);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->replaces)) free(info->replaces);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->download_size)) free(info->download_size);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->install_size)) free(info->install_size);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->packager)) free(info->packager);
|
|
|
|
|
|
|
|
if (!yon_char_is_empty(info->build_date)) free(info->build_date);
|
|
|
|
|
|
|
|
free(info);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
yon_packages_info *yon_packages_get_info_struct(enum YON_PACKAGES_DB_TYPE type, const char *package){
|
|
|
|
yon_packages_info *yon_packages_get_info_struct(enum YON_PACKAGES_DB_TYPE type, const char *package){
|
|
|
|
if (yon_char_is_empty(package)) return NULL;
|
|
|
|
if (yon_char_is_empty(package)) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
@ -406,6 +489,27 @@ GList *yon_packages_get_all(){
|
|
|
|
return list;
|
|
|
|
return list;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GList *yon_packages_search_all(char *pkgname_regex){
|
|
|
|
|
|
|
|
if (!packages_struct.init_status) return NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GList *list = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
alpm_list_t *sync_db = alpm_get_syncdbs(packages_struct.packages_handle);
|
|
|
|
|
|
|
|
for (alpm_list_t *iter=sync_db;iter;iter=alpm_list_next(iter)){
|
|
|
|
|
|
|
|
alpm_db_t *database = iter->data;
|
|
|
|
|
|
|
|
alpm_list_t *package_list = alpm_db_get_pkgcache(database);
|
|
|
|
|
|
|
|
for (alpm_list_t *iter = package_list;iter;iter=iter->next){
|
|
|
|
|
|
|
|
const char *cur_name = alpm_pkg_get_name(iter->data);
|
|
|
|
|
|
|
|
if (g_regex_match_simple(pkgname_regex,cur_name,0,0)){
|
|
|
|
|
|
|
|
if (!list) list = g_list_append(list,yon_char_new(cur_name));
|
|
|
|
|
|
|
|
else if (g_list_append(list,yon_char_new(cur_name))){};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return list;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
int yon_packages_upac_init(){
|
|
|
|
int yon_packages_upac_init(){
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|