|
|
|
@ -78,7 +78,7 @@
|
|
|
|
|
// must be as big as ARCHS_MAX (5)
|
|
|
|
|
const char* ARCHS[ARCHS_MAX] = { "i586", "x86_64", "arm", "", "" };
|
|
|
|
|
|
|
|
|
|
static struct configTag *firstconfigtag = NULL, *configtag = NULL;
|
|
|
|
|
static struct configTag *firstconfigtag = NULL;
|
|
|
|
|
char *query = "";
|
|
|
|
|
char *query_package;
|
|
|
|
|
char *query_repository;
|
|
|
|
@ -91,6 +91,7 @@ char *reply_xmltag = "queryreply";
|
|
|
|
|
int reply_plain = 0;
|
|
|
|
|
char *lang = "";
|
|
|
|
|
int query_archs[ARCHS_MAX] = { 1, 0, 0, 0, 0 };
|
|
|
|
|
char *file_browser = NULL;
|
|
|
|
|
|
|
|
|
|
struct configTag *query_repositories[100];
|
|
|
|
|
|
|
|
|
@ -149,10 +150,9 @@ char *url_decode(char *str) {
|
|
|
|
|
|
|
|
|
|
int sqlite3_find_column_id(sqlite3_stmt *stmt, const char* table, const char* name) {
|
|
|
|
|
const char* colname;
|
|
|
|
|
const char* tablename;
|
|
|
|
|
int id = 0;
|
|
|
|
|
|
|
|
|
|
while (colname = sqlite3_column_name(stmt, id)) {
|
|
|
|
|
while ((colname = sqlite3_column_name(stmt, id))) {
|
|
|
|
|
if (!strcmp(colname, name)) {
|
|
|
|
|
if (table) {
|
|
|
|
|
if (!strcmp(sqlite3_column_table_name(stmt, id), table)) return id;
|
|
|
|
@ -219,7 +219,7 @@ char* resolveFilePath(sqlite3 *db, long id, char *buffer) {
|
|
|
|
|
buffer[0]='\0';
|
|
|
|
|
|
|
|
|
|
do {
|
|
|
|
|
snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE id=%d", currid);
|
|
|
|
|
snprintf(sql, PATH_MAX, "SELECT * FROM files WHERE id=%ld", 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);
|
|
|
|
@ -302,9 +302,17 @@ void printInputForm() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void printQueryData() {
|
|
|
|
|
void printFileBrowser() {
|
|
|
|
|
|
|
|
|
|
int a, i, j, k, numresults = 0, otherresults = 0, localresults, localprovidesresults, localsourceresults;
|
|
|
|
|
if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
|
|
|
|
|
|
|
|
|
|
if (!reply_plain) printf("]]></%s>", reply_xmltag);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void printQueryResponse() {
|
|
|
|
|
|
|
|
|
|
int a, i, j, k, numresults = 0, otherresults = 0, localresults = 0, localprovidesresults = 0, localsourceresults = 0;
|
|
|
|
|
char dbname[PATH_MAX];
|
|
|
|
|
sqlite3 *dbf;
|
|
|
|
|
sqlite3_stmt *statement, *stmt1;
|
|
|
|
@ -317,17 +325,7 @@ void printQueryData() {
|
|
|
|
|
for (i = 0; i < strlen(queryenc); i++) {
|
|
|
|
|
if (queryenc[i] == ' ') queryenc[i] = '%';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* 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) {
|
|
|
|
|
snprintf(dbname, PATH_MAX, "%sdistromatic.db", query_repositories[i]->repository_dir);
|
|
|
|
|
if (sqlite3_open_v2(dbname, (sqlite3**)&query_repositories[i]->db, SQLITE_OPEN_READONLY, NULL)) {
|
|
|
|
|
if (query_repositories[i]->db) sqlite3_close(query_repositories[i]->db);
|
|
|
|
|
query_repositories[i]->db = NULL;
|
|
|
|
|
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) {
|
|
|
|
@ -367,15 +365,15 @@ void printQueryData() {
|
|
|
|
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id_source")));
|
|
|
|
|
if (sqlite3_prepare_v2((sqlite3*)query_repositories[i]->db[ARCHS_MAX], sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
|
|
|
|
sqlite3_step(stmt1);
|
|
|
|
|
get_favicon_from_url(sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
get_favicon_from_url((const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
if (query_compact)
|
|
|
|
|
printf("<div style='position:relative'>");
|
|
|
|
|
else
|
|
|
|
|
printf("<div style='position:relative'><hr><br>");
|
|
|
|
|
printTagsLine(query_repositories[i]->arch[a],
|
|
|
|
|
query_repositories[i]->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
|
|
|
|
|
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
|
}
|
|
|
|
@ -384,21 +382,21 @@ void printQueryData() {
|
|
|
|
|
"repository=%s&package=%s&arch=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
|
|
|
|
|
"%s</a></b> %s-%s - %s<br>",
|
|
|
|
|
query_repositories[i]->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
query_repositories[i]->arch[a],
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
htmlcleanNoBr(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")),
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
|
|
|
|
} else {
|
|
|
|
|
printf("<b>%s</b> %s-%s<br>%s",
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
htmlcleanNoBr(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")),
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
|
|
|
|
|
|
|
|
|
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div>",
|
|
|
|
|
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
|
|
|
|
|
/* install */
|
|
|
|
|
/* printf("<div align=right style='position:absolute;top:5px;right:0;padding:5px;'>"
|
|
|
|
@ -534,7 +532,7 @@ void printQueryData() {
|
|
|
|
|
if (!query_repositories[i]->db[ARCHS_MAX]) {
|
|
|
|
|
snprintf(dbname, PATH_MAX, "%s%s-sources.db", query_repositories[i]->repository_dir, query_repositories[i]->tag);
|
|
|
|
|
if (sqlite3_open_v2(dbname, (sqlite3**)&query_repositories[i]->db[ARCHS_MAX], SQLITE_OPEN_READONLY, NULL)) {
|
|
|
|
|
if (query_repositories[i]->db) sqlite3_close(query_repositories[i]->db[a]);
|
|
|
|
|
if (query_repositories[i]->db[ARCHS_MAX]) sqlite3_close(query_repositories[i]->db[ARCHS_MAX]);
|
|
|
|
|
query_repositories[i]->db[ARCHS_MAX] = NULL;
|
|
|
|
|
fprintf(stderr, "ERROR: unable to open sqlite3 db %s; ignoring.\n", dbname);
|
|
|
|
|
}
|
|
|
|
@ -546,14 +544,14 @@ void printQueryData() {
|
|
|
|
|
numresults++;
|
|
|
|
|
localsourceresults++;
|
|
|
|
|
|
|
|
|
|
get_favicon_from_url(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 (!query_compact) printf("<hr><br>");
|
|
|
|
|
|
|
|
|
|
printTagsLine(NULL,
|
|
|
|
|
query_repositories[i]->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
|
|
|
|
|
|
|
|
|
printf("<br><img src=\"%s\" width\"16\" height=\"16\"> ", buffer);
|
|
|
|
|
if (query_compact) {
|
|
|
|
@ -561,26 +559,26 @@ void printQueryData() {
|
|
|
|
|
"repository=%s&package=%s&searchbox=true' style=\"color:black\" target='distroquery'>"
|
|
|
|
|
"%s</a></b> %s-%s - %s<br>",
|
|
|
|
|
query_repositories[i]->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
htmlcleanNoBr(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, "release")),
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
|
|
|
|
} else {
|
|
|
|
|
printf("<b>%s</b> %s-%s<br>%s<br><br>",
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
htmlcleanNoBr(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")),
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),buffer,PATH_MAX));
|
|
|
|
|
|
|
|
|
|
printf("<div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div>",
|
|
|
|
|
htmlcleanNoBr(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
htmlcleanNoBr((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
/* source details */
|
|
|
|
|
printf("<div style='display:inline;background-color:lightblue;font-weight:strong'>"
|
|
|
|
|
" <a href=#reply onclick='distroquery_request("
|
|
|
|
|
"\"repository=%s&package=%s\")' style=\"color:black\">Details</a> </div>",
|
|
|
|
|
query_repositories[i]->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")));
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(statement);
|
|
|
|
@ -633,30 +631,12 @@ void printQueryData() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void printPackageData() {
|
|
|
|
|
|
|
|
|
|
int a, i, j, k;
|
|
|
|
|
void attachCtDatabases(struct configTag* ct, sqlite3 *db) {
|
|
|
|
|
char dbname[PATH_MAX];
|
|
|
|
|
sqlite3 *db, *dbs, *dbf;
|
|
|
|
|
sqlite3_stmt *statement, *stmt1, *stmt2;
|
|
|
|
|
int i=0;
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char buffer[PATH_MAX];
|
|
|
|
|
char *errmsg;
|
|
|
|
|
struct configTag* ct = findRepositoryByTag(query_repository);
|
|
|
|
|
humanDate strdate;
|
|
|
|
|
sizeString strsize;
|
|
|
|
|
FILE *file;
|
|
|
|
|
|
|
|
|
|
int query_arch_num = find_query_arch(query_arch);
|
|
|
|
|
|
|
|
|
|
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, query_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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
i=0;
|
|
|
|
|
while (ct->repository[i]) {
|
|
|
|
|
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository[i]->repository_dir, ct->repository[i]->tag, query_arch);
|
|
|
|
|
snprintf(sql, PATH_MAX, "ATTACH DATABASE '%s' as '%s'", dbname, ct->repository[i]->tag);
|
|
|
|
@ -665,6 +645,29 @@ void printPackageData() {
|
|
|
|
|
}
|
|
|
|
|
i++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void printPackageData() {
|
|
|
|
|
|
|
|
|
|
int i, j;
|
|
|
|
|
char dbname[PATH_MAX];
|
|
|
|
|
sqlite3 *db, *dbs, *dbf;
|
|
|
|
|
sqlite3_stmt *statement, *stmt1, *stmt2;
|
|
|
|
|
char sql[PATH_MAX];
|
|
|
|
|
char buffer[PATH_MAX];
|
|
|
|
|
struct configTag* ct = findRepositoryByTag(query_repository);
|
|
|
|
|
humanDate strdate;
|
|
|
|
|
sizeString strsize;
|
|
|
|
|
FILE *file;
|
|
|
|
|
|
|
|
|
|
snprintf(dbname, PATH_MAX, "%s%s-%s.db", ct->repository_dir, ct->tag, query_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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
attachCtDatabases(ct, db);
|
|
|
|
|
|
|
|
|
|
if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
|
|
|
|
|
|
|
|
|
@ -691,22 +694,22 @@ void printPackageData() {
|
|
|
|
|
printf("<hr><br>");
|
|
|
|
|
printTagsLine(query_arch,
|
|
|
|
|
ct->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
|
|
|
|
|
(const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "license")));
|
|
|
|
|
|
|
|
|
|
get_favicon_from_url(sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
get_favicon_from_url((const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
|
|
|
|
|
printf("<br><br>"
|
|
|
|
|
"<h1><img src=\"%s\" width\"16\" height=\"16\"> "
|
|
|
|
|
"%s - %s</h1>%s: %s-%s<br>URL: <a href=\"%s\" target=_new>%s</a><br>%s: %s",
|
|
|
|
|
buffer,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),
|
|
|
|
|
(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, "summary")),
|
|
|
|
|
_("Version"),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
|
|
|
|
|
(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(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
|
|
|
|
|
(const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "url")),
|
|
|
|
|
_("Size"),
|
|
|
|
|
humanSize(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "size")), &strsize));
|
|
|
|
|
|
|
|
|
@ -718,14 +721,14 @@ void printPackageData() {
|
|
|
|
|
while (sqlite3_step(stmt2) == SQLITE_ROW)
|
|
|
|
|
printf(" <a href=#reply onclick='distroquery_request(\"repository=%s&package=%s&arch=%s\")'>%s(%s)</a>",
|
|
|
|
|
ct->tag,
|
|
|
|
|
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
|
|
|
|
|
(const char*)sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
|
|
|
|
|
query_arch,
|
|
|
|
|
sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
|
|
|
|
|
(const char*)sqlite3_column_text(stmt2,sqlite3_find_column_id(stmt2, NULL, "name")),
|
|
|
|
|
query_arch);
|
|
|
|
|
sqlite3_finalize(stmt2);
|
|
|
|
|
}
|
|
|
|
|
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
|
|
|
|
|
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
htmlclean((const char*)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
|
|
|
|
|
/* download */
|
|
|
|
|
printf("<div style='display:inline;background-color:green'>"
|
|
|
|
@ -733,9 +736,9 @@ void printPackageData() {
|
|
|
|
|
ct->download_prefix,
|
|
|
|
|
ct->download_dir,
|
|
|
|
|
query_arch,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
(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")),
|
|
|
|
|
query_arch,
|
|
|
|
|
_("Download"));
|
|
|
|
|
|
|
|
|
@ -744,11 +747,11 @@ void printPackageData() {
|
|
|
|
|
printf("<br>%s:", _("Source package"));
|
|
|
|
|
printf(" <a href=#reply onclick='distroquery_request(\"repository=%s&package=%s\")'>%s</a>",
|
|
|
|
|
ct->tag,
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
|
|
|
|
(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")));
|
|
|
|
|
|
|
|
|
|
snprintf(buffer, PATH_MAX, "%s/specs/%s.spec", ct->repository_dir, query_package);
|
|
|
|
|
if (file = fopen(buffer, "r")) {
|
|
|
|
|
if ((file = fopen(buffer, "r"))) {
|
|
|
|
|
fclose(file);
|
|
|
|
|
snprintf(buffer, PATH_MAX, "%s%s/specs/%s.spec", ct->showfile_prefix, ct->download_dir, query_package);
|
|
|
|
|
printf("<br>%s: <a href=\"%s\" target=_blank>%s.spec</a>", _("Specfile"), buffer, query_package);
|
|
|
|
@ -756,9 +759,9 @@ void printPackageData() {
|
|
|
|
|
printf("<br>%s: %s.spec", _("Specfile"), query_package);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("<br>%s: %s", _("Maintainer"), sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")));
|
|
|
|
|
printf("<br>%s: %s", _("Maintainer"), (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")));
|
|
|
|
|
printf("<br>%s: %s", _("Build date"),
|
|
|
|
|
simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildtime")), (humanDate *) & strdate));
|
|
|
|
|
(char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildtime")), (humanDate *) & strdate));
|
|
|
|
|
|
|
|
|
|
/* obsoletes */
|
|
|
|
|
snprintf(sql, PATH_MAX, "SELECT * FROM obsoletes WHERE id_package=%d",
|
|
|
|
@ -768,10 +771,10 @@ void printPackageData() {
|
|
|
|
|
j=0;
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
if (j++ == 0) printf("<br><br>%s:", _("Obsoletes"));
|
|
|
|
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoletename")));
|
|
|
|
|
printf(" %s", (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoletename")));
|
|
|
|
|
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteversion"))) {
|
|
|
|
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteflags")));
|
|
|
|
|
printf("%s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteversion")));
|
|
|
|
|
printf("%s", (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "obsoleteversion")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
@ -786,10 +789,10 @@ void printPackageData() {
|
|
|
|
|
j=0;
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
if (j++ == 0) printf("<br><br>%s:",_("Provides"));
|
|
|
|
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
|
|
|
|
printf(" %s", (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")));
|
|
|
|
|
if (sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideversion"))) {
|
|
|
|
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideflags")));
|
|
|
|
|
printf("%s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideversion")));
|
|
|
|
|
printf("%s", (const char*)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "provideversion")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
@ -883,7 +886,7 @@ void printPackageData() {
|
|
|
|
|
|
|
|
|
|
void printSourcePackageData() {
|
|
|
|
|
|
|
|
|
|
int a, i, j, k;
|
|
|
|
|
int a;
|
|
|
|
|
char dbname[PATH_MAX];
|
|
|
|
|
sqlite3 *db, *dba;
|
|
|
|
|
sqlite3_stmt *statement, *stmt1;
|
|
|
|
@ -892,7 +895,6 @@ void printSourcePackageData() {
|
|
|
|
|
struct configTag* ct = findRepositoryByTag(query_repository);
|
|
|
|
|
humanDate strdate;
|
|
|
|
|
sizeString strsize;
|
|
|
|
|
FILE *file;
|
|
|
|
|
|
|
|
|
|
if (!reply_plain) printf("<%s><![CDATA[", reply_xmltag);
|
|
|
|
|
|
|
|
|
@ -913,22 +915,22 @@ void printSourcePackageData() {
|
|
|
|
|
printf("<hr><br>");
|
|
|
|
|
printTagsLine(NULL,
|
|
|
|
|
ct->tag,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "groupdescr")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "license")));
|
|
|
|
|
|
|
|
|
|
get_favicon_from_url(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
get_favicon_from_url((char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),buffer,PATH_MAX);
|
|
|
|
|
|
|
|
|
|
printf("<br><br>"
|
|
|
|
|
"<h1><img src=\"%s\" width\"16\" height=\"16\"> "
|
|
|
|
|
"%s - %s</h1>%s: %s-%s<br>URL: <a href=\"%s\" target=_new>%s</a><br>Size: %s",
|
|
|
|
|
buffer,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")),
|
|
|
|
|
_("Version"),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "url")),
|
|
|
|
|
humanSize(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "size")), &strsize));
|
|
|
|
|
|
|
|
|
|
printf("<br>%s:", _("Built packages"));
|
|
|
|
@ -941,9 +943,9 @@ void printSourcePackageData() {
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW)
|
|
|
|
|
printf(" <a href=#reply onclick='distroquery_request(\"repository=%s&package=%s&arch=%s\")'>%s(%s)</a>",
|
|
|
|
|
ct->tag,
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
|
|
|
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
|
|
|
|
ct->arch[a],
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
|
|
|
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "name")),
|
|
|
|
|
ct->arch[a]);
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
|
}
|
|
|
|
@ -952,23 +954,23 @@ void printSourcePackageData() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
printf("<br><br><div style='text-align:justify;text-justify:inter-word;font-style:italic'>%s</div><br>",
|
|
|
|
|
htmlclean(sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
htmlclean((char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "description")),buffer,PATH_MAX));
|
|
|
|
|
|
|
|
|
|
/* download */
|
|
|
|
|
printf("<div style='display:inline;background-color:red'>"
|
|
|
|
|
" <a href=\"%s%s/SRPMS.base/%s-%s-%s.src.rpm\" style=\"color:white\">%s</a> </div>",
|
|
|
|
|
ct->download_prefix,
|
|
|
|
|
ct->download_dir,
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "version")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "release")),
|
|
|
|
|
_("Download"));
|
|
|
|
|
|
|
|
|
|
printf("<hr><br><b>%s:</b>", _("Developers details"));
|
|
|
|
|
|
|
|
|
|
printf("<br>%s: %s", _("Maintainer"), sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
|
|
|
|
|
printf("<br>%s: %s", _("Maintainer"), (char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, "packagers", "name")));
|
|
|
|
|
printf("<br>%s: %s", _("Build date"),
|
|
|
|
|
simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate));
|
|
|
|
|
(char *)simpleTimeToHuman(sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "buildtime")), (humanDate *) & strdate));
|
|
|
|
|
|
|
|
|
|
printf("<br><br>%s:", _("Source files"));
|
|
|
|
|
snprintf(sql, PATH_MAX,
|
|
|
|
@ -976,7 +978,7 @@ void printSourcePackageData() {
|
|
|
|
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
|
|
|
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "source")));
|
|
|
|
|
printf(" %s", (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "source")));
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
|
}
|
|
|
|
@ -986,7 +988,7 @@ void printSourcePackageData() {
|
|
|
|
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
|
|
|
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "patch")));
|
|
|
|
|
printf(" %s", (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "patch")));
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
|
}
|
|
|
|
@ -996,10 +998,10 @@ void printSourcePackageData() {
|
|
|
|
|
sqlite3_column_int(statement,sqlite3_find_column_id(statement, NULL, "id")));
|
|
|
|
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
printf(" %s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequirename")));
|
|
|
|
|
if (strcmp("", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequireversion")))) {
|
|
|
|
|
printf(" %s", (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequirename")));
|
|
|
|
|
if (strcmp("", (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequireversion")))) {
|
|
|
|
|
printRPMFlags(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequireflags")));
|
|
|
|
|
printf("%s", sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequireversion")));
|
|
|
|
|
printf("%s", (char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "buildrequireversion")));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
@ -1012,17 +1014,17 @@ void printSourcePackageData() {
|
|
|
|
|
if (sqlite3_prepare_v2(db, sql, strlen(sql), &stmt1, NULL) == SQLITE_OK) {
|
|
|
|
|
while (sqlite3_step(stmt1) == SQLITE_ROW) {
|
|
|
|
|
printf("%s - %s (%s)<br><pre>%s</pre>",
|
|
|
|
|
simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
|
|
|
|
|
sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
|
|
|
|
|
(char *)simpleTimeToHuman(sqlite3_column_int(stmt1,sqlite3_find_column_id(stmt1, NULL, "time")), (humanDate *) & strdate),
|
|
|
|
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, "packagers", "name")),
|
|
|
|
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "release")),
|
|
|
|
|
(char *)sqlite3_column_text(stmt1,sqlite3_find_column_id(stmt1, NULL, "text")));
|
|
|
|
|
}
|
|
|
|
|
sqlite3_finalize(stmt1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
snprintf(buffer, PATH_MAX, "%s - %s",
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")));
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "name")),
|
|
|
|
|
(char *)sqlite3_column_text(statement,sqlite3_find_column_id(statement, NULL, "summary")));
|
|
|
|
|
sqlite3_finalize(statement);
|
|
|
|
|
}
|
|
|
|
|
if (!reply_plain) printf("]]></%s>", reply_xmltag);
|
|
|
|
@ -1068,6 +1070,8 @@ void parse_request_variables(char *data) {
|
|
|
|
|
reply_plain = strstr(valuetok, "true") == valuetok;
|
|
|
|
|
} else if (!strcmp(vartok, "query_compact")) {
|
|
|
|
|
query_compact = strstr(valuetok, "true") == valuetok;
|
|
|
|
|
} else if (!strcmp(vartok, "file_browser")) {
|
|
|
|
|
file_browser = valuetok;
|
|
|
|
|
} else {
|
|
|
|
|
/* fields to make reusable query string for next pages */
|
|
|
|
|
if (!strcmp(vartok, "query")) {
|
|
|
|
@ -1121,9 +1125,8 @@ int
|
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
char *repository_dir = NULL;
|
|
|
|
|
// char *configfile = NULL;
|
|
|
|
|
char *data;
|
|
|
|
|
int responsed = 0;
|
|
|
|
|
|
|
|
|
|
// install backtrace handler
|
|
|
|
|
signal(SIGSEGV, backtraceHandler);
|
|
|
|
@ -1154,13 +1157,16 @@ main(int argc, char *argv[])
|
|
|
|
|
printPackageData();
|
|
|
|
|
else
|
|
|
|
|
printSourcePackageData();
|
|
|
|
|
if (searchbox) printInputForm();
|
|
|
|
|
responsed = 1;
|
|
|
|
|
} else if (query && strlen(query)) {
|
|
|
|
|
printQueryData();
|
|
|
|
|
if (searchbox) printInputForm();
|
|
|
|
|
} else {
|
|
|
|
|
printInputForm();
|
|
|
|
|
printQueryResponse();
|
|
|
|
|
responsed = 1;
|
|
|
|
|
} else if (file_browser) {
|
|
|
|
|
printFileBrowser();
|
|
|
|
|
responsed = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!responsed || (responsed && searchbox)) printInputForm();
|
|
|
|
|
|
|
|
|
|
if (!reply_plain) printf("</distroquery>\n");
|
|
|
|
|
exit(0);
|
|
|
|
|