Update hardcoded references to rolling, current archs and repositories

This commit is contained in:
Silvan 2023-08-16 13:41:25 +02:00
parent 2536192624
commit 98bcaa9175

View File

@ -41,12 +41,12 @@
#include "functions.h" #include "functions.h"
// must be as big as ARCHS_MAX (5) // 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; static struct configTag *firstconfigtag = NULL;
char *query = ""; char *query = "";
char *query_package; char *query_package;
char *query_repository = "devel"; char *query_repository = "base";
char *query_arch = NULL; char *query_arch = NULL;
int query_compact = 0; int query_compact = 0;
int query_limit = 10; int query_limit = 10;
@ -55,12 +55,12 @@ char query_next[PATH_MAX] = "";
char *reply_xmltag = "queryreply"; char *reply_xmltag = "queryreply";
int reply_plain = 0; int reply_plain = 0;
char *lang = ""; 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; char *query_path = NULL;
struct configTag *query_repositories[100]; 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_sources = 0, searchbox = 0;
int search_files = 0; int search_files = 0;
@ -282,12 +282,14 @@ void printInputForm() {
const char ajax_call[] = "distroquery_request(" const char ajax_call[] = "distroquery_request("
// "'repository='+getElementById('repository').value" // "'repository='+getElementById('repository').value"
"'query='+getElementById('query').value+" "'query='+getElementById('query').value+"
"'&search_rolling='+getElementById('search_rolling').checked+"
"'&search_devel='+getElementById('search_devel').checked+" "'&search_devel='+getElementById('search_devel').checked+"
"'&search_milestone3='+getElementById('search_milestone3').checked+" "'&search_milestone3='+getElementById('search_milestone3').checked+"
"'&search_milestone2='+getElementById('search_milestone2').checked+" "'&search_milestone2='+getElementById('search_milestone2').checked+"
"'&search_milestone1='+getElementById('search_milestone1').checked+" "'&search_milestone1='+getElementById('search_milestone1').checked+"
"'&search_i586='+getElementById('search_i586').checked+"
"'&search_x86_64='+getElementById('search_x86_64').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_arm='+getElementById('search_arm').checked+"
"'&search_sources='+getElementById('search_sources').checked+" "'&search_sources='+getElementById('search_sources').checked+"
"'&search_files='+getElementById('search_files').checked" "'&search_files='+getElementById('search_files').checked"
@ -303,6 +305,10 @@ void printInputForm() {
} }
printf("</select>");*/ printf("</select>");*/
printf("<input type=checkbox id=\"search_rolling\" ");
if (search_rolling) printf("checked=checked ");
printf("onclick=%s>rolling&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_devel\" "); printf("<input type=checkbox id=\"search_devel\" ");
if (search_devel) printf("checked=checked "); if (search_devel) printf("checked=checked ");
printf("onclick=%s>devel&nbsp;", ajax_call); printf("onclick=%s>devel&nbsp;", ajax_call);
@ -319,16 +325,20 @@ void printInputForm() {
if (search_milestone1) printf("checked=checked "); if (search_milestone1) printf("checked=checked ");
printf("onclick=%s>milestone1&nbsp;", ajax_call); printf("onclick=%s>milestone1&nbsp;", ajax_call);
printf("&nbsp;<input type=checkbox id=\"search_i586\" "); printf(" | <input type=checkbox id=\"search_x86_64\" ");
if (query_archs[0]) printf("checked=checked "); if (query_archs[0]) printf("checked=checked ");
printf("onclick=%s>i586&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_x86_64\" ");
if (query_archs[1]) printf("checked=checked ");
printf("onclick=%s>x86_64&nbsp;", ajax_call); printf("onclick=%s>x86_64&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_arm\" "); printf("<input type=checkbox id=\"search_aarch64\" ");
if (query_archs[1]) printf("checked=checked ");
printf("onclick=%s>aarch64&nbsp;", ajax_call);
printf("&nbsp;<input type=checkbox id=\"search_i586\" ");
if (query_archs[2]) printf("checked=checked "); if (query_archs[2]) printf("checked=checked ");
printf("onclick=%s>i586&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_arm\" ");
if (query_archs[3]) printf("checked=checked ");
printf("onclick=%s>arm&nbsp;", ajax_call); printf("onclick=%s>arm&nbsp;", ajax_call);
printf("<input type=checkbox id=\"search_sources\" "); printf("<input type=checkbox id=\"search_sources\" ");
@ -581,7 +591,7 @@ void printQueryResponse() {
/* download */ /* download */
if (!query_repositories[i]->arch[a]) { if (!query_repositories[i]->arch[a]) {
printf("<div class='querytag querytag-green'>" printf("<div class='querytag querytag-green'>"
"&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a>&nbsp;</div>", "&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" target=\"_blank\" style=\"color:white\">%s</a>&nbsp;</div>",
query_repositories[i]->download_prefix, query_repositories[i]->download_prefix,
query_repositories[i]->download_dir, query_repositories[i]->download_dir,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
@ -590,7 +600,7 @@ void printQueryResponse() {
_("Download")); _("Download"));
} else { } else {
printf("<div class='querytag querytag-green'>" printf("<div class='querytag querytag-green'>"
"&nbsp;<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a>&nbsp;</div>", "&nbsp;<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" target=\"_blank\" style=\"color:white\">%s</a>&nbsp;</div>",
query_repositories[i]->download_prefix, query_repositories[i]->download_prefix,
query_repositories[i]->download_dir, query_repositories[i]->download_dir,
query_repositories[i]->arch[a], query_repositories[i]->arch[a],
@ -1508,14 +1518,18 @@ void parse_request_variables(char *data) {
search_milestone2 = strstr(valuetok, "false") != valuetok; search_milestone2 = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_milestone1")) { } else if (!strcmp(vartok, "search_milestone1")) {
search_milestone1 = strstr(valuetok, "false") != valuetok; search_milestone1 = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_rolling")) {
search_rolling = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_devel")) { } else if (!strcmp(vartok, "search_devel")) {
search_devel = strstr(valuetok, "false") != valuetok; 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")) { } 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; 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; 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")) { } else if (!strcmp(vartok, "search_sources")) {
search_sources = strstr(valuetok, "false") != valuetok; search_sources = strstr(valuetok, "false") != valuetok;
} else if (!strcmp(vartok, "search_files")) { } else if (!strcmp(vartok, "search_files")) {
@ -1533,28 +1547,43 @@ void parse_request_variables(char *data) {
ct = firstconfigtag; ct = firstconfigtag;
i = 0; i = 0;
if (query_package) { if (query_package) {
if (strstr(query_repository, "devel") == query_repository) { if (strstr(query_repository, "rolling") == query_repository) {
search_devel = 1; search_rolling = 1;
search_devel = 0;
search_milestone3 = 0; search_milestone3 = 0;
search_milestone2 = 0; search_milestone2 = 0;
search_milestone1 = 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) { } else if (strstr(query_repository, "milestone3") == query_repository) {
search_rolling = 0;
search_devel = 0; search_devel = 0;
search_milestone3 = 1; search_milestone3 = 1;
search_milestone2 = 0; search_milestone2 = 0;
search_milestone1 = 0; search_milestone1 = 0;
} else if (strstr(query_repository, "milestone2") == query_repository) { } else if (strstr(query_repository, "milestone2") == query_repository) {
search_rolling = 0;
search_devel = 0; search_devel = 0;
search_milestone3 = 0; search_milestone3 = 0;
search_milestone2 = 1; search_milestone2 = 1;
search_milestone1 = 0; search_milestone1 = 0;
} else if (strstr(query_repository, "milestone1") == query_repository) { } else if (strstr(query_repository, "milestone1") == query_repository) {
search_rolling = 0;
search_devel = 0; search_devel = 0;
search_milestone3 = 0; search_milestone3 = 0;
search_milestone2 = 0; search_milestone2 = 0;
search_milestone1 = 1; 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) { while (ct) {
if ((strstr(ct->tag, "devel") == ct->tag) && search_devel) query_repositories[i++] = ct; if ((strstr(ct->tag, "devel") == ct->tag) && search_devel) query_repositories[i++] = ct;
ct = ct->next; ct = ct->next;