From 98bcaa9175e571c8731cea561ae3f5a47eeeb44b Mon Sep 17 00:00:00 2001 From: Silvan Date: Wed, 16 Aug 2023 13:41:25 +0200 Subject: [PATCH] Update hardcoded references to rolling, current archs and repositories --- src/distroquery.c | 65 ++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 18 deletions(-) diff --git a/src/distroquery.c b/src/distroquery.c index 1b06dc2..0a8c3ea 100644 --- a/src/distroquery.c +++ b/src/distroquery.c @@ -41,12 +41,12 @@ #include "functions.h" // must be as big as ARCHS_MAX (5) -const char* ARCHS[ARCHS_MAX] = { "i586", "x86_64", "arm", "", "" }; +const char* ARCHS[ARCHS_MAX] = { "x86_64", "aarch64", "i586", "arm", "" }; static struct configTag *firstconfigtag = NULL; char *query = ""; char *query_package; -char *query_repository = "devel"; +char *query_repository = "base"; char *query_arch = NULL; int query_compact = 0; int query_limit = 10; @@ -55,12 +55,12 @@ char query_next[PATH_MAX] = ""; char *reply_xmltag = "queryreply"; int reply_plain = 0; char *lang = ""; -int query_archs[ARCHS_MAX] = { 0, 1, 0, 0, 0 }; +int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 }; char *query_path = NULL; struct configTag *query_repositories[100]; -int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 0, search_devel = 1; +int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 0, search_rolling = 1, search_devel = 0; int search_sources = 0, searchbox = 0; int search_files = 0; @@ -282,12 +282,14 @@ void printInputForm() { const char ajax_call[] = "distroquery_request(" // "'repository='+getElementById('repository').value" "'query='+getElementById('query').value+" + "'&search_rolling='+getElementById('search_rolling').checked+" "'&search_devel='+getElementById('search_devel').checked+" "'&search_milestone3='+getElementById('search_milestone3').checked+" "'&search_milestone2='+getElementById('search_milestone2').checked+" "'&search_milestone1='+getElementById('search_milestone1').checked+" - "'&search_i586='+getElementById('search_i586').checked+" "'&search_x86_64='+getElementById('search_x86_64').checked+" + "'&search_aarch64='+getElementById('search_aarch64').checked+" + "'&search_i586='+getElementById('search_i586').checked+" "'&search_arm='+getElementById('search_arm').checked+" "'&search_sources='+getElementById('search_sources').checked+" "'&search_files='+getElementById('search_files').checked" @@ -303,6 +305,10 @@ void printInputForm() { } printf("");*/ + printf("rolling ", ajax_call); + printf("devel ", ajax_call); @@ -319,16 +325,20 @@ void printInputForm() { if (search_milestone1) printf("checked=checked "); printf("onclick=%s>milestone1 ", ajax_call); - printf(" i586 ", ajax_call); - - printf("x86_64 ", ajax_call); - printf("aarch64 ", ajax_call); + + printf(" i586 ", ajax_call); + + printf("arm ", ajax_call); printf("arch[a]) { printf("
" - " %s 
", + " %s ", query_repositories[i]->download_prefix, query_repositories[i]->download_dir, sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), @@ -590,7 +600,7 @@ void printQueryResponse() { _("Download")); } else { printf("
" - " %s 
", + " %s ", query_repositories[i]->download_prefix, query_repositories[i]->download_dir, query_repositories[i]->arch[a], @@ -1508,14 +1518,18 @@ void parse_request_variables(char *data) { search_milestone2 = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_milestone1")) { search_milestone1 = strstr(valuetok, "false") != valuetok; + } else if (!strcmp(vartok, "search_rolling")) { + search_rolling = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_devel")) { search_devel = strstr(valuetok, "false") != valuetok; - } else if (!strcmp(vartok, "search_i586")) { - query_archs[0] = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_x86_64")) { + query_archs[0] = strstr(valuetok, "false") != valuetok; + } else if (!strcmp(vartok, "search_aarch64")) { query_archs[1] = strstr(valuetok, "false") != valuetok; - } else if (!strcmp(vartok, "search_arm")) { + } else if (!strcmp(vartok, "search_i586")) { query_archs[2] = strstr(valuetok, "false") != valuetok; + } else if (!strcmp(vartok, "search_arm")) { + query_archs[3] = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_sources")) { search_sources = strstr(valuetok, "false") != valuetok; } else if (!strcmp(vartok, "search_files")) { @@ -1533,28 +1547,43 @@ void parse_request_variables(char *data) { ct = firstconfigtag; i = 0; if (query_package) { - if (strstr(query_repository, "devel") == query_repository) { - search_devel = 1; + if (strstr(query_repository, "rolling") == query_repository) { + search_rolling = 1; + search_devel = 0; search_milestone3 = 0; search_milestone2 = 0; search_milestone1 = 0; + } else if (strstr(query_repository, "devel") == query_repository) { + search_rolling = 0; + search_devel = 1; + search_milestone3 = 1; + search_milestone2 = 0; + search_milestone1 = 0; } else if (strstr(query_repository, "milestone3") == query_repository) { + search_rolling = 0; search_devel = 0; search_milestone3 = 1; search_milestone2 = 0; search_milestone1 = 0; } else if (strstr(query_repository, "milestone2") == query_repository) { + search_rolling = 0; search_devel = 0; search_milestone3 = 0; search_milestone2 = 1; search_milestone1 = 0; } else if (strstr(query_repository, "milestone1") == query_repository) { + search_rolling = 0; search_devel = 0; search_milestone3 = 0; search_milestone2 = 0; search_milestone1 = 1; } } + while (ct) { + if ((strstr(ct->tag, "base") == ct->tag) && search_rolling) query_repositories[i++] = ct; + ct = ct->next; + } + ct = firstconfigtag; while (ct) { if ((strstr(ct->tag, "devel") == ct->tag) && search_devel) query_repositories[i++] = ct; ct = ct->next;