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 ""
"Project-Id-Version: distromatic 1.4.1\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"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,164 +17,184 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: src/distroquery.c:185
#: src/distroquery.c:186
msgid "Source"
msgstr ""
#: src/distroquery.c:271
#: src/distroquery.c:332
msgid "Search"
msgstr ""
#: src/distroquery.c:305
#: src/distroquery.c:366
msgid "sources"
msgstr ""
#: src/distroquery.c:309
#: src/distroquery.c:370
msgid "files"
msgstr ""
#: src/distroquery.c:320
#: src/distroquery.c:381
msgid "Search software packages"
msgstr ""
#: src/distroquery.c:369
msgid "current path"
msgstr ""
#: src/distroquery.c:411
#: src/distroquery.c:471
msgid "Provider(s)"
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"
msgstr ""
#: src/distroquery.c:556
#: src/distroquery.c:629
msgid "Details"
msgstr ""
#: src/distroquery.c:575 src/distroquery.c:629
#: src/distroquery.c:648 src/distroquery.c:702
#, c-format
msgid "Other results in "
msgstr ""
#: src/distroquery.c:576 src/distroquery.c:630
#: src/distroquery.c:649 src/distroquery.c:703
#, c-format
msgid "Results in"
msgstr ""
#: src/distroquery.c:579 src/distroquery.c:633
#: src/distroquery.c:652 src/distroquery.c:706
msgid "for arch "
msgstr ""
#: src/distroquery.c:594 src/distroquery.c:605
#: src/distroquery.c:667 src/distroquery.c:678
msgid "provides"
msgstr ""
#: src/distroquery.c:646
#: src/distroquery.c:719
msgid "provides directory"
msgstr ""
#: src/distroquery.c:648
#: src/distroquery.c:721
msgid "provides symbolic link"
msgstr ""
#: src/distroquery.c:650
#: src/distroquery.c:723
msgid "provides file"
msgstr ""
#: src/distroquery.c:738
#: src/distroquery.c:811
msgid "result(s) shown"
msgstr ""
#: src/distroquery.c:740
#: src/distroquery.c:813
msgid "result(s) found"
msgstr ""
#: src/distroquery.c:762
#: src/distroquery.c:835
msgid "Search results for"
msgstr ""
#: src/distroquery.c:835 src/distroquery.c:1100
msgid "Version"
#: src/distroquery.c:909
msgid "Updates"
msgstr ""
#: src/distroquery.c:840
msgid "Size"
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"
#: src/distroquery.c:926
msgid "Has older version than upstream package in"
msgstr ""
#: 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"
msgstr ""
#: src/distroquery.c:967
#: src/distroquery.c:1239
msgid "Required in"
msgstr ""
#: src/distroquery.c:967 src/distroquery.c:1004
#: src/distroquery.c:1239 src/distroquery.c:1275
msgid "by"
msgstr ""
#: src/distroquery.c:974 src/distroquery.c:1010
#: src/distroquery.c:1246 src/distroquery.c:1281
msgid "requires"
msgstr ""
#: src/distroquery.c:1004
#: src/distroquery.c:1275
msgid "Build required in"
msgstr ""
#: src/distroquery.c:1023
#: src/distroquery.c:1294
msgid "Files list"
msgstr ""
#: src/distroquery.c:1107
#: src/distroquery.c:1375
msgid "Built packages"
msgstr ""
#: src/distroquery.c:1146
#: src/distroquery.c:1414
msgid "Source files"
msgstr ""
#: src/distroquery.c:1156
#: src/distroquery.c:1424
msgid "Patches"
msgstr ""
#: src/distroquery.c:1167
#: src/distroquery.c:1435
msgid "Build requirements"
msgstr ""
#: src/distroquery.c:1181
#: src/distroquery.c:1449
msgid "Changelog"
msgstr ""

BIN
po/it.gmo

Binary file not shown.

113
po/it.po
View File

@ -7,174 +7,197 @@ msgid ""
msgstr ""
"Project-Id-Version: distromatic 1.4.1\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"
"Last-Translator: Silvan Calarco <silvan.calarco@mambasoft.it>\n"
"Language-Team: Italian\n"
"Language: it\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"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
#: src/distroquery.c:185
#: src/distroquery.c:186
msgid "Source"
msgstr "Sorgente"
#: src/distroquery.c:271
#: src/distroquery.c:332
msgid "Search"
msgstr "Cerca"
#: src/distroquery.c:305
#: src/distroquery.c:366
msgid "sources"
msgstr "sorgenti"
#: src/distroquery.c:309
#: src/distroquery.c:370
msgid "files"
msgstr "file"
#: src/distroquery.c:320
#: src/distroquery.c:381
msgid "Search software packages"
msgstr "Cerca pacchetti software"
#: src/distroquery.c:369
msgid "current path"
msgstr "percorso corrente"
#: src/distroquery.c:411
#: src/distroquery.c:471
msgid "Provider(s)"
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"
msgstr "Scarica"
#: src/distroquery.c:556
#: src/distroquery.c:629
msgid "Details"
msgstr "Dettagli"
#: src/distroquery.c:575 src/distroquery.c:629
#: src/distroquery.c:648 src/distroquery.c:702
#, c-format
msgid "Other results in "
msgstr "Altri risultati in "
#: src/distroquery.c:576 src/distroquery.c:630
#: src/distroquery.c:649 src/distroquery.c:703
#, c-format
msgid "Results in"
msgstr "Risultati in"
#: src/distroquery.c:579 src/distroquery.c:633
#: src/distroquery.c:652 src/distroquery.c:706
msgid "for arch "
msgstr "per l'architettura "
#: src/distroquery.c:594 src/distroquery.c:605
#: src/distroquery.c:667 src/distroquery.c:678
msgid "provides"
msgstr "fornisce"
#: src/distroquery.c:646
#: src/distroquery.c:719
msgid "provides directory"
msgstr "fornisce la cartella"
#: src/distroquery.c:648
#: src/distroquery.c:721
msgid "provides symbolic link"
msgstr "fornisce il link simbolico"
#: src/distroquery.c:650
#: src/distroquery.c:723
msgid "provides file"
msgstr "fornisce il file"
#: src/distroquery.c:738
#: src/distroquery.c:811
msgid "result(s) shown"
msgstr "risultati mostrati"
#: src/distroquery.c:740
#: src/distroquery.c:813
msgid "result(s) found"
msgstr "risultati trovati"
#: src/distroquery.c:762
#: src/distroquery.c:835
msgid "Search results for"
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"
msgstr "Versione"
#: src/distroquery.c:840
#: src/distroquery.c:1109
msgid "Size"
msgstr "Dimensione"
#: src/distroquery.c:843
#: src/distroquery.c:1112
msgid "Related packages"
msgstr "Pacchetti collegati"
#: src/distroquery.c:872 src/distroquery.c:1140
#: src/distroquery.c:1141 src/distroquery.c:1408
msgid "Developers details"
msgstr "Dettagli per gli sviluppatori"
#: src/distroquery.c:874
#: src/distroquery.c:1143
msgid "Source package"
msgstr "Pacchetto sorgente"
#: src/distroquery.c:884 src/distroquery.c:886
#: src/distroquery.c:1153 src/distroquery.c:1155
msgid "Specfile"
msgstr "Specfile"
#: src/distroquery.c:889 src/distroquery.c:1142
#: src/distroquery.c:1158 src/distroquery.c:1410
msgid "Maintainer"
msgstr "Manutentore"
#: src/distroquery.c:890 src/distroquery.c:1143
#: src/distroquery.c:1159 src/distroquery.c:1411
msgid "Build date"
msgstr "Data di compilazione"
#: src/distroquery.c:900
#: src/distroquery.c:1169
msgid "Obsoletes"
msgstr "Rende obsoleti"
#: src/distroquery.c:918
#: src/distroquery.c:1187
msgid "Provides"
msgstr "Fornisce"
#: src/distroquery.c:936
#: src/distroquery.c:1205
msgid "Requires"
msgstr "Richiede"
#: src/distroquery.c:967
#: src/distroquery.c:1239
msgid "Required in"
msgstr "Richiesto in"
#: src/distroquery.c:967 src/distroquery.c:1004
#: src/distroquery.c:1239 src/distroquery.c:1275
msgid "by"
msgstr "da"
#: src/distroquery.c:974 src/distroquery.c:1010
#: src/distroquery.c:1246 src/distroquery.c:1281
msgid "requires"
msgstr "richiede"
#: src/distroquery.c:1004
#: src/distroquery.c:1275
msgid "Build required in"
msgstr "Richiesto per la compilazione in"
#: src/distroquery.c:1023
#: src/distroquery.c:1294
msgid "Files list"
msgstr "Lista dei file"
#: src/distroquery.c:1107
#: src/distroquery.c:1375
msgid "Built packages"
msgstr "Pacchetti compilati"
#: src/distroquery.c:1146
#: src/distroquery.c:1414
msgid "Source files"
msgstr "File sorgenti"
#: src/distroquery.c:1156
#: src/distroquery.c:1424
msgid "Patches"
msgstr "Patch"
#: src/distroquery.c:1167
#: src/distroquery.c:1435
msgid "Build requirements"
msgstr "Requisiti per la compilazione"
#: src/distroquery.c:1181
#: src/distroquery.c:1449
msgid "Changelog"
msgstr "Modifiche"
#~ msgid "current path"
#~ msgstr "percorso corrente"

View File

@ -230,6 +230,28 @@ char* resolveFilePath(sqlite3 *db, long id, char *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) {
char dbname[PATH_MAX];
int i=0;
@ -239,7 +261,7 @@ void attachCtDatabases(struct configTag* ct, sqlite3 *db, char* arch) {
while (ct->repository[i]) {
if (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)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
}
@ -254,34 +276,38 @@ 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 sql[PATH_MAX];
char *errmsg;
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)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
}
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);
if (sqlite3_exec(db, sql, NULL, NULL, &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(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s_sources'", dbname, ct->tag);
if (sqlite3_exec(db, sql, NULL, NULL, &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 *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)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
}
snprintf(sql, PATH_MAX, "DETACH DATABASE '%s_sources'", ct->tag);
if (sqlite3_exec(db, sql, NULL, NULL, &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);
if (sqlite3_exec(db, sql, NULL, NULL, &errmsg)) {
fprintf(stderr, "ERROR: unable to exec statement for %s: %s\n", sql, errmsg);
}
}
}
@ -401,8 +427,7 @@ void printFileBrowser() {
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);
if (!sqlite3_open_v2(dbname, &dbf, SQLITE_OPEN_READONLY, NULL)) {
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() {
int a, i, j, k, numresults = 0, otherresults = 0, localresults = 0, localprovidesresults = 0, localsourceresults = 0;
@ -811,14 +849,15 @@ void printQueryResponse() {
void printSpecialQueryResponse() {
char *repository;
char sql[PATH_MAX];
char dbname[PATH_MAX];
char buffer[PATH_MAX];
sqlite3 *db;
sqlite3 *dbb = NULL;
sqlite3_stmt *statement, *stmt1;
struct configTag* ct;
int i;
int i,a, id, built_for_arch[ARCHS_MAX], built_for_arch_upstream[ARCHS_MAX];
long buildtime;
char updates[PATH_MAX];
char warning[PATH_MAX];
humanDate strdate;
struct tm *ytm;
@ -834,23 +873,32 @@ void printSpecialQueryResponse() {
timesec = mktime(ytm);
if (strstr(query, "$latest$") == query) {
/* latest packages in a repository */
repository = query + 8;
ct = findRepositoryByTag(repository);
if (!ct) return;
/* latest packages in a repository */
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;
}
db = openRepositoryDatabase(ct, 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);
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)) {
/* loop packages in repository */
while (sqlite3_step(statement) == SQLITE_ROW) {
i=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]) {
if (ct->repository[i] == ct) break;
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")));
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
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")),
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, "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);
/* 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);
}
}
sqlite3_finalize(stmt1);
}
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 "
"WHERE id_source=%d AND changelog.id_packager=packagers.id "
"ORDER BY changelog.time DESC LIMIT 2",
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
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) {
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),
@ -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, "text")));
}
snprintf(updates + strlen(updates), PATH_MAX - strlen(updates), "\n");
// 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);
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 {
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"));
@ -902,13 +1010,19 @@ void printSpecialQueryResponse() {
printf("%s <img src=\"%s\" width\"12\" height=\"12\">&nbsp;", strdate, buffer);
printf("<b><a href='/distribution/search.html?"
"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,
(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),
(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, "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);
}
@ -1101,13 +1215,13 @@ void printPackageData() {
sqlite3_finalize(statement); /* need to finalize all statements before detaching databases */
/* required by */
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,
"SELECT packagesup.name AS requiredbyname, "
"requiresup.requireflags AS requiredflags, "
"requiresup.requireversion AS requiredversion "
"FROM '%s'.packages AS packagesup,'%s'.requires AS requiresup,"
"'%s'.provided AS providedup,provided,provides "
"FROM '%s_%s'.packages AS packagesup,'%s_%s'.requires AS requiresup,"
"'%s_%s'.provided AS providedup,provided,provides "
"WHERE provides.id_package=%d AND provided.id=provides.id_provided "
"AND packagesup.id=requiresup.id_package "
"AND requiresup.id_provided=providedup.id "
@ -1115,7 +1229,9 @@ void printPackageData() {
"AND NOT packagesup.name='%s' "
"GROUP 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);
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
j=0;
@ -1134,12 +1250,12 @@ void printPackageData() {
}
sqlite3_finalize(stmt1);
}
detachRepositoryDatabases(query_repositories[i], db, query_arch);
detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
}
/* build required by */
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,
"SELECT sourcesup.name as buildrequiredbyname, "
"buildrequiresup.buildrequireflags as buildrequireflags, "
@ -1169,7 +1285,7 @@ void printPackageData() {
}
sqlite3_finalize(stmt1);
}
detachRepositoryDatabases(query_repositories[i], db, query_arch);
detachRepositoryDatabases(query_repositories[i], db, query_arch, 1);
}
/* files list */