distroquery: various fixes
This commit is contained in:
parent
160acba232
commit
ece2fe900b
@ -14,7 +14,8 @@ list(GET VERSION_LIST 1 RPM_VERSION_MINOR)
|
||||
list(GET VERSION_LIST 2 RPM_VERSION_MICRO)
|
||||
|
||||
add_compile_definitions(
|
||||
PACKAGE="Distromatic"
|
||||
PACKAGE="distromatic"
|
||||
PACKAGE_NAME="Distromatic"
|
||||
PACKAGE_VERSION="1.5.0"
|
||||
DEFAULT_CONFIGFILE="/etc/distromatic.conf"
|
||||
off64_t=__off64_t
|
||||
|
@ -112,7 +112,7 @@ int compareRequiredList(const void *ptr1, const void *ptr2);
|
||||
int handleObsoletedPackages(struct configTag *ct, int arch);
|
||||
|
||||
static const char *copyright[] = {
|
||||
PACKAGE " version " PACKAGE_VERSION,
|
||||
PACKAGE_NAME " version " PACKAGE_VERSION,
|
||||
"Copyright (C) 2004-2020 by Silvan Calarco <silvan.calarco@mambasoft.it>",
|
||||
"Copyright (C) 2006 by Davide Madrisan <davide.madrisan@gmail.com>",
|
||||
(char *)0
|
||||
|
@ -93,12 +93,12 @@ char query_next[PATH_MAX] = "";
|
||||
char *reply_xmltag = "queryreply";
|
||||
int reply_plain = 0;
|
||||
char *lang = "";
|
||||
int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 };
|
||||
int query_archs[ARCHS_MAX] = { 0, 1, 0, 0, 0 };
|
||||
char *query_path = NULL;
|
||||
|
||||
struct configTag *query_repositories[100];
|
||||
|
||||
int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 1, search_devel = 1;
|
||||
int search_milestone1 = 0, search_milestone2 = 0, search_milestone3 = 0, search_devel = 1;
|
||||
int search_sources = 0, searchbox = 0;
|
||||
int search_files = 0;
|
||||
|
||||
@ -186,12 +186,12 @@ void printRPMFlags(int flags) {
|
||||
|
||||
void printTagsLine(const char* arch, const char* tag, const char* group, const char* license) {
|
||||
if (!arch)
|
||||
printf("<div style='display:inline;color:white;background-color:red'> %s </div> ", _("Source"));
|
||||
printf("<div class='querytag querytag-red'> %s </div> ", _("Source"));
|
||||
else
|
||||
printf("<div style='display:inline;color:white;background-color:green'> %s </div> ", arch);
|
||||
printf("<div style='display:inline;color:black;background-color:yellow'> %s </div> "
|
||||
"<div style='display:inline;color:black;background-color:lightblue'> %s </div> "
|
||||
"<div style='display:inline;color:black;background-color:orange'> %s </div>",
|
||||
printf("<div class='querytag querytag-green'> %s </div> ", arch);
|
||||
printf("<div class='querytag querytag-yellow'> %s </div> "
|
||||
"<div class='querytag querytag-lightblue'> %s </div> "
|
||||
"<div class='querytag querytag-orange'> %s </div>",
|
||||
tag, group, license);
|
||||
}
|
||||
|
||||
@ -442,7 +442,7 @@ void printFileBrowser() {
|
||||
snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE"
|
||||
" parent=%d"
|
||||
" ORDER BY name", startid);
|
||||
printf("<table>");
|
||||
printf("<table class='queryfiletable'>");
|
||||
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||
snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE"
|
||||
@ -456,21 +456,18 @@ void printFileBrowser() {
|
||||
cnt++;
|
||||
flags = sqlite3_column_int(stmt2,sqlite3_find_column_id(stmt2, "packages_files_rel", "flags"));
|
||||
if (flags >> 12 & 4) {
|
||||
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
|
||||
"<td style=\"font-family:courier\">%s</td>"
|
||||
"<td width=50%% style=\"font-family:courier\">"
|
||||
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td width=50%%>"
|
||||
"<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>",
|
||||
expandFileFlags(flags, sql),
|
||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
|
||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
|
||||
expandFileFlags(flags, sql),
|
||||
query_repository,
|
||||
query_arch,
|
||||
query_path,
|
||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
||||
} else {
|
||||
printf("<tr><td style=\"font-family:courier\">%s</td><td style=\"font-family:courier\">%s</td>"
|
||||
"<td style=\"font-family:courier\">%s</td><td width=50%% style=\"font-family:courier\">%s</td>",
|
||||
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td width=50%%>%s</td>",
|
||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "fileusers", "name")),
|
||||
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, "filegroups", "name")),
|
||||
expandFileFlags(flags, sql),
|
||||
@ -485,8 +482,8 @@ void printFileBrowser() {
|
||||
sqlite3_finalize(stmt2);
|
||||
}
|
||||
if (cnt == 0) {
|
||||
printf("<tr><td></td><td></td><td></td>"
|
||||
"<td width=50%% style=\"font-family:courier\"><a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>"
|
||||
printf("<tr><td></td><td></td><td></td><td width=50%%>"
|
||||
"<a href='javascript:distroquery_request(\"repository=%s&arch=%s&path=%s/%s\")'>%s</a></td>"
|
||||
"<td></td></tr>",
|
||||
query_repository,
|
||||
query_arch,
|
||||
@ -584,7 +581,7 @@ void printQueryResponse() {
|
||||
query_repositories[i]->tag,
|
||||
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
||||
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
|
||||
printf("<br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\"> ", buffer);
|
||||
printf("<br><br><img class=\"distroqueryimg16\" src=\"%s\" width=\"16\" height=\"16\"> ", buffer);
|
||||
sqlite3_finalize(stmt1);
|
||||
}
|
||||
if (query_compact) {
|
||||
@ -618,9 +615,10 @@ void printQueryResponse() {
|
||||
sqlite3_column_text(statement,6),
|
||||
sqlite3_column_text(statement,1));*/
|
||||
|
||||
printf("<br>");
|
||||
/* download */
|
||||
if (!query_repositories[i]->arch[a]) {
|
||||
printf("<div style='display:inline;background-color:green'>"
|
||||
printf("<div class='querytag querytag-green'>"
|
||||
" <a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a> </div>",
|
||||
query_repositories[i]->download_prefix,
|
||||
query_repositories[i]->download_dir,
|
||||
@ -629,10 +627,11 @@ void printQueryResponse() {
|
||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
||||
_("Download"));
|
||||
} else {
|
||||
printf("<div style='display:inline;background-color:green'>"
|
||||
" <a href=\"%s%s/SRPMS.base/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a> </div>",
|
||||
printf("<div class='querytag querytag-green'>"
|
||||
" <a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a> </div>",
|
||||
query_repositories[i]->download_prefix,
|
||||
query_repositories[i]->download_dir,
|
||||
query_repositories[i]->arch[a],
|
||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
||||
@ -641,7 +640,7 @@ void printQueryResponse() {
|
||||
}
|
||||
|
||||
/* details */
|
||||
printf(" <div style='display:inline;background-color:lightblue;font-weight:strong'>"
|
||||
printf(" <div class='querytag querytag-lightblue'>"
|
||||
" <a href=#reply onclick='distroquery_request("
|
||||
"\"repository=%s&package=%s&arch=%s\")' style=\"color:black\">%s</a> </div>",
|
||||
query_repositories[i]->tag,
|
||||
@ -1153,7 +1152,7 @@ void printPackageData() {
|
||||
htmlclean((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
||||
|
||||
/* download */
|
||||
printf("<div style='display:inline;background-color:green'>"
|
||||
printf("<div class='querytag querytag-green'>"
|
||||
" <a href=\"%s%s/RPMS.%s/%s-%s-%s.%s.rpm\" style=\"color:white\">%s</a> </div>",
|
||||
ct->download_prefix,
|
||||
ct->download_dir,
|
||||
@ -1164,7 +1163,7 @@ void printPackageData() {
|
||||
query_arch,
|
||||
_("Download"));
|
||||
|
||||
printf("<hr><br><b>%s:</b>",_("Developers details"));
|
||||
printf("<br><br><hr><br><b>%s:</b>",_("Developers details"));
|
||||
|
||||
printf("<br>%s:", _("Source package"));
|
||||
printf(" <a href=#reply onclick='distroquery_request(\"repository=%s&package=%s\")'>%s</a>",
|
||||
@ -1317,17 +1316,17 @@ void printPackageData() {
|
||||
/* files list */
|
||||
snprintf(dbname, PATH_MAX, "%s%s-%s-files.db", ct->repository_dir, ct->tag, query_arch);
|
||||
if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
|
||||
printf("<br><br>%s:<br><table>", _("Files list"));
|
||||
printf("<br><br>%s:<br><table class='queryfiletable'>", _("Files list"));
|
||||
snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel,fileusers,filegroups WHERE"
|
||||
" packages_files_rel.name='%s' AND"
|
||||
" packages_files_rel.id_user=fileusers.id AND "
|
||||
" packages_files_rel.id_group=filegroups.id", query_package);
|
||||
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||
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>",
|
||||
printf("<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>",
|
||||
expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
|
||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "fileusers", "name")),
|
||||
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "filegroups", "name")),
|
||||
expandFileFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "flags")), sql),
|
||||
resolveFilePath(dbf, sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id_file")), buffer));
|
||||
}
|
||||
sqlite3_finalize(stmt1);
|
||||
@ -1422,7 +1421,7 @@ void printSourcePackageData() {
|
||||
htmlclean((char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
||||
|
||||
/* download */
|
||||
printf("<div style='display:inline;background-color:red'>"
|
||||
printf("<div class='querytag querytag-red'>"
|
||||
" <a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a> </div>",
|
||||
ct->download_prefix,
|
||||
ct->download_dir,
|
||||
@ -1431,7 +1430,7 @@ void printSourcePackageData() {
|
||||
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
||||
_("Download"));
|
||||
|
||||
printf("<hr><br><b>%s:</b>", _("Developers details"));
|
||||
printf("<br><br><hr><br><b>%s:</b>", _("Developers details"));
|
||||
|
||||
printf("<br>%s: %s", _("Maintainer"), (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
|
||||
printf("<br>%s: %s", _("Build date"),
|
||||
@ -1626,7 +1625,6 @@ main(int argc, char *argv[])
|
||||
// install backtrace handler
|
||||
signal(SIGSEGV, backtraceHandler);
|
||||
|
||||
|
||||
firstconfigtag = read_configuration(DEFAULT_CONFIGFILE);
|
||||
if (!firstconfigtag) {
|
||||
fprintf(stderr, "Fatal error while parsing config file " DEFAULT_CONFIGFILE "; aborting.\n");
|
||||
@ -1645,6 +1643,7 @@ main(int argc, char *argv[])
|
||||
|
||||
setlocale(LC_ALL, lang);
|
||||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
|
||||
textdomain(PACKAGE);
|
||||
|
||||
if (query_package && strlen(query_package)) {
|
||||
|
Loading…
Reference in New Issue
Block a user