distroquery: add provided search

This commit is contained in:
Silvan Calarco 2013-10-14 12:45:06 +02:00
parent 654c4fbf41
commit 2b99d7d46f
4 changed files with 237 additions and 170 deletions

View File

@ -1,14 +1,14 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
# Copyright (C) YEAR Silvan Calarco <silvan.calarco@mambasoft.it>
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-14 03:03+0200\n"
"Project-Id-Version: distromatic 1.4.1\n"
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
"POT-Creation-Date: 2013-10-14 12:08+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,94 +17,112 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../src/distroquery.c:534 ../src/distroquery.c:672
msgid "Build date"
msgstr ""
#: ../src/distroquery.c:694
msgid "Build requirements"
msgstr ""
#: ../src/distroquery.c:639
msgid "Built packages"
msgstr ""
#: ../src/distroquery.c:706
msgid "Changelog"
msgstr ""
#: ../src/distroquery.c:361
msgid "Details"
msgstr ""
#: ../src/distroquery.c:525 ../src/distroquery.c:670
msgid "Developers details"
msgstr ""
#: ../src/distroquery.c:352 ../src/distroquery.c:523 ../src/distroquery.c:668
msgid "Download"
msgstr ""
#: ../src/distroquery.c:533 ../src/distroquery.c:671
msgid "Maintainer"
msgstr ""
#: ../src/distroquery.c:537
msgid "Obsoletes"
msgstr ""
#: ../src/distroquery.c:684
msgid "Patches"
msgstr ""
#: ../src/distroquery.c:549
msgid "Provides"
msgstr ""
#: ../src/distroquery.c:497
msgid "Related packages"
msgstr ""
#: ../src/distroquery.c:563
msgid "Requires"
msgstr ""
#: ../src/distroquery.c:204
msgid "Search"
msgstr ""
#: ../src/distroquery.c:425
msgid "Search results for"
msgstr ""
#: ../src/distroquery.c:249
msgid "Search software packages"
msgstr ""
#: ../src/distroquery.c:494
msgid "Size"
msgstr ""
#: ../src/distroquery.c:178
#: src/distroquery.c:178
msgid "Source"
msgstr ""
#: ../src/distroquery.c:675
msgid "Source files"
#: src/distroquery.c:204
msgid "Search"
msgstr ""
#: ../src/distroquery.c:527
msgid "Source package"
#: src/distroquery.c:238
msgid "sources"
msgstr ""
#: ../src/distroquery.c:489 ../src/distroquery.c:632
msgid "Version"
#: src/distroquery.c:249
msgid "Search software packages"
msgstr ""
#: ../src/distroquery.c:422
#: src/distroquery.c:354 src/distroquery.c:557 src/distroquery.c:702
msgid "Download"
msgstr ""
#: src/distroquery.c:363
msgid "Details"
msgstr ""
#: src/distroquery.c:380
#, c-format
msgid "Other results in "
msgstr ""
#: src/distroquery.c:381
#, c-format
msgid "Results in"
msgstr ""
#: src/distroquery.c:384
msgid "for arch "
msgstr ""
#: src/distroquery.c:393
msgid "provides"
msgstr ""
#: src/distroquery.c:456
msgid "result(s) shown"
msgstr ""
#: ../src/distroquery.c:238
msgid "sources"
#: src/distroquery.c:459
msgid "Search results for"
msgstr ""
#: src/distroquery.c:523 src/distroquery.c:666
msgid "Version"
msgstr ""
#: src/distroquery.c:528
msgid "Size"
msgstr ""
#: src/distroquery.c:531
msgid "Related packages"
msgstr ""
#: src/distroquery.c:559 src/distroquery.c:704
msgid "Developers details"
msgstr ""
#: src/distroquery.c:561
msgid "Source package"
msgstr ""
#: src/distroquery.c:567 src/distroquery.c:705
msgid "Maintainer"
msgstr ""
#: src/distroquery.c:568 src/distroquery.c:706
msgid "Build date"
msgstr ""
#: src/distroquery.c:571
msgid "Obsoletes"
msgstr ""
#: src/distroquery.c:583
msgid "Provides"
msgstr ""
#: src/distroquery.c:597
msgid "Requires"
msgstr ""
#: src/distroquery.c:673
msgid "Built packages"
msgstr ""
#: src/distroquery.c:709
msgid "Source files"
msgstr ""
#: src/distroquery.c:718
msgid "Patches"
msgstr ""
#: src/distroquery.c:728
msgid "Build requirements"
msgstr ""
#: src/distroquery.c:740
msgid "Changelog"
msgstr ""

BIN
po/it.gmo

Binary file not shown.

186
po/it.po
View File

@ -6,8 +6,8 @@
msgid ""
msgstr ""
"Project-Id-Version: distromatic 1.4.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2013-10-14 03:03+0200\n"
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
"POT-Creation-Date: 2013-10-14 12:08+0200\n"
"PO-Revision-Date: 2013-10-14 01:19+0200\n"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
"Language-Team: Italian\n"
@ -17,94 +17,112 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: ../src/distroquery.c:534 ../src/distroquery.c:672
msgid "Build date"
msgstr "Data di compilazione"
#: ../src/distroquery.c:694
msgid "Build requirements"
msgstr "Requisiti per la compilazione"
#: ../src/distroquery.c:639
msgid "Built packages"
msgstr "Pacchetti compilati"
#: ../src/distroquery.c:706
msgid "Changelog"
msgstr "Modifiche"
#: ../src/distroquery.c:361
msgid "Details"
msgstr "Dettagli"
#: ../src/distroquery.c:525 ../src/distroquery.c:670
msgid "Developers details"
msgstr "Dettagli per gli sviluppatori"
#: ../src/distroquery.c:352 ../src/distroquery.c:523 ../src/distroquery.c:668
msgid "Download"
msgstr "Scarica"
#: ../src/distroquery.c:533 ../src/distroquery.c:671
msgid "Maintainer"
msgstr "Manutentore"
#: ../src/distroquery.c:537
msgid "Obsoletes"
msgstr "Rende obsoleti"
#: ../src/distroquery.c:684
msgid "Patches"
msgstr "Patch"
#: ../src/distroquery.c:549
msgid "Provides"
msgstr "Fornisce"
#: ../src/distroquery.c:497
msgid "Related packages"
msgstr "Pacchetti collegati"
#: ../src/distroquery.c:563
msgid "Requires"
msgstr "Richiede"
#: ../src/distroquery.c:204
msgid "Search"
msgstr "Cerca"
#: ../src/distroquery.c:425
msgid "Search results for"
msgstr "Risultati della ricerca per"
#: ../src/distroquery.c:249
msgid "Search software packages"
msgstr "Cerca pacchetti software"
#: ../src/distroquery.c:494
msgid "Size"
msgstr "Dimensione"
#: ../src/distroquery.c:178
#: src/distroquery.c:178
msgid "Source"
msgstr "Sorgente"
#: ../src/distroquery.c:675
msgid "Source files"
msgstr "File sorgenti"
#: src/distroquery.c:204
msgid "Search"
msgstr "Cerca"
#: ../src/distroquery.c:527
msgid "Source package"
msgstr "Pacchetto sorgente"
#: src/distroquery.c:238
msgid "sources"
msgstr "sorgenti"
#: ../src/distroquery.c:489 ../src/distroquery.c:632
msgid "Version"
msgstr "Versione"
#: src/distroquery.c:249
msgid "Search software packages"
msgstr "Cerca pacchetti software"
#: ../src/distroquery.c:422
#: src/distroquery.c:354 src/distroquery.c:557 src/distroquery.c:702
msgid "Download"
msgstr "Scarica"
#: src/distroquery.c:363
msgid "Details"
msgstr "Dettagli"
#: src/distroquery.c:380
#, c-format
msgid "Other results in "
msgstr "Altri risultati in "
#: src/distroquery.c:381
#, c-format
msgid "Results in"
msgstr "Risultati in"
#: src/distroquery.c:384
msgid "for arch "
msgstr "per l'architettura "
#: src/distroquery.c:393
msgid "provides"
msgstr "fornisce"
#: src/distroquery.c:456
msgid "result(s) shown"
msgstr "risultati mostrati"
#: ../src/distroquery.c:238
msgid "sources"
msgstr "sorgenti"
#: src/distroquery.c:459
msgid "Search results for"
msgstr "Risultati della ricerca per"
#: src/distroquery.c:523 src/distroquery.c:666
msgid "Version"
msgstr "Versione"
#: src/distroquery.c:528
msgid "Size"
msgstr "Dimensione"
#: src/distroquery.c:531
msgid "Related packages"
msgstr "Pacchetti collegati"
#: src/distroquery.c:559 src/distroquery.c:704
msgid "Developers details"
msgstr "Dettagli per gli sviluppatori"
#: src/distroquery.c:561
msgid "Source package"
msgstr "Pacchetto sorgente"
#: src/distroquery.c:567 src/distroquery.c:705
msgid "Maintainer"
msgstr "Manutentore"
#: src/distroquery.c:568 src/distroquery.c:706
msgid "Build date"
msgstr "Data di compilazione"
#: src/distroquery.c:571
msgid "Obsoletes"
msgstr "Rende obsoleti"
#: src/distroquery.c:583
msgid "Provides"
msgstr "Fornisce"
#: src/distroquery.c:597
msgid "Requires"
msgstr "Richiede"
#: src/distroquery.c:673
msgid "Built packages"
msgstr "Pacchetti compilati"
#: src/distroquery.c:709
msgid "Source files"
msgstr "File sorgenti"
#: src/distroquery.c:718
msgid "Patches"
msgstr "Patch"
#: src/distroquery.c:728
msgid "Build requirements"
msgstr "Requisiti per la compilazione"
#: src/distroquery.c:740
msgid "Changelog"
msgstr "Modifiche"

View File

@ -252,7 +252,7 @@ void printInputForm() {
void printQueryData() {
int a, i, j, k, numresults = 0;
int a, i, j, k, numresults = 0, localresults, localprovidesresults;
char dbname[PATH_MAX];
sqlite3_stmt *statement, *stmt1;
char sql[PATH_MAX];
@ -275,7 +275,6 @@ void printQueryData() {
fprintf(stderr, "ERROR: unable to open sqlite3 db %s; aborting.\n", dbname);
}
}*/
for (i = 0; query_repositories[i] != NULL; i++) {
for (a = 0; a < ARCHS_MAX && query_repositories[i]->arch[a]; a++) {
if (find_query_arch(query_repositories[i]->arch[a]) >= 0) {
@ -298,6 +297,7 @@ void printQueryData() {
}
if (query_repositories[i]->db[a]) {
localresults = 0;
snprintf(sql, PATH_MAX,
"SELECT * FROM packages WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' OR version LIKE '%%%s%%' "
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC, "
@ -308,6 +308,7 @@ void printQueryData() {
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {
numresults++;
localresults++;
snprintf(sql, PATH_MAX, "SELECT * FROM sources WHERE id=%d",
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id_source")));
@ -363,6 +364,36 @@ void printQueryData() {
printf("</div></div><br>");
}
}
localprovidesresults = 0;
snprintf(sql, PATH_MAX,
"SELECT * FROM packages,provides,provided WHERE "
"(provides.id_package=packages.id AND provided.id=provides.id_provided) "
"AND provided.name LIKE '%%%s%%' "
"ORDER BY provided.name = '%s' DESC, provided.name LIKE '%s%%' DESC, provided.name LIKE '%%%s%%' DESC "
"LIMIT 100", queryenc, queryenc, queryenc, queryenc);
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
while (sqlite3_step(statement) == SQLITE_ROW) {
numresults++;
if (++localprovidesresults == 1) {
printf("<div style='position:relative'><hr><b>");
if (localresults > 0) printf(_("Other results in "));
else printf(_("Results in"));
printf(" %s %s %s:</b><br>",
query_repositories[i]->tag,
_("for arch "),
query_repositories[i]->arch[a]);
}
printf("<a href='javascript:distroquery_request("
"\"repository=%s&package=%s&arch=%s\")' style=\"color:black;background-color:lightblue\">%s</a> %s %s<br>",
query_repositories[i]->tag,
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")),
query_repositories[i]->arch[a],
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packages", "name")),
_("provides"),
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
}
if (localprovidesresults > 0) printf("</div>");
}
}
}
}
@ -370,9 +401,9 @@ void printQueryData() {
if (search_sources) {
snprintf(sql, PATH_MAX,
"SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' OR version LIKE '%%%s%%'"
"SELECT * FROM sources WHERE name LIKE '%%%s%%' OR summary LIKE '%%%s%%' OR description LIKE '%%%s%%' OR version LIKE '%%%s%%' "
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC LIMIT 100",
queryenc, queryenc, queryenc, queryenc, queryenc);
queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, queryenc);
for (i = 0; query_repositories[i] != NULL; i++) {
if (!query_repositories[i]->db[ARCHS_MAX]) {
snprintf(dbname, PATH_MAX, "%s%s-sources.db", query_repositories[i]->repository_dir, query_repositories[i]->tag);