|
|
|
|
@ -100,15 +100,19 @@ void on_about(){
|
|
|
|
|
|
|
|
|
|
void on_load(){
|
|
|
|
|
gsize size=0;
|
|
|
|
|
gsize sigsize=0;
|
|
|
|
|
config_str repos = yon_window_config_get_section("repos",&size);
|
|
|
|
|
config_str signatures = yon_window_config_get_section("signatures",&sigsize);
|
|
|
|
|
gtk_tree_store_clear(main_config.tree_store);
|
|
|
|
|
for (int i=0;i<size;i++){
|
|
|
|
|
char *name = yon_char_new(repos[i]);
|
|
|
|
|
char *path = yon_char_new(name);
|
|
|
|
|
char *repo_signature = NULL;
|
|
|
|
|
yon_char_divide(name,yon_char_find_last(name,'/'));
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&iter,NULL);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&iter,0,folder_no_edits,1,name,2,path,3,0,4,0,9,name,-1);
|
|
|
|
|
yon_window_config_get_parameter("signatures",repos[i],(void*)&repo_signature,YON_TYPE_STRING);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&iter,0,folder_no_edits,1,name,2,path,3,0,4,0,9,name,13,repo_signature,-1);
|
|
|
|
|
char *parameter_string = NULL;
|
|
|
|
|
yon_window_config_get_parameter("repos",repos[i],(void*)¶meter_string,YON_TYPE_STRING);
|
|
|
|
|
if (parameter_string){
|
|
|
|
|
@ -116,6 +120,8 @@ void on_load(){
|
|
|
|
|
config_str packs = yon_char_parse(parameter_string,&packsize," ");
|
|
|
|
|
GtkTreeIter packIter;
|
|
|
|
|
if (!packs){
|
|
|
|
|
char *pack_signed = NULL;
|
|
|
|
|
yon_window_config_get_parameter("signatures",parameter_string,&pack_signed,YON_TYPE_STRING);
|
|
|
|
|
FILE *file = popen(get_saved_package_info_command(path,parameter_string),"r");
|
|
|
|
|
char *cur_string=g_malloc0(sizeof(char)*4096);
|
|
|
|
|
char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL;
|
|
|
|
|
@ -128,11 +134,13 @@ void on_load(){
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(steer);
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&packIter,&iter);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&packIter,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,yon_char_unite(path,"/pool/overlay/",parameter_string,NULL),3,0,4,0,9,packname,10,packver,11,packarch,12,packdepends,-1);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&packIter,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,yon_char_unite(path,"/pool/overlay/",parameter_string,NULL),3,0,4,0,9,packname,10,packver,11,packarch,12,packdepends,13,pack_signed,-1);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
for (int j=0;j<packsize;j++){
|
|
|
|
|
char *command = get_saved_package_info_command(path,packs[j]);
|
|
|
|
|
char *pack_signed = NULL;
|
|
|
|
|
yon_window_config_get_parameter("signatures",packs[j],&pack_signed,YON_TYPE_STRING);
|
|
|
|
|
FILE *file = popen(command,"r");
|
|
|
|
|
char *cur_string=g_malloc0(sizeof(char)*4096);
|
|
|
|
|
char *packname=NULL, *packver=NULL, *packarch=NULL, *packdepends=NULL;
|
|
|
|
|
@ -145,7 +153,7 @@ void on_load(){
|
|
|
|
|
else if (strstr(p,"Depends On")) packdepends = yon_char_new(steer);
|
|
|
|
|
}
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&packIter,&iter);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&packIter,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,yon_char_unite(path,"/pool/overlay/",parameter_string,NULL),3,0,4,0,9,packname,10,packver,11,packarch,12,packdepends,-1);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&packIter,0,document_no_edits,1,yon_char_unite(packname,"-",packver,"-",packarch,NULL),2,yon_char_unite(path,"/pool/overlay/",parameter_string,NULL),3,0,4,0,9,packname,10,packver,11,packarch,12,packdepends,13,pack_signed,-1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@ -170,6 +178,7 @@ void on_save(){
|
|
|
|
|
char *packnames = NULL;
|
|
|
|
|
char *sign_flagged = NULL;
|
|
|
|
|
char *repo_sign_flagged = NULL;
|
|
|
|
|
char *repo_sign_flagged_full = NULL;
|
|
|
|
|
int repostatus=0;
|
|
|
|
|
gboolean renamed=0;
|
|
|
|
|
char *old_name=NULL;
|
|
|
|
|
@ -179,9 +188,9 @@ void on_save(){
|
|
|
|
|
char *remove_packages=NULL;
|
|
|
|
|
|
|
|
|
|
gtk_tree_model_get(GTK_TREE_MODEL(main_config.tree_store),&iter,1,&name_flagged,2,&origin_flagged,3,&repostatus,4,&old_name,5,&renamed,13,&repo_sign_flagged,-1);
|
|
|
|
|
repo_sign_flagged_full = yon_char_new(repo_sign_flagged);
|
|
|
|
|
yon_char_divide_search(repo_sign_flagged,"<",-1);
|
|
|
|
|
repo_sign_flagged=yon_char_divide_search(repo_sign_flagged,">",-1);
|
|
|
|
|
|
|
|
|
|
if (repostatus == 1) gtk_tree_store_set(main_config.tree_store,&iter,0,folder_no_edits,3,0,-1);
|
|
|
|
|
else if (repostatus == -1){
|
|
|
|
|
system(yon_char_unite("rm -rfd ",origin_flagged,NULL));
|
|
|
|
|
@ -221,6 +230,9 @@ void on_save(){
|
|
|
|
|
yon_char_divide(pack_sign_paths,yon_char_find_last(pack_sign_paths,'/'));
|
|
|
|
|
packnames = yon_char_unite(packnames ? yon_char_append(packnames," "):"",pack_sign_paths,NULL);
|
|
|
|
|
if (pack_sign&&pack_signed==1){
|
|
|
|
|
char *package_full_name = yon_char_new(pack_path);
|
|
|
|
|
yon_char_divide(package_full_name,yon_char_find_last(package_full_name,'/'));
|
|
|
|
|
yon_window_config_add_custom_parameter(package_full_name,"signatures",yon_char_new(pack_sign),YON_TYPE_STRING);
|
|
|
|
|
yon_char_divide_search(pack_sign,"<",-1);
|
|
|
|
|
pack_sign=yon_char_divide_search(pack_sign,">",-1);
|
|
|
|
|
if (!pack_groups||!(yon_dictionary_get(&pack_groups,pack_sign))){
|
|
|
|
|
@ -235,8 +247,10 @@ void on_save(){
|
|
|
|
|
}
|
|
|
|
|
if (pack_status==1){
|
|
|
|
|
add_packages = yon_char_unite(add_packages ? yon_char_append(add_packages,",") : "",pack_path,NULL);
|
|
|
|
|
pack_path = yon_char_unite(origin_flagged,"/pool/overlay/",yon_char_divide(pack_path,yon_char_find_last(pack_path,'/')));
|
|
|
|
|
yon_char_divide(pack_path,yon_char_find_last(pack_path,'/'));
|
|
|
|
|
pack_path = yon_char_unite(origin_flagged,"/pool/overlay/",pack_path,NULL);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&childIter,2,pack_path,-1);
|
|
|
|
|
repostatus=1;
|
|
|
|
|
} else if (pack_status==-1){
|
|
|
|
|
remove_packages = yon_char_unite(remove_packages ? yon_char_append(remove_packages,",") : "",pack_code_name,NULL);
|
|
|
|
|
}
|
|
|
|
|
@ -262,12 +276,10 @@ void on_save(){
|
|
|
|
|
if (origin_flagged&&name_flagged){
|
|
|
|
|
if (add_packages){
|
|
|
|
|
char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL;
|
|
|
|
|
repo_sign_flagged=NULL;
|
|
|
|
|
add_command = yon_char_unite(command, " add -d \"",origin_flagged,"\" -r \"",name_flagged, sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" ," -p ", add_packages,NULL);
|
|
|
|
|
}
|
|
|
|
|
if (remove_packages){
|
|
|
|
|
char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL;
|
|
|
|
|
repo_sign_flagged=NULL;
|
|
|
|
|
remove_command = yon_char_unite(command, " remove -d \"",origin_flagged,"\" -r \"",name_flagged, sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" , " -p ", remove_packages,NULL);
|
|
|
|
|
}
|
|
|
|
|
if (repostatus == 1){
|
|
|
|
|
@ -275,11 +287,11 @@ void on_save(){
|
|
|
|
|
}
|
|
|
|
|
if (!add_packages&&!signed_packages&&!remove_packages&&repostatus==1)
|
|
|
|
|
add_command = yon_char_unite(command, " add -d \"",origin_flagged,"\" -r \"",name_flagged,sign_flagged ? yon_char_append("\" --sign-repo ",sign_flagged):"\"" ,NULL);
|
|
|
|
|
if (add_signed_command){/*printf("%s\n",add_signed_command);*/ system(add_signed_command);
|
|
|
|
|
if (add_signed_command){ system(add_signed_command);
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);}
|
|
|
|
|
if (add_command) {/*printf("%s\n",add_command);*/system(add_command);
|
|
|
|
|
if (add_command) { system(add_command);
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);}
|
|
|
|
|
if (remove_command) {/*printf("%s\n",remove_command);*/system(remove_command);
|
|
|
|
|
if (remove_command) { system(remove_command);
|
|
|
|
|
yon_ubl_status_box_render(OPERATION_DONE_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);}
|
|
|
|
|
if (pack_groups){
|
|
|
|
|
dictionary *dct;
|
|
|
|
|
@ -288,16 +300,20 @@ void on_save(){
|
|
|
|
|
dictionary *pck;
|
|
|
|
|
for_dictionaries(pck,yon_dictionary_get_data(dct,dictionary*)){
|
|
|
|
|
signed_packs=yon_char_unite(signed_packs ? yon_char_append(signed_packs,","): "" ,pck->key,NULL);
|
|
|
|
|
} char *sign_check = repo_sign_flagged ? yon_char_new(repo_sign_flagged) : NULL;
|
|
|
|
|
repo_sign_flagged=NULL;
|
|
|
|
|
}
|
|
|
|
|
char *sign_command = yon_char_unite(command, " add -f -d ",origin_flagged," -r ",name_flagged," --sign-pkg ", dct->key," -p $(find ",origin_flagged,"/pool/overlay -name ", signed_packs,")",NULL);
|
|
|
|
|
printf("%s\n",sign_command);
|
|
|
|
|
system(sign_command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
if (repo_sign_flagged){
|
|
|
|
|
char *repo_sign_command = yon_char_unite(command, " add -f -d ",origin_flagged, " -r ", name_flagged, " --sign-repo ", repo_sign_flagged ,NULL);
|
|
|
|
|
yon_window_config_add_custom_parameter(yon_char_unite(origin_flagged,NULL),"signatures",repo_sign_flagged_full,YON_TYPE_STRING);
|
|
|
|
|
system(repo_sign_command);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
yon_ubl_status_box_render(SAVE_SUCCESS_LABEL,BACKGROUND_IMAGE_SUCCESS_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void on_search(GtkCellEditable *self, main_window *widgets){
|
|
|
|
|
@ -363,6 +379,18 @@ void on_tree_selection_changed(GtkWidget *self,main_window *widgets){
|
|
|
|
|
gtk_widget_set_visible(widgets->ArchitectureBox,1);
|
|
|
|
|
gtk_widget_set_visible(widgets->SignatureBox,1);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
gtk_widget_set_sensitive(widgets->CreateButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->LoadFromLocalButton,1);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->ConfigureButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->DeleteButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->AddPackageButton,0);
|
|
|
|
|
gtk_widget_set_sensitive(widgets->RemovePackageButton,0);
|
|
|
|
|
gtk_widget_set_visible(widgets->NameBox,0);
|
|
|
|
|
gtk_widget_set_visible(widgets->DependenceBox,0);
|
|
|
|
|
gtk_widget_set_visible(widgets->VersionBox,0);
|
|
|
|
|
gtk_widget_set_visible(widgets->ArchitectureBox,0);
|
|
|
|
|
gtk_widget_set_visible(widgets->SignatureBox,0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ -441,6 +469,7 @@ void on_repo_sign(GtkWidget *self, main_window *widgets){
|
|
|
|
|
window->CloseButton = yon_gtk_builder_get_widget(builder,"repoSignCancelButton");
|
|
|
|
|
GtkTreeModel *model = GTK_TREE_MODEL(main_config.tree_store);
|
|
|
|
|
GtkTreeIter iter;
|
|
|
|
|
gtk_window_set_title(GTK_WINDOW(window->Window),TITLE_LABEL);
|
|
|
|
|
if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&model,&iter)){
|
|
|
|
|
if (gtk_tree_store_iter_depth(main_config.tree_store,&iter)==1)
|
|
|
|
|
gtk_label_set_text(GTK_LABEL( window->HeaderLabel),yon_char_unite(DIGITAL_SIGNATURE_LABEL," - ",PACKAGE_LABEL,NULL));
|
|
|
|
|
@ -512,6 +541,7 @@ void on_repo_load_local(GtkWidget *self, main_window *widgets){
|
|
|
|
|
gtk_file_filter_add_pattern(file_filter,"*db.tar.gz");
|
|
|
|
|
gtk_file_filter_set_name(file_filter, "*db.tar.gz");
|
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser),file_filter);
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(chooser),"com.ublinux.ubl-settings-repomanager");
|
|
|
|
|
int res = gtk_dialog_run(GTK_DIALOG(chooser));
|
|
|
|
|
if (res==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
|
|
|
|
|
@ -561,7 +591,7 @@ GtkTreeIter *yon_repo_append(main_window *widgets, char *name, YON_REPO_LINE_TYP
|
|
|
|
|
}
|
|
|
|
|
else if (type==YON_REPO_LINE_REPO_TYPE){
|
|
|
|
|
gtk_tree_store_append(main_config.tree_store,&iter,NULL);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&iter,0, folder_no_edits, 1, name_short,2,name,3,1,4,fls,-1);
|
|
|
|
|
gtk_tree_store_set(main_config.tree_store,&iter,0, folder_no_edits, 1, name_short,2,name,3,1,4,fls,9,name_short,-1);
|
|
|
|
|
retIter = gtk_tree_iter_copy(&iter);
|
|
|
|
|
gtk_tree_selection_select_iter(gtk_tree_view_get_selection(GTK_TREE_VIEW(widgets->RepoTree)),&iter);
|
|
|
|
|
} else {
|
|
|
|
|
@ -626,6 +656,7 @@ void yon_add_file(main_window *widgets){
|
|
|
|
|
gtk_file_filter_add_pattern(file_filter,"*");
|
|
|
|
|
gtk_file_filter_set_name(file_filter,"All");
|
|
|
|
|
gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(chooser),file_filter);
|
|
|
|
|
gtk_window_set_icon_name(GTK_WINDOW(chooser),"com.ublinux.ubl-settings-repomanager");
|
|
|
|
|
int res = gtk_dialog_run(GTK_DIALOG(chooser));
|
|
|
|
|
if (res==GTK_RESPONSE_ACCEPT){
|
|
|
|
|
char *filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(chooser));
|
|
|
|
|
@ -817,10 +848,11 @@ int main(int argc, char *argv[]){
|
|
|
|
|
{"socket-ext-id", 1,0, 'e'},
|
|
|
|
|
{"socket-trd-id", 1,0, 't'},
|
|
|
|
|
{"debug", 0,0, 'd'},
|
|
|
|
|
{"clean-config", 0,0, 'c'},
|
|
|
|
|
{ NULL, 0, NULL, 0 }
|
|
|
|
|
};
|
|
|
|
|
for (int i=0;i<argc;i++){
|
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:d",long_options,&option_index);
|
|
|
|
|
int argument=getopt_long(argc,argv,"hVvs:e:t:dc",long_options,&option_index);
|
|
|
|
|
switch(argument){
|
|
|
|
|
case 'h':
|
|
|
|
|
show_help=1;
|
|
|
|
|
@ -836,11 +868,13 @@ int main(int argc, char *argv[]){
|
|
|
|
|
break;
|
|
|
|
|
case 'e':
|
|
|
|
|
if(optarg)
|
|
|
|
|
main_config.load_socket_id=atoi(optarg);
|
|
|
|
|
main_config.save_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 't':
|
|
|
|
|
if(optarg)
|
|
|
|
|
main_config.save_socket_id=atoi(optarg);
|
|
|
|
|
main_config.load_socket_id=atoi(optarg);
|
|
|
|
|
break;
|
|
|
|
|
case 'c': system(yon_char_unite("rm -rfd ", yon_ubl_user_get_home_directory(),"/.config/",LocaleName,"/",NULL));
|
|
|
|
|
break;
|
|
|
|
|
case 1:
|
|
|
|
|
main_config.lock_help=1;
|
|
|
|
|
|