distroquery: improvements in latest packages output

This commit is contained in:
Silvan Calarco 2013-10-27 19:26:29 +01:00
parent 5deae1025b
commit f15c8bf750
4 changed files with 309 additions and 150 deletions

View File

@ -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-22 11:52+0200\n" "POT-Creation-Date: 2013-10-27 19:23+0100\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,164 +17,184 @@ 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:185 #: src/distroquery.c:186
msgid "Source" msgid "Source"
msgstr "" msgstr ""
#: src/distroquery.c:271 #: src/distroquery.c:332
msgid "Search" msgid "Search"
msgstr "" msgstr ""
#: src/distroquery.c:305 #: src/distroquery.c:366
msgid "sources" msgid "sources"
msgstr "" msgstr ""
#: src/distroquery.c:309 #: src/distroquery.c:370
msgid "files" msgid "files"
msgstr "" msgstr ""
#: src/distroquery.c:320 #: src/distroquery.c:381
msgid "Search software packages" msgid "Search software packages"
msgstr "" msgstr ""
#: src/distroquery.c:369 #: src/distroquery.c:471
msgid "current path"
msgstr ""
#: src/distroquery.c:411
msgid "Provider(s)" msgid "Provider(s)"
msgstr "" msgstr ""
#: src/distroquery.c:547 src/distroquery.c:870 src/distroquery.c:1138 #: src/distroquery.c:620 src/distroquery.c:1139 src/distroquery.c:1406
msgid "Download" msgid "Download"
msgstr "" msgstr ""
#: src/distroquery.c:556 #: src/distroquery.c:629
msgid "Details" msgid "Details"
msgstr "" msgstr ""
#: src/distroquery.c:575 src/distroquery.c:629 #: src/distroquery.c:648 src/distroquery.c:702
#, c-format #, c-format
msgid "Other results in " msgid "Other results in "
msgstr "" msgstr ""
#: src/distroquery.c:576 src/distroquery.c:630 #: src/distroquery.c:649 src/distroquery.c:703
#, c-format #, c-format
msgid "Results in" msgid "Results in"
msgstr "" msgstr ""
#: src/distroquery.c:579 src/distroquery.c:633 #: src/distroquery.c:652 src/distroquery.c:706
msgid "for arch " msgid "for arch "
msgstr "" msgstr ""
#: src/distroquery.c:594 src/distroquery.c:605 #: src/distroquery.c:667 src/distroquery.c:678
msgid "provides" msgid "provides"
msgstr "" msgstr ""
#: src/distroquery.c:646 #: src/distroquery.c:719
msgid "provides directory" msgid "provides directory"
msgstr "" msgstr ""
#: src/distroquery.c:648 #: src/distroquery.c:721
msgid "provides symbolic link" msgid "provides symbolic link"
msgstr "" msgstr ""
#: src/distroquery.c:650 #: src/distroquery.c:723
msgid "provides file" msgid "provides file"
msgstr "" msgstr ""
#: src/distroquery.c:738 #: src/distroquery.c:811
msgid "result(s) shown" msgid "result(s) shown"
msgstr "" msgstr ""
#: src/distroquery.c:740 #: src/distroquery.c:813
msgid "result(s) found" msgid "result(s) found"
msgstr "" msgstr ""
#: src/distroquery.c:762 #: src/distroquery.c:835
msgid "Search results for" msgid "Search results for"
msgstr "" msgstr ""
#: src/distroquery.c:835 src/distroquery.c:1100 #: src/distroquery.c:909
msgid "Version" msgid "Updates"
msgstr "" msgstr ""
#: src/distroquery.c:840 #: src/distroquery.c:926
msgid "Size" msgid "Has older version than upstream package in"
msgstr ""
#: src/distroquery.c:843
msgid "Related packages"
msgstr ""
#: src/distroquery.c:872 src/distroquery.c:1140
msgid "Developers details"
msgstr ""
#: src/distroquery.c:874
msgid "Source package"
msgstr ""
#: src/distroquery.c:884 src/distroquery.c:886
msgid "Specfile"
msgstr ""
#: src/distroquery.c:889 src/distroquery.c:1142
msgid "Maintainer"
msgstr ""
#: src/distroquery.c:890 src/distroquery.c:1143
msgid "Build date"
msgstr ""
#: src/distroquery.c:900
msgid "Obsoletes"
msgstr ""
#: src/distroquery.c:918
msgid "Provides"
msgstr "" msgstr ""
#: src/distroquery.c:936 #: src/distroquery.c:936
msgid "Has same version as upstream package in"
msgstr ""
#: src/distroquery.c:957
msgid "Packages for"
msgstr ""
#: src/distroquery.c:974
msgid "Needs port to"
msgstr ""
#: src/distroquery.c:983
msgid "Latest changes:"
msgstr ""
#: src/distroquery.c:1104 src/distroquery.c:1368
msgid "Version"
msgstr ""
#: src/distroquery.c:1109
msgid "Size"
msgstr ""
#: src/distroquery.c:1112
msgid "Related packages"
msgstr ""
#: src/distroquery.c:1141 src/distroquery.c:1408
msgid "Developers details"
msgstr ""
#: src/distroquery.c:1143
msgid "Source package"
msgstr ""
#: src/distroquery.c:1153 src/distroquery.c:1155
msgid "Specfile"
msgstr ""
#: src/distroquery.c:1158 src/distroquery.c:1410
msgid "Maintainer"
msgstr ""
#: src/distroquery.c:1159 src/distroquery.c:1411
msgid "Build date"
msgstr ""
#: src/distroquery.c:1169
msgid "Obsoletes"
msgstr ""
#: src/distroquery.c:1187
msgid "Provides"
msgstr ""
#: src/distroquery.c:1205
msgid "Requires" msgid "Requires"
msgstr "" msgstr ""
#: src/distroquery.c:967 #: src/distroquery.c:1239
msgid "Required in" msgid "Required in"
msgstr "" msgstr ""
#: src/distroquery.c:967 src/distroquery.c:1004 #: src/distroquery.c:1239 src/distroquery.c:1275
msgid "by" msgid "by"
msgstr "" msgstr ""
#: src/distroquery.c:974 src/distroquery.c:1010 #: src/distroquery.c:1246 src/distroquery.c:1281
msgid "requires" msgid "requires"
msgstr "" msgstr ""
#: src/distroquery.c:1004 #: src/distroquery.c:1275
msgid "Build required in" msgid "Build required in"
msgstr "" msgstr ""
#: src/distroquery.c:1023 #: src/distroquery.c:1294
msgid "Files list" msgid "Files list"
msgstr "" msgstr ""
#: src/distroquery.c:1107 #: src/distroquery.c:1375
msgid "Built packages" msgid "Built packages"
msgstr "" msgstr ""
#: src/distroquery.c:1146 #: src/distroquery.c:1414
msgid "Source files" msgid "Source files"
msgstr "" msgstr ""
#: src/distroquery.c:1156 #: src/distroquery.c:1424
msgid "Patches" msgid "Patches"
msgstr "" msgstr ""
#: src/distroquery.c:1167 #: src/distroquery.c:1435
msgid "Build requirements" msgid "Build requirements"
msgstr "" msgstr ""
#: src/distroquery.c:1181 #: src/distroquery.c:1449
msgid "Changelog" msgid "Changelog"
msgstr "" msgstr ""

BIN
po/it.gmo

Binary file not shown.

113
po/it.po
View File

@ -7,174 +7,197 @@ 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-22 11:52+0200\n" "POT-Creation-Date: 2013-10-27 19:23+0100\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"
"Language: it\n" "Language: it\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=ASCII\n" "Content-Type: text/plain; charset=UTF-8\n"
"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:185 #: src/distroquery.c:186
msgid "Source" msgid "Source"
msgstr "Sorgente" msgstr "Sorgente"
#: src/distroquery.c:271 #: src/distroquery.c:332
msgid "Search" msgid "Search"
msgstr "Cerca" msgstr "Cerca"
#: src/distroquery.c:305 #: src/distroquery.c:366
msgid "sources" msgid "sources"
msgstr "sorgenti" msgstr "sorgenti"
#: src/distroquery.c:309 #: src/distroquery.c:370
msgid "files" msgid "files"
msgstr "file" msgstr "file"
#: src/distroquery.c:320 #: src/distroquery.c:381
msgid "Search software packages" msgid "Search software packages"
msgstr "Cerca pacchetti software" msgstr "Cerca pacchetti software"
#: src/distroquery.c:369 #: src/distroquery.c:471
msgid "current path"
msgstr "percorso corrente"
#: src/distroquery.c:411
msgid "Provider(s)" msgid "Provider(s)"
msgstr "Fornito da" msgstr "Fornito da"
#: src/distroquery.c:547 src/distroquery.c:870 src/distroquery.c:1138 #: src/distroquery.c:620 src/distroquery.c:1139 src/distroquery.c:1406
msgid "Download" msgid "Download"
msgstr "Scarica" msgstr "Scarica"
#: src/distroquery.c:556 #: src/distroquery.c:629
msgid "Details" msgid "Details"
msgstr "Dettagli" msgstr "Dettagli"
#: src/distroquery.c:575 src/distroquery.c:629 #: src/distroquery.c:648 src/distroquery.c:702
#, c-format #, c-format
msgid "Other results in " msgid "Other results in "
msgstr "Altri risultati in " msgstr "Altri risultati in "
#: src/distroquery.c:576 src/distroquery.c:630 #: src/distroquery.c:649 src/distroquery.c:703
#, c-format #, c-format
msgid "Results in" msgid "Results in"
msgstr "Risultati in" msgstr "Risultati in"
#: src/distroquery.c:579 src/distroquery.c:633 #: src/distroquery.c:652 src/distroquery.c:706
msgid "for arch " msgid "for arch "
msgstr "per l'architettura " msgstr "per l'architettura "
#: src/distroquery.c:594 src/distroquery.c:605 #: src/distroquery.c:667 src/distroquery.c:678
msgid "provides" msgid "provides"
msgstr "fornisce" msgstr "fornisce"
#: src/distroquery.c:646 #: src/distroquery.c:719
msgid "provides directory" msgid "provides directory"
msgstr "fornisce la cartella" msgstr "fornisce la cartella"
#: src/distroquery.c:648 #: src/distroquery.c:721
msgid "provides symbolic link" msgid "provides symbolic link"
msgstr "fornisce il link simbolico" msgstr "fornisce il link simbolico"
#: src/distroquery.c:650 #: src/distroquery.c:723
msgid "provides file" msgid "provides file"
msgstr "fornisce il file" msgstr "fornisce il file"
#: src/distroquery.c:738 #: src/distroquery.c:811
msgid "result(s) shown" msgid "result(s) shown"
msgstr "risultati mostrati" msgstr "risultati mostrati"
#: src/distroquery.c:740 #: src/distroquery.c:813
msgid "result(s) found" msgid "result(s) found"
msgstr "risultati trovati" msgstr "risultati trovati"
#: src/distroquery.c:762 #: src/distroquery.c:835
msgid "Search results for" msgid "Search results for"
msgstr "Risultati della ricerca per" msgstr "Risultati della ricerca per"
#: src/distroquery.c:835 src/distroquery.c:1100 #: src/distroquery.c:909
msgid "Updates"
msgstr "Aggiorna"
#: src/distroquery.c:926
msgid "Has older version than upstream package in"
msgstr "Ha una versione più vecchia del pacchetto corrente in"
#: src/distroquery.c:936
msgid "Has same version as upstream package in"
msgstr "Ha la stessa versione del pacchetto corrente in"
#: src/distroquery.c:957
msgid "Packages for"
msgstr "Pacchetti per"
#: src/distroquery.c:974
msgid "Needs port to"
msgstr "Richiede il porting per"
#: src/distroquery.c:983
msgid "Latest changes:"
msgstr "Modifiche recenti:"
#: src/distroquery.c:1104 src/distroquery.c:1368
msgid "Version" msgid "Version"
msgstr "Versione" msgstr "Versione"
#: src/distroquery.c:840 #: src/distroquery.c:1109
msgid "Size" msgid "Size"
msgstr "Dimensione" msgstr "Dimensione"
#: src/distroquery.c:843 #: src/distroquery.c:1112
msgid "Related packages" msgid "Related packages"
msgstr "Pacchetti collegati" msgstr "Pacchetti collegati"
#: src/distroquery.c:872 src/distroquery.c:1140 #: src/distroquery.c:1141 src/distroquery.c:1408
msgid "Developers details" msgid "Developers details"
msgstr "Dettagli per gli sviluppatori" msgstr "Dettagli per gli sviluppatori"
#: src/distroquery.c:874 #: src/distroquery.c:1143
msgid "Source package" msgid "Source package"
msgstr "Pacchetto sorgente" msgstr "Pacchetto sorgente"
#: src/distroquery.c:884 src/distroquery.c:886 #: src/distroquery.c:1153 src/distroquery.c:1155
msgid "Specfile" msgid "Specfile"
msgstr "Specfile" msgstr "Specfile"
#: src/distroquery.c:889 src/distroquery.c:1142 #: src/distroquery.c:1158 src/distroquery.c:1410
msgid "Maintainer" msgid "Maintainer"
msgstr "Manutentore" msgstr "Manutentore"
#: src/distroquery.c:890 src/distroquery.c:1143 #: src/distroquery.c:1159 src/distroquery.c:1411
msgid "Build date" msgid "Build date"
msgstr "Data di compilazione" msgstr "Data di compilazione"
#: src/distroquery.c:900 #: src/distroquery.c:1169
msgid "Obsoletes" msgid "Obsoletes"
msgstr "Rende obsoleti" msgstr "Rende obsoleti"
#: src/distroquery.c:918 #: src/distroquery.c:1187
msgid "Provides" msgid "Provides"
msgstr "Fornisce" msgstr "Fornisce"
#: src/distroquery.c:936 #: src/distroquery.c:1205
msgid "Requires" msgid "Requires"
msgstr "Richiede" msgstr "Richiede"
#: src/distroquery.c:967 #: src/distroquery.c:1239
msgid "Required in" msgid "Required in"
msgstr "Richiesto in" msgstr "Richiesto in"
#: src/distroquery.c:967 src/distroquery.c:1004 #: src/distroquery.c:1239 src/distroquery.c:1275
msgid "by" msgid "by"
msgstr "da" msgstr "da"
#: src/distroquery.c:974 src/distroquery.c:1010 #: src/distroquery.c:1246 src/distroquery.c:1281
msgid "requires" msgid "requires"
msgstr "richiede" msgstr "richiede"
#: src/distroquery.c:1004 #: src/distroquery.c:1275
msgid "Build required in" msgid "Build required in"
msgstr "Richiesto per la compilazione in" msgstr "Richiesto per la compilazione in"
#: src/distroquery.c:1023 #: src/distroquery.c:1294
msgid "Files list" msgid "Files list"
msgstr "Lista dei file" msgstr "Lista dei file"
#: src/distroquery.c:1107 #: src/distroquery.c:1375
msgid "Built packages" msgid "Built packages"
msgstr "Pacchetti compilati" msgstr "Pacchetti compilati"
#: src/distroquery.c:1146 #: src/distroquery.c:1414
msgid "Source files" msgid "Source files"
msgstr "File sorgenti" msgstr "File sorgenti"
#: src/distroquery.c:1156 #: src/distroquery.c:1424
msgid "Patches" msgid "Patches"
msgstr "Patch" msgstr "Patch"
#: src/distroquery.c:1167 #: src/distroquery.c:1435
msgid "Build requirements" msgid "Build requirements"
msgstr "Requisiti per la compilazione" msgstr "Requisiti per la compilazione"
#: src/distroquery.c:1181 #: src/distroquery.c:1449
msgid "Changelog" msgid "Changelog"
msgstr "Modifiche" msgstr "Modifiche"
#~ msgid "current path"
#~ msgstr "percorso corrente"

View File

@ -230,6 +230,28 @@ char* resolveFilePath(sqlite3 *db, long id, char *buffer) {
return buffer; return buffer;
} }
sqlite3* openRepositoryDatabase(struct configTag* ct, char* arch) {
char dbname[PATH_MAX];
sqlite3* db;
if (arch) {
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, arch);
if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
if (db) sqlite3_close(db);
fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
return NULL;
}
} else {
snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
if (db) sqlite3_close(db);
fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
return NULL;
}
}
return db;
}
void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) { void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
char dbname[PATH_MAX]; char dbname[PATH_MAX];
int i=0; int i=0;
@ -239,7 +261,7 @@ void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
while (ct->repository[i]) { while (ct->repository[i]) {
if (arch) { if (arch) {
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository[i]->repository_dir, ct->repository[i]->tag, arch); snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository[i]->repository_dir, ct->repository[i]->tag, arch);
snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s'", dbname, ct->repository[i]->tag); snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_%s'", dbname, ct->repository[i]->tag, arch);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) { if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg); fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
} }
@ -254,35 +276,39 @@ void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
} }
} }
void attachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch) { void attachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch, int source) {
char dbname[PATH_MAX]; char dbname[PATH_MAX];
char sql[PATH_MAX]; char sql[PATH_MAX];
char *errmsg; char *errmsg;
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, arch); snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, arch);
snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s'", dbname, ct->tag); snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_%s'", dbname, ct->tag, arch);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) { if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg); fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
} }
if (source) {
snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag); snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_sources'", dbname, ct->tag); snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_sources'", dbname, ct->tag);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) { if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg); fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
} }
}
} }
void detachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch) { void detachRepositoryDatabases(struct configTag* ct, sqlite3 *db, char* arch, int source) {
char sql[PATH_MAX]; char sql[PATH_MAX];
char *errmsg; char *errmsg;
snprintf(sql, PATH_MAX, "DETACH DATABASE '%s'", ct->tag); snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_%s'", ct->tag, arch);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) { if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg); fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
} }
if (source) {
snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_sources'", ct->tag); snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_sources'", ct->tag);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) { if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg); fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
} }
}
} }
void printInputForm() { void printInputForm() {
@ -401,8 +427,7 @@ void printFileBrowser() {
if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag); if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
printf("<hr>Repository %s, %s: ", query_repository, _("current path")); if (!query_arch) query_arch=strdup(ARCHS[0]);
snprintf(dbname, PATH_MAX, "%s%s-%s-files.db", ct->repository_dir, ct->tag, query_arch); 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)) { if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
startid = findFileIdFromPath(dbf, &query_path); startid = findFileIdFromPath(dbf, &query_path);
@ -474,6 +499,19 @@ void printFileBrowser() {
} }
int packageVerCmp(int e1, const char* v1, const char* r1, int e2, const char* v2, const char* r2) {
int vcmp = rpmvercmp(v1,v2);
int rcmp = rpmvercmp(r1,r2);
if ((e1 > e2) ||
((e1 == e2) && (vcmp > 0)) ||
((e1 == e2) && (vcmp == 0) && (rcmp >= 0)))
return 1;
else if ((e1 == e2) && (vcmp == 0) && (rcmp == 0))
return 0;
return -1;
}
void printQueryResponse() { void printQueryResponse() {
int a, i, j, k, numresults = 0, otherresults = 0, localresults = 0, localprovidesresults = 0, localsourceresults = 0; int a, i, j, k, numresults = 0, otherresults = 0, localresults = 0, localprovidesresults = 0, localsourceresults = 0;
@ -811,14 +849,15 @@ void printQueryResponse() {
void printSpecialQueryResponse() { void printSpecialQueryResponse() {
char *repository; char *repository;
char sql[PATH_MAX]; char sql[PATH_MAX];
char dbname[PATH_MAX];
char buffer[PATH_MAX]; char buffer[PATH_MAX];
sqlite3 *db; sqlite3 *db;
sqlite3 *dbb = NULL;
sqlite3_stmt *statement, *stmt1; sqlite3_stmt *statement, *stmt1;
struct configTag* ct; struct configTag* ct;
int i; int i,a, id, built_for_arch[ARCHS_MAX], built_for_arch_upstream[ARCHS_MAX];
long buildtime; long buildtime;
char updates[PATH_MAX]; char updates[PATH_MAX];
char warning[PATH_MAX];
humanDate strdate; humanDate strdate;
struct tm *ytm; struct tm *ytm;
@ -834,23 +873,32 @@ void printSpecialQueryResponse() {
timesec = mktime(ytm); timesec = mktime(ytm);
if (strstr(query, "$latest$") == query) { if (strstr(query, "$latest$") == query) {
/* latest packages in a repository */
repository = query + 8; repository = query + 8;
ct = findRepositoryByTag(repository); ct = findRepositoryByTag(repository);
if (!ct) return; if (!ct) return;
/* latest packages in a repository */ db = openRepositoryDatabase(ct, NULL);
snprintf(dbname, PATH_MAX, "%s%s-sources.db", ct->repository_dir, ct->tag);
if (sqlite3_open_v2(dbname, (sqlite3**)&db, SQLITE_OPEN_READONLY, NULL)) {
if (db) sqlite3_close(db);
fprintf(stderr, "ERROR: unable to open sqlite3 db %s\n", dbname);
return;
}
attachCtDatabases(ct, db, NULL); attachCtDatabases(ct, db, NULL);
if (ct->arch[0]) {
dbb = openRepositoryDatabase(ct, NULL);
if (!dbb) return;
for (a = 0; a < ARCHS_MAX && ct->arch[a]; a++) {
attachRepositoryDatabases(ct, dbb, ct->arch[a], 0);
}
}
if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag); if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
snprintf(sql, PATH_MAX, "SELECT * FROM sources ORDER BY buildtime DESC LIMIT 100"); snprintf(sql, PATH_MAX, "SELECT * FROM sources ORDER BY buildtime DESC LIMIT 100");
if (db && (sqlite3_prepare_v2(db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) { if (db && (sqlite3_prepare_v2(db, sql, strlen(sql), &statement, NULL) == SQLITE_OK)) {
/* loop packages in repository */
while (sqlite3_step(statement) == SQLITE_ROW) { while (sqlite3_step(statement) == SQLITE_ROW) {
i=0; i=0;
updates[0]=0; updates[0]=0;
warning[0]=0;
/* package in upstream repositories */
for (a = 0; a < ARCHS_MAX; a++) built_for_arch_upstream[a] = 0;
while (ct->repository[i]) { while (ct->repository[i]) {
if (ct->repository[i] == ct) break; if (ct->repository[i] == ct) break;
snprintf(sql, PATH_MAX, "SELECT * FROM '%s_sources'.sources WHERE name='%s'", snprintf(sql, PATH_MAX, "SELECT * FROM '%s_sources'.sources WHERE name='%s'",
@ -858,23 +906,81 @@ void printSpecialQueryResponse() {
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name"))); (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")));
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
if (sqlite3_step(stmt1) == SQLITE_ROW) { if (sqlite3_step(stmt1) == SQLITE_ROW) {
snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)", _("Updates"), snprintf(updates, PATH_MAX, "%s %s(%s,%s-%s)\n", _("Updates"),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")), (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
ct->repository[i]->tag, ct->repository[i]->tag,
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")), (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release"))); (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
id = sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "id"));
a = packageVerCmp(
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "epoch")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "epoch")),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
if (a <= 0) {
if (a < 0)
snprintf(warning + strlen(warning), PATH_MAX - strlen(warning),
"%s %s (%d:%s-%s <= %d:%s-%s)\n",
_("Has older version than upstream package in"),
ct->repository[i]->tag,
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "epoch")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "epoch")),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "version")),
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")));
else
snprintf(warning + strlen(warning), PATH_MAX - strlen(warning), "%s %s",
_("Has same version as upstream package in"),
ct->repository[i]->tag);
} }
sqlite3_finalize(stmt1); sqlite3_finalize(stmt1);
/* upstream built for archs */
for (a = 0; a < ARCHS_MAX && ct->repository[i]->arch[a]; a++) {
attachRepositoryDatabases(ct->repository[i], dbb, ct->repository[i]->arch[a], 0);
snprintf(sql, PATH_MAX, "SELECT id FROM '%s_%s'.packages WHERE id_source='%d'",
ct->repository[i]->tag, ct->repository[i]->arch[a], id);
if (sqlite3_prepare_v2(dbb, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
while (sqlite3_step(stmt1) == SQLITE_ROW) built_for_arch_upstream[a]++;
sqlite3_finalize(stmt1);
}
detachRepositoryDatabases(ct->repository[i], dbb, ct->repository[i]->arch[a], 0);
}
}
} }
i++; i++;
} }
/* built for archs */
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s: ", _("Packages for"));
for (a = 0; a < ARCHS_MAX; a++) built_for_arch[a] = 0;
for (a = 0; a < ARCHS_MAX && ct->arch[a]; a++) {
snprintf(sql, PATH_MAX, "SELECT id FROM '%s_%s'.packages WHERE id_source='%d'",
ct->repository[i]->tag, ct->arch[a],
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
if (sqlite3_prepare_v2(dbb, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
while (sqlite3_step(stmt1) == SQLITE_ROW) built_for_arch[a]++;
}
sqlite3_finalize(stmt1);
if (built_for_arch[a])
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "%s(%d) ", ct->arch[a], built_for_arch[a]);
}
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
for (a = 0; a < ARCHS_MAX; a++) {
if (built_for_arch_upstream[a] && ! built_for_arch[a])
snprintf(warning + strlen(warning), PATH_MAX - strlen(updates), "%s %s\n", _("Needs port to"), ct->arch[a]);
}
/* changelog */
snprintf(sql, PATH_MAX, "SELECT * FROM changelog,packagers " snprintf(sql, PATH_MAX, "SELECT * FROM changelog,packagers "
"WHERE id_source=%d AND changelog.id_packager=packagers.id " "WHERE id_source=%d AND changelog.id_packager=packagers.id "
"ORDER BY changelog.time DESC LIMIT 2", "ORDER BY changelog.time DESC LIMIT 2",
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id"))); sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n\n%s", _("Latest changes:")); snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s", _("Latest changes:"));
while (sqlite3_step(stmt1) == SQLITE_ROW) { while (sqlite3_step(stmt1) == SQLITE_ROW) {
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s - %s (%s)\n%s", snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n%s - %s (%s)\n%s",
(char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate), (char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
@ -882,14 +988,16 @@ void printSpecialQueryResponse() {
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")), (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text"))); (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
} }
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
// strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates)); // strncat(updates + strlen(updates) - 1, buffer, PATH_MAX - strlen(updates));
} }
get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX); get_favicon_from_url((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
if (updates[0] != 0) { if (updates[0] != 0) {
printf("<img src=\"/pub/openmamba/distromatic/pkgup.png\" title=\"%s\" width\"14\" height=\"14\">&nbsp;", updates); printf("<img src=\"%s/pkgup.png\" title=\"%s\" width=\"14\" height=\"14\">&nbsp;",
ct->configdefaults->url_dir, updates);
} else { } else {
printf("<img src=\"/pub/openmamba/distromatic/pkg.png\" width\"14\" height=\"14\">&nbsp;"); printf("<img src=\"%s/pkg.png\" width=\"14\" height=\"14\">&nbsp;", ct->configdefaults->url_dir);
} }
buildtime = sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")); buildtime = sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime"));
@ -902,13 +1010,19 @@ void printSpecialQueryResponse() {
printf("%s <img src=\"%s\" width\"12\" height=\"12\">&nbsp;", strdate, buffer); printf("%s <img src=\"%s\" width\"12\" height=\"12\">&nbsp;", strdate, buffer);
printf("<b><a href='/distribution/search.html?" printf("<b><a href='/distribution/search.html?"
"repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery' title=\"%s\">" "repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery' title=\"%s\">"
"%s</a></b> %s-%s<br>", "%s</a></b> %s-%s",
ct->tag, ct->tag,
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX), htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")), (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release"))); (const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")));
if (warning[0] != 0) {
printf("<img src=\"%s/warning-icon.png\" title=\"%s\" width=\"14\" height=\"14\">",
ct->configdefaults->url_dir, warning);
}
printf("<br>");
} }
sqlite3_finalize(statement); sqlite3_finalize(statement);
} }
@ -1101,13 +1215,13 @@ void printPackageData() {
sqlite3_finalize(statement); /* need to finalize all statements before detaching databases */ sqlite3_finalize(statement); /* need to finalize all statements before detaching databases */
/* required by */ /* required by */
for (i = 0; query_repositories[i] != NULL; i++) { for (i = 0; query_repositories[i] != NULL; i++) {
attachRepositoryDatabases(query_repositories[i], db, query_arch); attachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
snprintf(sql, PATH_MAX, snprintf(sql, PATH_MAX,
"SELECT packagesup.name AS requiredbyname, " "SELECT packagesup.name AS requiredbyname, "
"requiresup.requireflags AS requiredflags, " "requiresup.requireflags AS requiredflags, "
"requiresup.requireversion AS requiredversion " "requiresup.requireversion AS requiredversion "
"FROM '%s'.packages AS packagesup,'%s'.requires AS requiresup," "FROM '%s_%s'.packages AS packagesup,'%s_%s'.requires AS requiresup,"
"'%s'.provided AS providedup,provided,provides " "'%s_%s'.provided AS providedup,provided,provides "
"WHERE provides.id_package=%d AND provided.id=provides.id_provided " "WHERE provides.id_package=%d AND provided.id=provides.id_provided "
"AND packagesup.id=requiresup.id_package " "AND packagesup.id=requiresup.id_package "
"AND requiresup.id_provided=providedup.id " "AND requiresup.id_provided=providedup.id "
@ -1115,7 +1229,9 @@ void printPackageData() {
"AND NOT packagesup.name='%s' " "AND NOT packagesup.name='%s' "
"GROUP BY packagesup.name " "GROUP BY packagesup.name "
"ORDER BY packagesup.name", "ORDER BY packagesup.name",
query_repositories[i]->tag, query_repositories[i]->tag, query_repositories[i]->tag, query_repositories[i]->tag, query_arch,
query_repositories[i]->tag, query_arch,
query_repositories[i]->tag, query_arch,
package_id, query_package); package_id, query_package);
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) { if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
j=0; j=0;
@ -1134,12 +1250,12 @@ void printPackageData() {
} }
sqlite3_finalize(stmt1); sqlite3_finalize(stmt1);
} }
detachRepositoryDatabases(query_repositories[i], db, query_arch); detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
} }
/* build required by */ /* build required by */
for (i = 0; query_repositories[i] != NULL; i++) { for (i = 0; query_repositories[i] != NULL; i++) {
attachRepositoryDatabases(query_repositories[i], db, query_arch); attachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
snprintf(sql, PATH_MAX, snprintf(sql, PATH_MAX,
"SELECT sourcesup.name as buildrequiredbyname, " "SELECT sourcesup.name as buildrequiredbyname, "
"buildrequiresup.buildrequireflags as buildrequireflags, " "buildrequiresup.buildrequireflags as buildrequireflags, "
@ -1169,7 +1285,7 @@ void printPackageData() {
} }
sqlite3_finalize(stmt1); sqlite3_finalize(stmt1);
} }
detachRepositoryDatabases(query_repositories[i], db, query_arch); detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
} }
/* files list */ /* files list */