distroquery: files search and results pagination support
This commit is contained in:
parent
adf76fa4fd
commit
4dfb651da5
@ -8,7 +8,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: distromatic 1.4.1\n"
|
"Project-Id-Version: distromatic 1.4.1\n"
|
||||||
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
|
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
|
||||||
"POT-Creation-Date: 2013-10-14 12:08+0200\n"
|
"POT-Creation-Date: 2013-10-15 00:07+0200\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
@ -17,112 +17,120 @@ msgstr ""
|
|||||||
"Content-Type: text/plain; charset=CHARSET\n"
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
#: src/distroquery.c:178
|
#: src/distroquery.c:181
|
||||||
msgid "Source"
|
msgid "Source"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:204
|
#: src/distroquery.c:225
|
||||||
msgid "Search"
|
msgid "Search"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:238
|
#: src/distroquery.c:259
|
||||||
msgid "sources"
|
msgid "sources"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:249
|
#: src/distroquery.c:270
|
||||||
msgid "Search software packages"
|
msgid "Search software packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:354 src/distroquery.c:557 src/distroquery.c:702
|
#: src/distroquery.c:374 src/distroquery.c:639 src/distroquery.c:807
|
||||||
msgid "Download"
|
msgid "Download"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:363
|
#: src/distroquery.c:383
|
||||||
msgid "Details"
|
msgid "Details"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:380
|
#: src/distroquery.c:401 src/distroquery.c:436
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Other results in "
|
msgid "Other results in "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:381
|
#: src/distroquery.c:402 src/distroquery.c:437
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Results in"
|
msgid "Results in"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:384
|
#: src/distroquery.c:405 src/distroquery.c:440
|
||||||
msgid "for arch "
|
msgid "for arch "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:393
|
#: src/distroquery.c:414
|
||||||
msgid "provides"
|
msgid "provides"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:456
|
#: src/distroquery.c:449
|
||||||
|
msgid "provides file "
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/distroquery.c:516
|
||||||
msgid "result(s) shown"
|
msgid "result(s) shown"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:459
|
#: src/distroquery.c:534
|
||||||
msgid "Search results for"
|
msgid "Search results for"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:523 src/distroquery.c:666
|
#: src/distroquery.c:604 src/distroquery.c:769
|
||||||
msgid "Version"
|
msgid "Version"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:528
|
#: src/distroquery.c:609
|
||||||
msgid "Size"
|
msgid "Size"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:531
|
#: src/distroquery.c:612
|
||||||
msgid "Related packages"
|
msgid "Related packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:559 src/distroquery.c:704
|
#: src/distroquery.c:641 src/distroquery.c:809
|
||||||
msgid "Developers details"
|
msgid "Developers details"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:561
|
#: src/distroquery.c:643
|
||||||
msgid "Source package"
|
msgid "Source package"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:567 src/distroquery.c:705
|
#: src/distroquery.c:649 src/distroquery.c:810
|
||||||
msgid "Maintainer"
|
msgid "Maintainer"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:568 src/distroquery.c:706
|
#: src/distroquery.c:650 src/distroquery.c:811
|
||||||
msgid "Build date"
|
msgid "Build date"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:571
|
#: src/distroquery.c:653
|
||||||
msgid "Obsoletes"
|
msgid "Obsoletes"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:583
|
#: src/distroquery.c:667
|
||||||
msgid "Provides"
|
msgid "Provides"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:597
|
#: src/distroquery.c:682
|
||||||
msgid "Requires"
|
msgid "Requires"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:673
|
#: src/distroquery.c:701
|
||||||
|
msgid "Files list"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#: src/distroquery.c:776
|
||||||
msgid "Built packages"
|
msgid "Built packages"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:709
|
#: src/distroquery.c:814
|
||||||
msgid "Source files"
|
msgid "Source files"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:718
|
#: src/distroquery.c:824
|
||||||
msgid "Patches"
|
msgid "Patches"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:728
|
#: src/distroquery.c:835
|
||||||
msgid "Build requirements"
|
msgid "Build requirements"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: src/distroquery.c:740
|
#: src/distroquery.c:849
|
||||||
msgid "Changelog"
|
msgid "Changelog"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
64
po/it.po
64
po/it.po
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: distromatic 1.4.1\n"
|
"Project-Id-Version: distromatic 1.4.1\n"
|
||||||
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
|
"Report-Msgid-Bugs-To: silvan.calarco@mambasoft.it\n"
|
||||||
"POT-Creation-Date: 2013-10-14 12:08+0200\n"
|
"POT-Creation-Date: 2013-10-15 00:07+0200\n"
|
||||||
"PO-Revision-Date: 2013-10-14 01:19+0200\n"
|
"PO-Revision-Date: 2013-10-14 01:19+0200\n"
|
||||||
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
|
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
|
||||||
"Language-Team: Italian\n"
|
"Language-Team: Italian\n"
|
||||||
@ -17,112 +17,120 @@ msgstr ""
|
|||||||
"Content-Transfer-Encoding: 8bit\n"
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||||
|
|
||||||
#: src/distroquery.c:178
|
#: src/distroquery.c:181
|
||||||
msgid "Source"
|
msgid "Source"
|
||||||
msgstr "Sorgente"
|
msgstr "Sorgente"
|
||||||
|
|
||||||
#: src/distroquery.c:204
|
#: src/distroquery.c:225
|
||||||
msgid "Search"
|
msgid "Search"
|
||||||
msgstr "Cerca"
|
msgstr "Cerca"
|
||||||
|
|
||||||
#: src/distroquery.c:238
|
#: src/distroquery.c:259
|
||||||
msgid "sources"
|
msgid "sources"
|
||||||
msgstr "sorgenti"
|
msgstr "sorgenti"
|
||||||
|
|
||||||
#: src/distroquery.c:249
|
#: src/distroquery.c:270
|
||||||
msgid "Search software packages"
|
msgid "Search software packages"
|
||||||
msgstr "Cerca pacchetti software"
|
msgstr "Cerca pacchetti software"
|
||||||
|
|
||||||
#: src/distroquery.c:354 src/distroquery.c:557 src/distroquery.c:702
|
#: src/distroquery.c:374 src/distroquery.c:639 src/distroquery.c:807
|
||||||
msgid "Download"
|
msgid "Download"
|
||||||
msgstr "Scarica"
|
msgstr "Scarica"
|
||||||
|
|
||||||
#: src/distroquery.c:363
|
#: src/distroquery.c:383
|
||||||
msgid "Details"
|
msgid "Details"
|
||||||
msgstr "Dettagli"
|
msgstr "Dettagli"
|
||||||
|
|
||||||
#: src/distroquery.c:380
|
#: src/distroquery.c:401 src/distroquery.c:436
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Other results in "
|
msgid "Other results in "
|
||||||
msgstr "Altri risultati in "
|
msgstr "Altri risultati in "
|
||||||
|
|
||||||
#: src/distroquery.c:381
|
#: src/distroquery.c:402 src/distroquery.c:437
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Results in"
|
msgid "Results in"
|
||||||
msgstr "Risultati in"
|
msgstr "Risultati in"
|
||||||
|
|
||||||
#: src/distroquery.c:384
|
#: src/distroquery.c:405 src/distroquery.c:440
|
||||||
msgid "for arch "
|
msgid "for arch "
|
||||||
msgstr "per l'architettura "
|
msgstr "per l'architettura "
|
||||||
|
|
||||||
#: src/distroquery.c:393
|
#: src/distroquery.c:414
|
||||||
msgid "provides"
|
msgid "provides"
|
||||||
msgstr "fornisce"
|
msgstr "fornisce"
|
||||||
|
|
||||||
#: src/distroquery.c:456
|
#: src/distroquery.c:449
|
||||||
|
msgid "provides file "
|
||||||
|
msgstr "fornisce il file "
|
||||||
|
|
||||||
|
#: src/distroquery.c:516
|
||||||
msgid "result(s) shown"
|
msgid "result(s) shown"
|
||||||
msgstr "risultati mostrati"
|
msgstr "risultati mostrati"
|
||||||
|
|
||||||
#: src/distroquery.c:459
|
#: src/distroquery.c:534
|
||||||
msgid "Search results for"
|
msgid "Search results for"
|
||||||
msgstr "Risultati della ricerca per"
|
msgstr "Risultati della ricerca per"
|
||||||
|
|
||||||
#: src/distroquery.c:523 src/distroquery.c:666
|
#: src/distroquery.c:604 src/distroquery.c:769
|
||||||
msgid "Version"
|
msgid "Version"
|
||||||
msgstr "Versione"
|
msgstr "Versione"
|
||||||
|
|
||||||
#: src/distroquery.c:528
|
#: src/distroquery.c:609
|
||||||
msgid "Size"
|
msgid "Size"
|
||||||
msgstr "Dimensione"
|
msgstr "Dimensione"
|
||||||
|
|
||||||
#: src/distroquery.c:531
|
#: src/distroquery.c:612
|
||||||
msgid "Related packages"
|
msgid "Related packages"
|
||||||
msgstr "Pacchetti collegati"
|
msgstr "Pacchetti collegati"
|
||||||
|
|
||||||
#: src/distroquery.c:559 src/distroquery.c:704
|
#: src/distroquery.c:641 src/distroquery.c:809
|
||||||
msgid "Developers details"
|
msgid "Developers details"
|
||||||
msgstr "Dettagli per gli sviluppatori"
|
msgstr "Dettagli per gli sviluppatori"
|
||||||
|
|
||||||
#: src/distroquery.c:561
|
#: src/distroquery.c:643
|
||||||
msgid "Source package"
|
msgid "Source package"
|
||||||
msgstr "Pacchetto sorgente"
|
msgstr "Pacchetto sorgente"
|
||||||
|
|
||||||
#: src/distroquery.c:567 src/distroquery.c:705
|
#: src/distroquery.c:649 src/distroquery.c:810
|
||||||
msgid "Maintainer"
|
msgid "Maintainer"
|
||||||
msgstr "Manutentore"
|
msgstr "Manutentore"
|
||||||
|
|
||||||
#: src/distroquery.c:568 src/distroquery.c:706
|
#: src/distroquery.c:650 src/distroquery.c:811
|
||||||
msgid "Build date"
|
msgid "Build date"
|
||||||
msgstr "Data di compilazione"
|
msgstr "Data di compilazione"
|
||||||
|
|
||||||
#: src/distroquery.c:571
|
#: src/distroquery.c:653
|
||||||
msgid "Obsoletes"
|
msgid "Obsoletes"
|
||||||
msgstr "Rende obsoleti"
|
msgstr "Rende obsoleti"
|
||||||
|
|
||||||
#: src/distroquery.c:583
|
#: src/distroquery.c:667
|
||||||
msgid "Provides"
|
msgid "Provides"
|
||||||
msgstr "Fornisce"
|
msgstr "Fornisce"
|
||||||
|
|
||||||
#: src/distroquery.c:597
|
#: src/distroquery.c:682
|
||||||
msgid "Requires"
|
msgid "Requires"
|
||||||
msgstr "Richiede"
|
msgstr "Richiede"
|
||||||
|
|
||||||
#: src/distroquery.c:673
|
#: src/distroquery.c:701
|
||||||
|
msgid "Files list"
|
||||||
|
msgstr "Lista dei file"
|
||||||
|
|
||||||
|
#: src/distroquery.c:776
|
||||||
msgid "Built packages"
|
msgid "Built packages"
|
||||||
msgstr "Pacchetti compilati"
|
msgstr "Pacchetti compilati"
|
||||||
|
|
||||||
#: src/distroquery.c:709
|
#: src/distroquery.c:814
|
||||||
msgid "Source files"
|
msgid "Source files"
|
||||||
msgstr "File sorgenti"
|
msgstr "File sorgenti"
|
||||||
|
|
||||||
#: src/distroquery.c:718
|
#: src/distroquery.c:824
|
||||||
msgid "Patches"
|
msgid "Patches"
|
||||||
msgstr "Patch"
|
msgstr "Patch"
|
||||||
|
|
||||||
#: src/distroquery.c:728
|
#: src/distroquery.c:835
|
||||||
msgid "Build requirements"
|
msgid "Build requirements"
|
||||||
msgstr "Requisiti per la compilazione"
|
msgstr "Requisiti per la compilazione"
|
||||||
|
|
||||||
#: src/distroquery.c:740
|
#: src/distroquery.c:849
|
||||||
msgid "Changelog"
|
msgid "Changelog"
|
||||||
msgstr "Modifiche"
|
msgstr "Modifiche"
|
||||||
|
@ -83,6 +83,9 @@ char *query = "";
|
|||||||
char *query_package;
|
char *query_package;
|
||||||
char *query_repository;
|
char *query_repository;
|
||||||
char *query_arch = NULL;
|
char *query_arch = NULL;
|
||||||
|
int query_limit = 10;
|
||||||
|
int query_offset = 0;
|
||||||
|
char query_next[PATH_MAX] = "";
|
||||||
char *lang = "";
|
char *lang = "";
|
||||||
int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 };
|
int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 };
|
||||||
|
|
||||||
@ -184,6 +187,24 @@ void printTagsLine(const char* arch, const char* tag, const char* group, const c
|
|||||||
tag, group, license);
|
tag, group, license);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char* resolveFilePath(sqlite3 *db, long id, char *buffer) {
|
||||||
|
|
||||||
|
long currid = id;
|
||||||
|
sqlite3_stmt *stmt;
|
||||||
|
char sql[PATH_MAX];
|
||||||
|
buffer[0]='\0';
|
||||||
|
|
||||||
|
do {
|
||||||
|
snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE id=%d", currid);
|
||||||
|
if (!sqlite3_prepare_v2(db, sql, strlen(sql), &stmt, NULL) == SQLITE_OK) return NULL;
|
||||||
|
if (sqlite3_step(stmt) != SQLITE_ROW) return NULL;
|
||||||
|
snprintf(sql, PATH_MAX, "/%s%s", sqlite3_column_text(stmt,1), buffer);
|
||||||
|
snprintf(buffer, PATH_MAX, "%s", sql);
|
||||||
|
currid = sqlite3_column_int(stmt,4); /* parent */
|
||||||
|
} while (currid >= 0);
|
||||||
|
return buffer;
|
||||||
|
}
|
||||||
|
|
||||||
void printInputForm() {
|
void printInputForm() {
|
||||||
struct configTag *ct = firstconfigtag;
|
struct configTag *ct = firstconfigtag;
|
||||||
|
|
||||||
@ -254,6 +275,7 @@ void printQueryData() {
|
|||||||
|
|
||||||
int a, i, j, k, numresults = 0, localresults, localprovidesresults;
|
int a, i, j, k, numresults = 0, localresults, localprovidesresults;
|
||||||
char dbname[PATH_MAX];
|
char dbname[PATH_MAX];
|
||||||
|
sqlite3 *dbf;
|
||||||
sqlite3_stmt *statement, *stmt1;
|
sqlite3_stmt *statement, *stmt1;
|
||||||
char sql[PATH_MAX];
|
char sql[PATH_MAX];
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
@ -304,7 +326,7 @@ void printQueryData() {
|
|||||||
"groupdescr LIKE 'Graphical Desktop/%%' DESC, groupdescr LIKE 'Applications/%%' DESC, "
|
"groupdescr LIKE 'Graphical Desktop/%%' DESC, groupdescr LIKE 'Applications/%%' DESC, "
|
||||||
"groupdescr LIKE 'Development/%%' ASC, groupdescr LIKE 'Documentation%%' ASC, groupdescr LIKE 'System/Libraries%%' ASC, "
|
"groupdescr LIKE 'Development/%%' ASC, groupdescr LIKE 'Documentation%%' ASC, groupdescr LIKE 'System/Libraries%%' ASC, "
|
||||||
"name LIKE '%%-devel' ASC, name LIKE '%%-debug' ASC "
|
"name LIKE '%%-devel' ASC, name LIKE '%%-debug' ASC "
|
||||||
"LIMIT 100", queryenc, queryenc, queryenc, queryenc, queryenc, queryenc);
|
"LIMIT %d OFFSET %d", queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, query_limit, query_offset);
|
||||||
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
|
||||||
while (sqlite3_step(statement) == SQLITE_ROW) {
|
while (sqlite3_step(statement) == SQLITE_ROW) {
|
||||||
numresults++;
|
numresults++;
|
||||||
@ -370,7 +392,7 @@ void printQueryData() {
|
|||||||
"(provides.id_package=packages.id AND provided.id=provides.id_provided) "
|
"(provides.id_package=packages.id AND provided.id=provides.id_provided) "
|
||||||
"AND provided.name LIKE '%%%s%%' "
|
"AND provided.name LIKE '%%%s%%' "
|
||||||
"ORDER BY provided.name = '%s' DESC, provided.name LIKE '%s%%' DESC, provided.name LIKE '%%%s%%' DESC "
|
"ORDER BY provided.name = '%s' DESC, provided.name LIKE '%s%%' DESC, provided.name LIKE '%%%s%%' DESC "
|
||||||
"LIMIT 100", queryenc, queryenc, queryenc, queryenc);
|
"LIMIT %d OFFSET %d", queryenc, queryenc, queryenc, queryenc, query_limit, query_offset);
|
||||||
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
|
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[a], sql, strlen(sql), &statement, NULL) == SQLITE_OK) {
|
||||||
while (sqlite3_step(statement) == SQLITE_ROW) {
|
while (sqlite3_step(statement) == SQLITE_ROW) {
|
||||||
numresults++;
|
numresults++;
|
||||||
@ -392,8 +414,47 @@ void printQueryData() {
|
|||||||
_("provides"),
|
_("provides"),
|
||||||
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, "provided", "name")));
|
||||||
}
|
}
|
||||||
if (localprovidesresults > 0) printf("</div>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* files search */
|
||||||
|
snprintf(dbname, PATH_MAX, "%s%s-%s-files.db",
|
||||||
|
query_repositories[i]->repository_dir,
|
||||||
|
query_repositories[i]->tag,
|
||||||
|
query_repositories[i]->arch[a]);
|
||||||
|
if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
|
||||||
|
snprintf(sql, PATH_MAX, "SELECT * FROM files,packages_files_rel "
|
||||||
|
"WHERE files.name LIKE '%%%s%%' AND "
|
||||||
|
"packages_files_rel.id_file = files.id "
|
||||||
|
"ORDER BY files.name = '%s' DESC, files.name LIKE '%s%%' DESC, "
|
||||||
|
"files.name LIKE '%%%s%%' DESC LIMIT %d OFFSET %d",
|
||||||
|
queryenc, queryenc, queryenc, queryenc, query_limit, query_offset);
|
||||||
|
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
while (sqlite3_step(stmt1) == 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(stmt1,sqlite3_find_column_id(stmt1, "packages_files_rel", "name")),
|
||||||
|
query_repositories[i]->arch[a],
|
||||||
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packages_files_rel", "name")),
|
||||||
|
_("provides file "),
|
||||||
|
resolveFilePath(dbf, sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id_file")), buffer));
|
||||||
|
}
|
||||||
|
sqlite3_finalize(stmt1);
|
||||||
|
}
|
||||||
|
sqlite3_close(dbf);
|
||||||
|
}
|
||||||
|
if (localprovidesresults > 0) printf("</div>");
|
||||||
|
|
||||||
sqlite3_finalize(statement);
|
sqlite3_finalize(statement);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -403,8 +464,8 @@ void printQueryData() {
|
|||||||
if (search_sources) {
|
if (search_sources) {
|
||||||
snprintf(sql, PATH_MAX,
|
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",
|
"ORDER BY name = '%s' DESC, name LIKE '%s%%' DESC, name LIKE '%%%s%%' DESC LIMIT %d OFFSET %d",
|
||||||
queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, queryenc);
|
queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, queryenc, query_limit, query_offset);
|
||||||
for (i = 0; query_repositories[i] != NULL; i++) {
|
for (i = 0; query_repositories[i] != NULL; i++) {
|
||||||
if (!query_repositories[i]->db[ARCHS_MAX]) {
|
if (!query_repositories[i]->db[ARCHS_MAX]) {
|
||||||
snprintf(dbname, PATH_MAX, "%s%s-sources.db", query_repositories[i]->repository_dir, query_repositories[i]->tag);
|
snprintf(dbname, PATH_MAX, "%s%s-sources.db", query_repositories[i]->repository_dir, query_repositories[i]->tag);
|
||||||
@ -452,7 +513,22 @@ void printQueryData() {
|
|||||||
printf("<hr>");
|
printf("<hr>");
|
||||||
|
|
||||||
printf("]]></queryreply>");
|
printf("]]></queryreply>");
|
||||||
printf("<querystatus><![CDATA[%d %s.]]></querystatus>", numresults, _("result(s) shown"));
|
printf("<querystatus><![CDATA[%d %s. ", numresults, _("result(s) shown"));
|
||||||
|
k = query_offset / query_limit + 1; /* k = current shown page */
|
||||||
|
if (k < 7) j=1; else j=k-5; /* j = start pages list from */
|
||||||
|
if (numresults < query_limit) {
|
||||||
|
/* current page is last available */
|
||||||
|
a=k;
|
||||||
|
j=a-10;
|
||||||
|
if (j <= 0) j=1;
|
||||||
|
} else a=j+9; /* a = number of page links displayed */
|
||||||
|
for (i = j; i <= a; i++) {
|
||||||
|
if (i != k) printf("<a href='javascript:distroquery_request(\"%s&limit=%d&offset=%d\")'>",
|
||||||
|
query_next, query_limit, query_limit * (i-1));
|
||||||
|
printf("%d", i);
|
||||||
|
printf("</a> ");
|
||||||
|
}
|
||||||
|
printf("]]></querystatus>");
|
||||||
|
|
||||||
printf("<title><![CDATA[%s '%s' :: %s]]></title>",
|
printf("<title><![CDATA[%s '%s' :: %s]]></title>",
|
||||||
_("Search results for"),
|
_("Search results for"),
|
||||||
@ -473,7 +549,7 @@ void printPackageData() {
|
|||||||
|
|
||||||
int a, i, j, k;
|
int a, i, j, k;
|
||||||
char dbname[PATH_MAX];
|
char dbname[PATH_MAX];
|
||||||
sqlite3 *db, *dbs, *dba;
|
sqlite3 *db, *dbs, *dbf;
|
||||||
sqlite3_stmt *statement, *stmt1, *stmt2;
|
sqlite3_stmt *statement, *stmt1, *stmt2;
|
||||||
char sql[PATH_MAX];
|
char sql[PATH_MAX];
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
@ -618,6 +694,20 @@ void printPackageData() {
|
|||||||
}
|
}
|
||||||
sqlite3_finalize(stmt1);
|
sqlite3_finalize(stmt1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* 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>", _("Files list"));
|
||||||
|
snprintf(sql, PATH_MAX, "SELECT * FROM packages_files_rel WHERE name='%s'", query_package);
|
||||||
|
if (sqlite3_prepare_v2(dbf, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
||||||
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
||||||
|
printf(" %s<br>", resolveFilePath(dbf, sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id_file")), buffer));
|
||||||
|
}
|
||||||
|
sqlite3_finalize(stmt1);
|
||||||
|
}
|
||||||
|
sqlite3_close(dbf);
|
||||||
|
}
|
||||||
sqlite3_close(dbs);
|
sqlite3_close(dbs);
|
||||||
}
|
}
|
||||||
snprintf(buffer, PATH_MAX, "%s - %s",
|
snprintf(buffer, PATH_MAX, "%s - %s",
|
||||||
@ -801,41 +891,56 @@ void parse_request_variables(char *data) {
|
|||||||
query_package = valuetok;
|
query_package = valuetok;
|
||||||
} else if (!strcmp(vartok, "arch")) {
|
} else if (!strcmp(vartok, "arch")) {
|
||||||
query_arch = valuetok;
|
query_arch = valuetok;
|
||||||
} else if (!strcmp(vartok, "query")) {
|
} else if (!strcmp(vartok, "offset")) {
|
||||||
query = url_decode(valuetok);
|
query_offset = atoi(url_decode(valuetok));
|
||||||
} else if (!strcmp(vartok, "search_milestone2")) {
|
if (query_offset < 0) query_offset = 0;
|
||||||
search_milestone2 = strstr(valuetok, "false") != valuetok;
|
} else if (!strcmp(vartok, "limit")) {
|
||||||
} else if (!strcmp(vartok, "search_milestone1")) {
|
query_limit = atoi(url_decode(valuetok));
|
||||||
search_milestone1 = strstr(valuetok, "false") != valuetok;
|
if (query_limit < 0) query_limit = 10;
|
||||||
} else if (!strcmp(vartok, "search_devel")) {
|
else if (query_limit > 20) query_limit = 20;
|
||||||
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[1] = strstr(valuetok, "false") != valuetok;
|
|
||||||
} else if (!strcmp(vartok, "search_arm")) {
|
|
||||||
query_archs[2] = strstr(valuetok, "false") != valuetok;
|
|
||||||
} else if (!strcmp(vartok, "search_sources")) {
|
|
||||||
search_sources = strstr(valuetok, "false") != valuetok;
|
|
||||||
} else if (!strcmp(vartok, "searchbox")) {
|
} else if (!strcmp(vartok, "searchbox")) {
|
||||||
searchbox = strstr(valuetok, "false") != valuetok;
|
searchbox = strstr(valuetok, "false") != valuetok;
|
||||||
} else if (!strcmp(vartok, "lang")) {
|
} else if (!strcmp(vartok, "lang")) {
|
||||||
lang = valuetok;
|
lang = valuetok;
|
||||||
|
} else {
|
||||||
|
/* fields to make reusable query string for next pages */
|
||||||
|
if (!strcmp(vartok, "query")) {
|
||||||
|
query = url_decode(valuetok);
|
||||||
|
} else if (!strcmp(vartok, "search_milestone2")) {
|
||||||
|
search_milestone2 = strstr(valuetok, "false") != valuetok;
|
||||||
|
} else if (!strcmp(vartok, "search_milestone1")) {
|
||||||
|
search_milestone1 = 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[1] = strstr(valuetok, "false") != valuetok;
|
||||||
|
} else if (!strcmp(vartok, "search_arm")) {
|
||||||
|
query_archs[2] = strstr(valuetok, "false") != valuetok;
|
||||||
|
} else if (!strcmp(vartok, "search_sources")) {
|
||||||
|
search_sources = strstr(valuetok, "false") != valuetok;
|
||||||
|
}
|
||||||
|
strcat(query_next, vartok);
|
||||||
|
strcat(query_next, "=");
|
||||||
|
strcat(query_next, valuetok);
|
||||||
|
strcat(query_next, "&");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (query_next[strlen(query_next)] == '&') query_next[strlen(query_next)] = '\0';
|
||||||
|
|
||||||
ct = firstconfigtag;
|
ct = firstconfigtag;
|
||||||
i = 0;
|
i = 0;
|
||||||
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;
|
||||||
}
|
}
|
||||||
ct = firstconfigtag;
|
ct = firstconfigtag;
|
||||||
while (ct) {
|
while (ct) {
|
||||||
if ((strstr(ct->tag, "milestone2") == ct->tag) && search_milestone2) query_repositories[i++] = ct;
|
if ((strstr(ct->tag, "milestone2") == ct->tag) && search_milestone2) query_repositories[i++] = ct;
|
||||||
ct = ct->next;
|
ct = ct->next;
|
||||||
}
|
}
|
||||||
ct = firstconfigtag;
|
ct = firstconfigtag;
|
||||||
while (ct) {
|
while (ct) {
|
||||||
if ((strstr(ct->tag, "milestone1") == ct->tag) && search_milestone1) query_repositories[i++] = ct;
|
if ((strstr(ct->tag, "milestone1") == ct->tag) && search_milestone1) query_repositories[i++] = ct;
|
||||||
ct = ct->next;
|
ct = ct->next;
|
||||||
|
Loading…
Reference in New Issue
Block a user