Commit ece2fe900bda084db33547d89a13ed7a7cfb4578

Authored by Silvan Calarco
1 parent 160acba232
Exists in master

distroquery: various fixes

Showing 3 changed files with 31 additions and 31 deletions Side-by-side Diff

... ... @@ -14,7 +14,8 @@
14 14 list(GET VERSION_LIST 2 RPM_VERSION_MICRO)
15 15  
16 16 add_compile_definitions(
17   - PACKAGE="Distromatic"
  17 + PACKAGE="distromatic"
  18 + PACKAGE_NAME="Distromatic"
18 19 PACKAGE_VERSION="1.5.0"
19 20 DEFAULT_CONFIGFILE="/etc/distromatic.conf"
20 21 off64_t=__off64_t
... ... @@ -112,7 +112,7 @@
112 112 int handleObsoletedPackages(struct configTag *ct, int arch);
113 113  
114 114 static const char *copyright[] = {
115   -PACKAGE " version " PACKAGE_VERSION,
  115 +PACKAGE_NAME " version " PACKAGE_VERSION,
116 116 "Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>",
117 117 "Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>",
118 118 (char *)0
... ... @@ -93,12 +93,12 @@
93 93 char *reply_xmltag = "queryreply";
94 94 int reply_plain = 0;
95 95 char *lang = "";
96   -int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 };
  96 +int query_archs[ARCHS_MAX] = { 0, 1, 0, 0, 0 };
97 97 char *query_path = NULL;
98 98  
99 99 struct configTag *query_repositories[100];
100 100  
101   -int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 1, search_devel = 1;
  101 +int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 0, search_devel = 1;
102 102 int search_sources = 0, searchbox = 0;
103 103 int search_files = 0;
104 104  
105 105  
... ... @@ -186,12 +186,12 @@
186 186  
187 187 void printTagsLine(const char* arch, const char* tag, const char* group, const char* license) {
188 188 if (!arch)
189   - printf("<div style='display:inline;color:white;background-color:red'> %s </div>&nbsp;", _("Source"));
  189 + printf("<div class='querytag querytag-red'> %s </div>&nbsp;", _("Source"));
190 190 else
191   - printf("<div style='display:inline;color:white;background-color:green'> %s </div>&nbsp;", arch);
192   - printf("<div style='display:inline;color:black;background-color:yellow'> %s </div>&nbsp;"
193   - "<div style='display:inline;color:black;background-color:lightblue'>&nbsp%s&nbsp;</div>&nbsp;"
194   - "<div style='display:inline;color:black;background-color:orange'>&nbsp%s&nbsp;</div>",
  191 + printf("<div class='querytag querytag-green'> %s </div>&nbsp;", arch);
  192 + printf("<div class='querytag querytag-yellow'> %s </div>&nbsp;"
  193 + "<div class='querytag querytag-lightblue'> %s </div>&nbsp;"
  194 + "<div class='querytag querytag-orange'> %s </div>",
195 195 tag, group, license);
196 196 }
197 197  
... ... @@ -442,7 +442,7 @@
442 442 snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE"
443 443 " parent=%d"
444 444 " ORDER BY name", startid);
445   - printf("<table>");
  445 + printf("<table class='queryfiletable'>");
446 446 if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
447 447 while (sqlite3_step(stmt1) == SQLITE_ROW) {
448 448 snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE"
449 449  
450 450  
451 451  
... ... @@ -456,21 +456,18 @@
456 456 cnt++;
457 457 flags = sqlite3_column_int(stmt2,sqlite3_find_column_id(stmt2, "packages_files_rel", "flags"));
458 458 if (flags >> 12 & 4) {
459   - printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
460   - "<td style=\"font-family:courier\">%s</td>"
461   - "<td width=50%% style=\"font-family:courier\">"
  459 + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td width=50%%>"
462 460 "<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>",
  461 + expandFileFlags(flags, sql),
463 462 sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
464 463 sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
465   - expandFileFlags(flags, sql),
466 464 query_repository,
467 465 query_arch,
468 466 query_path,
469 467 sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
470 468 sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
471 469 } else {
472   - printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
473   - "<td style=\"font-family:courier\">%s</td><td width=50%% style=\"font-family:courier\">%s</td>",
  470 + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td width=50%%>%s</td>",
474 471 sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
475 472 sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
476 473 expandFileFlags(flags, sql),
... ... @@ -485,8 +482,8 @@
485 482 sqlite3_finalize(stmt2);
486 483 }
487 484 if (cnt == 0) {
488   - printf("<tr><td></td><td></td><td></td>"
489   - "<td width=50%% style=\"font-family:courier\"><a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>"
  485 + printf("<tr><td></td><td></td><td></td><td width=50%%>"
  486 + "<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>"
490 487 "<td></td></tr>",
491 488 query_repository,
492 489 query_arch,
... ... @@ -584,7 +581,7 @@
584 581 query_repositories[i]->tag,
585 582 (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
586 583 (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
587   - printf("<br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\">&nbsp;", buffer);
  584 + printf("<br><br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\">&nbsp;", buffer);
588 585 sqlite3_finalize(stmt1);
589 586 }
590 587 if (query_compact) {
591 588  
... ... @@ -618,9 +615,10 @@
618 615 sqlite3_column_text(statement,6),
619 616 sqlite3_column_text(statement,1));*/
620 617  
  618 + printf("<br>");
621 619 /* download */
622 620 if (!query_repositories[i]->arch[a]) {
623   - printf("<div style='display:inline;background-color:green'>"
  621 + printf("<div class='querytag querytag-green'>"
624 622 "&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a>&nbsp;</div>",
625 623 query_repositories[i]->download_prefix,
626 624 query_repositories[i]->download_dir,
627 625  
... ... @@ -629,10 +627,11 @@
629 627 sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
630 628 _("Download"));
631 629 } else {
632   - printf("<div style='display:inline;background-color:green'>"
633   - "&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a>&nbsp;</div>",
  630 + printf("<div class='querytag querytag-green'>"
  631 + "&nbsp;<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a>&nbsp;</div>",
634 632 query_repositories[i]->download_prefix,
635 633 query_repositories[i]->download_dir,
  634 + query_repositories[i]->arch[a],
636 635 sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
637 636 sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
638 637 sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
... ... @@ -641,7 +640,7 @@
641 640 }
642 641  
643 642 /* details */
644   - printf("&nbsp;<div style='display:inline;background-color:lightblue;font-weight:strong'>"
  643 + printf("&nbsp;<div class='querytag querytag-lightblue'>"
645 644 "&nbsp;<a href=#reply onclick='distroquery_request("
646 645 "\"repository=%s&package=%s&arch=%s\")' style=\"color:black\">%s</a>&nbsp;</div>",
647 646 query_repositories[i]->tag,
... ... @@ -1153,7 +1152,7 @@
1153 1152 htmlclean((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
1154 1153  
1155 1154 /* download */
1156   - printf("<div style='display:inline;background-color:green'>"
  1155 + printf("<div class='querytag querytag-green'>"
1157 1156 "&nbsp;<a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a>&nbsp;</div>",
1158 1157 ct->download_prefix,
1159 1158 ct->download_dir,
... ... @@ -1164,7 +1163,7 @@
1164 1163 query_arch,
1165 1164 _("Download"));
1166 1165  
1167   - printf("<hr><br><b>%s:</b>",_("Developers details"));
  1166 + printf("<br><br><hr><br><b>%s:</b>",_("Developers details"));
1168 1167  
1169 1168 printf("<br>%s:", _("Source package"));
1170 1169 printf(" <a href=#reply onclick='distroquery_request(\"repository=%s&package=%s\")'>%s</a>",
1171 1170  
1172 1171  
... ... @@ -1317,17 +1316,17 @@
1317 1316 /* files list */
1318 1317 snprintf(dbname, PATH_MAX, "%s%s-%s-files.db", ct->repository_dir, ct->tag, query_arch);
1319 1318 if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
1320   - printf("<br><br>%s:<br><table>", _("Files list"));
  1319 + printf("<br><br>%s:<br><table class='queryfiletable'>", _("Files list"));
1321 1320 snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE"
1322 1321 " packages_files_rel.name='%s' AND"
1323 1322 " packages_files_rel.id_user=fileusers.id AND "
1324 1323 " packages_files_rel.id_group=filegroups.id", query_package);
1325 1324 if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
1326 1325 while (sqlite3_step(stmt1) == SQLITE_ROW) {
1327   - printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td><td>%s</td></tr>",
  1326 + printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
  1327 + expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
1328 1328 sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "fileusers", "name")),
1329 1329 sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "filegroups", "name")),
1330   - expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
1331 1330 resolveFilePath(dbf, sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id_file")), buffer));
1332 1331 }
1333 1332 sqlite3_finalize(stmt1);
... ... @@ -1422,7 +1421,7 @@
1422 1421 htmlclean((char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
1423 1422  
1424 1423 /* download */
1425   - printf("<div style='display:inline;background-color:red'>"
  1424 + printf("<div class='querytag querytag-red'>"
1426 1425 "&nbsp;<a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a>&nbsp;</div>",
1427 1426 ct->download_prefix,
1428 1427 ct->download_dir,
... ... @@ -1431,7 +1430,7 @@
1431 1430 (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
1432 1431 _("Download"));
1433 1432  
1434   - printf("<hr><br><b>%s:</b>", _("Developers details"));
  1433 + printf("<br><br><hr><br><b>%s:</b>", _("Developers details"));
1435 1434  
1436 1435 printf("<br>%s: %s", _("Maintainer"), (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
1437 1436 printf("<br>%s: %s", _("Build date"),
... ... @@ -1626,7 +1625,6 @@
1626 1625 // install backtrace handler
1627 1626 signal(SIGSEGV, backtraceHandler);
1628 1627  
1629   -
1630 1628 firstconfigtag = read_configuration(DEFAULT_CONFIGFILE);
1631 1629 if (!firstconfigtag) {
1632 1630 fprintf(stderr, "Fatal error while parsing config file " DEFAULT_CONFIGFILE "; aborting.\n");
... ... @@ -1645,6 +1643,7 @@
1645 1643  
1646 1644 setlocale(LC_ALL, lang);
1647 1645 bindtextdomain(PACKAGE, LOCALEDIR);
  1646 +
1648 1647 textdomain(PACKAGE);
1649 1648  
1650 1649 if (query_package && strlen(query_package)) {