[yum-cvs] yum-metadata-parser db.c, 1.8, 1.9 db.h, 1.4, 1.5 package.h, 1.2, 1.3 xml-parser.c, 1.7, 1.8
James Bowes
jbowes at linux.duke.edu
Tue Apr 10 22:30:43 UTC 2007
Update of /home/groups/yum/cvs/yum-metadata-parser
In directory login1.linux.duke.edu:/tmp/cvs-serv21117
Modified Files:
db.c db.h package.h xml-parser.c
Log Message:
Bump database version to 10
build_* and time_* values are stored as ints, rather than text, and
checksum_value has been dropped, as this is the same value as pkgId.
Index: db.c
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/db.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- db.c 3 Apr 2007 14:02:36 -0000 1.8
+++ db.c 10 Apr 2007 22:30:41 -0000 1.9
@@ -163,7 +163,7 @@
int rc;
const char *sql;
- sql = "CREATE TABLE db_info (dbversion TEXT, checksum TEXT)";
+ sql = "CREATE TABLE db_info (dbversion INTEGER, checksum TEXT)";
rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
if (rc != SQLITE_OK) {
g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
@@ -324,23 +324,22 @@
" summary TEXT,"
" description TEXT,"
" url TEXT,"
- " time_file TEXT,"
- " time_build TEXT,"
+ " time_file INTEGER,"
+ " time_build INTEGER,"
" rpm_license TEXT,"
" rpm_vendor TEXT,"
" rpm_group TEXT,"
" rpm_buildhost TEXT,"
" rpm_sourcerpm TEXT,"
- " rpm_header_start TEXT,"
- " rpm_header_end TEXT,"
+ " rpm_header_start INTEGER,"
+ " rpm_header_end INTEGER,"
" rpm_packager TEXT,"
- " size_package TEXT,"
- " size_installed TEXT,"
- " size_archive TEXT,"
+ " size_package INTEGER,"
+ " size_installed INTEGER,"
+ " size_archive INTEGER,"
" location_href TEXT,"
" location_base TEXT,"
- " checksum_type TEXT,"
- " checksum_value TEXT)";
+ " checksum_type TEXT)";
rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
if (rc != SQLITE_OK) {
@@ -372,7 +371,7 @@
"CREATE TABLE files ("
" name TEXT,"
" type TEXT,"
- " pkgKey TEXT)";
+ " pkgKey INTEGER)";
rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
if (rc != SQLITE_OK) {
g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
@@ -388,7 +387,7 @@
" epoch TEXT,"
" version TEXT,"
" release TEXT,"
- " pkgKey TEXT %s)";
+ " pkgKey INTEGER %s)";
const char *deps[] = { "requires", "provides", "conflicts", "obsoletes", NULL };
int i;
@@ -468,9 +467,9 @@
" url, time_file, time_build, rpm_license, rpm_vendor, rpm_group,"
" rpm_buildhost, rpm_sourcerpm, rpm_header_start, rpm_header_end,"
" rpm_packager, size_package, size_installed, size_archive,"
- " location_href, location_base, checksum_type, checksum_value) "
+ " location_href, location_base, checksum_type) "
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,"
- " ?, ?, ?, ?, ?, ?, ?, ?)";
+ " ?, ?, ?, ?, ?, ?, ?)";
rc = sqlite3_prepare (db, query, -1, &handle, NULL);
if (rc != SQLITE_OK) {
@@ -498,23 +497,22 @@
sqlite3_bind_text (handle, 7, p->summary, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 8, p->description, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 9, p->url, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 10, p->time_file, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 11, p->time_build, -1, SQLITE_STATIC);
+ sqlite3_bind_int (handle, 10, p->time_file);
+ sqlite3_bind_int (handle, 11, p->time_build);
sqlite3_bind_text (handle, 12, p->rpm_license, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 13, p->rpm_vendor, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 14, p->rpm_group, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 15, p->rpm_buildhost, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 16, p->rpm_sourcerpm, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 17, p->rpm_header_start, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 18, p->rpm_header_end, -1, SQLITE_STATIC);
+ sqlite3_bind_int (handle, 17, p->rpm_header_start);
+ sqlite3_bind_int (handle, 18, p->rpm_header_end);
sqlite3_bind_text (handle, 19, p->rpm_packager, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 20, p->size_package, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 21, p->size_installed, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 22, p->size_archive, -1, SQLITE_STATIC);
+ sqlite3_bind_int (handle, 20, p->size_package);
+ sqlite3_bind_int (handle, 21, p->size_installed);
+ sqlite3_bind_int (handle, 22, p->size_archive);
sqlite3_bind_text (handle, 23, p->location_href, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 24, p->location_base, -1, SQLITE_STATIC);
sqlite3_bind_text (handle, 25, p->checksum_type, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 26, p->checksum_value, -1, SQLITE_STATIC);
rc = sqlite3_step (handle);
sqlite3_reset (handle);
@@ -822,7 +820,7 @@
"CREATE TABLE changelog ("
" pkgKey INTEGER,"
" author TEXT,"
- " date TEXT,"
+ " date INTEGER,"
" changelog TEXT)";
rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
if (rc != SQLITE_OK) {
@@ -900,7 +898,7 @@
sqlite3_bind_int (handle, 1, p->pkgKey);
sqlite3_bind_text (handle, 2, entry->author, -1, SQLITE_STATIC);
- sqlite3_bind_text (handle, 3, entry->date, -1, SQLITE_STATIC);
+ sqlite3_bind_int (handle, 3, entry->date);
sqlite3_bind_text (handle, 4, entry->changelog, -1, SQLITE_STATIC);
rc = sqlite3_step (handle);
Index: db.h
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/db.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- db.h 18 Feb 2007 03:38:19 -0000 1.4
+++ db.h 10 Apr 2007 22:30:41 -0000 1.5
@@ -22,7 +22,7 @@
#include <sqlite3.h>
#include "package.h"
-#define YUM_SQLITE_CACHE_DBVERSION 9
+#define YUM_SQLITE_CACHE_DBVERSION 10
#define YUM_DB_ERROR yum_db_error_quark()
GQuark yum_db_error_quark (void);
Index: package.h
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/package.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- package.h 18 Feb 2007 03:38:19 -0000 1.2
+++ package.h 10 Apr 2007 22:30:41 -0000 1.3
@@ -36,7 +36,7 @@
typedef struct {
char *author;
- char *date;
+ gint64 date;
char *changelog;
} ChangelogEntry;
@@ -51,23 +51,22 @@
char *summary;
char *description;
char *url;
- char *time_file;
- char *time_build;
+ gint64 time_file;
+ gint64 time_build;
char *rpm_license;
char *rpm_vendor;
char *rpm_group;
char *rpm_buildhost;
char *rpm_sourcerpm;
- char *rpm_header_start;
- char *rpm_header_end;
+ gint64 rpm_header_start;
+ gint64 rpm_header_end;
char *rpm_packager;
- char *size_package;
- char *size_installed;
- char *size_archive;
+ gint64 size_package;
+ gint64 size_installed;
+ gint64 size_archive;
char *location_href;
char *location_base;
char *checksum_type;
- char *checksum_value;
GSList *requires;
GSList *provides;
Index: xml-parser.c
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/xml-parser.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- xml-parser.c 7 Apr 2007 23:52:49 -0000 1.7
+++ xml-parser.c 10 Apr 2007 22:30:41 -0000 1.8
@@ -162,9 +162,9 @@
value = attrs[++i];
if (!strcmp (attr, "file"))
- p->time_file = g_string_chunk_insert (p->chunk, value);
+ p->time_file = strtol(value, NULL, 10);
else if (!strcmp (attr, "build"))
- p->time_build = g_string_chunk_insert (p->chunk, value);
+ p->time_build = strtol(value, NULL, 10);
}
}
@@ -174,11 +174,11 @@
value = attrs[++i];
if (!strcmp (attr, "package"))
- p->size_package = g_string_chunk_insert (p->chunk, value);
+ p->size_package = strtol(value, NULL, 10);
else if (!strcmp (attr, "installed"))
- p->size_installed = g_string_chunk_insert (p->chunk, value);
+ p->size_installed = strtol(value, NULL, 10);
else if (!strcmp (attr, "archive"))
- p->size_archive = g_string_chunk_insert (p->chunk, value);
+ p->size_archive = strtol(value, NULL, 10);
}
}
@@ -213,9 +213,9 @@
value = attrs[++i];
if (!strcmp (attr, "start"))
- p->rpm_header_start = g_string_chunk_insert (p->chunk, value);
+ p->rpm_header_start = strtol(value, NULL, 10);
else if (!strcmp (attr, "end"))
- p->rpm_header_end = g_string_chunk_insert (p->chunk, value);
+ p->rpm_header_end = strtol(value, NULL, 10);
}
}
@@ -366,10 +366,9 @@
ctx->text_buffer->str,
ctx->text_buffer->len);
else if (!strcmp (name, "checksum"))
- p->checksum_value = p->pkgId =
- g_string_chunk_insert_len (p->chunk,
- ctx->text_buffer->str,
- ctx->text_buffer->len);
+ p->pkgId = g_string_chunk_insert_len (p->chunk,
+ ctx->text_buffer->str,
+ ctx->text_buffer->len);
else if (!strcmp (name, "summary"))
p->summary = g_string_chunk_insert_len (p->chunk,
ctx->text_buffer->str,
@@ -928,8 +927,7 @@
ctx->current_entry->author =
g_string_chunk_insert_const (p->chunk, value);
else if (!strcmp (attr, "date"))
- ctx->current_entry->date =
- g_string_chunk_insert_const (p->chunk, value);
+ ctx->current_entry->date = strtol(value, NULL, 10);
}
}
}
More information about the Yum-cvs-commits
mailing list