[yum-cvs] yum-metadata-parser ChangeLog, 1.5, 1.6 sqlitecache.c, 1.5, 1.6 sqlitecachec.py, 1.2, 1.3
James Bowes
jbowes at linux.duke.edu
Thu Nov 23 01:22:51 UTC 2006
Update of /home/groups/yum/cvs/yum-metadata-parser
In directory login1.linux.duke.edu:/tmp/cvs-serv11924
Modified Files:
ChangeLog sqlitecache.c sqlitecachec.py
Log Message:
Display repoid while populating the cache.
Index: ChangeLog
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/ChangeLog,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ChangeLog 12 Jul 2006 05:40:02 -0000 1.5
+++ ChangeLog 23 Nov 2006 01:22:49 -0000 1.6
@@ -1,3 +1,8 @@
+2006-11-22 20:20 jbowes
+
+ * sqlitecache.c, sqlitecachec.py: Display repoid while populating
+ the cache.
+
2006-07-10 12:54 pnasrat
* db.c, db.h: Move to dbversion 9 - add pre for requires
Index: sqlitecache.c
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/sqlitecache.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sqlitecache.c 24 May 2006 20:03:11 -0000 1.5
+++ sqlitecache.c 23 Nov 2006 01:22:49 -0000 1.6
@@ -24,7 +24,8 @@
/* Make room for 2500 package ids, 40 bytes + '\0' each */
#define PACKAGE_IDS_CHUNK 41 * 2500
-typedef void (*ProgressFn) (guint32 current, guint32 total, gpointer user_data);
+typedef void (*ProgressFn) (guint32 current, guint32 total,
+ gpointer python_callback, gpointer user_data);
typedef struct {
sqlite3 *db;
@@ -38,6 +39,7 @@
GStringChunk *package_ids_chunk;
GTimer *timer;
ProgressFn progress_cb;
+ gpointer python_callback;
gpointer user_data;
} UpdateInfo;
@@ -215,6 +217,7 @@
if (info->count_from_md > 0 && info->progress_cb)
info->progress_cb (++info->packages_seen,
info->count_from_md,
+ info->python_callback,
info->user_data);
}
@@ -239,6 +242,7 @@
update_primary (const char *md_filename,
const char *checksum,
ProgressFn progress_cb,
+ gpointer python_callback,
gpointer user_data,
GError **err)
{
@@ -264,6 +268,7 @@
goto cleanup;
update_info->progress_cb = progress_cb;
+ update_info->python_callback = python_callback;
update_info->user_data = user_data;
package_writer_info_init (&info, update_info->db, err);
if (*err)
@@ -324,6 +329,7 @@
if (update_info->count_from_md > 0 && update_info->progress_cb)
update_info->progress_cb (++update_info->packages_seen,
update_info->count_from_md,
+ update_info->python_callback,
update_info->user_data);
}
@@ -331,6 +337,7 @@
update_filelist (const char *md_filename,
const char *checksum,
ProgressFn progress_cb,
+ gpointer python_callback,
gpointer user_data,
GError **err)
{
@@ -355,6 +362,7 @@
if (*err)
goto cleanup;
update_info->progress_cb = progress_cb;
+ update_info->python_callback = python_callback;
update_info->user_data = user_data;
info.pkg_handle = yum_db_package_ids_prepare (update_info->db, err);
if (*err)
@@ -425,6 +433,7 @@
if (update_info->count_from_md > 0 && update_info->progress_cb)
update_info->progress_cb (++update_info->packages_seen,
update_info->count_from_md,
+ update_info->python_callback,
update_info->user_data);
}
@@ -432,6 +441,7 @@
update_other (const char *md_filename,
const char *checksum,
ProgressFn progress_cb,
+ gpointer python_callback,
gpointer user_data,
GError **err)
{
@@ -456,6 +466,7 @@
if (*err)
goto cleanup;
update_info->progress_cb = progress_cb;
+ update_info->python_callback = python_callback;
update_info->user_data = user_data;
info.pkg_handle = yum_db_package_ids_prepare (update_info->db, err);
if (*err)
@@ -503,11 +514,13 @@
const char **md_filename,
const char **checksum,
PyObject **log,
- PyObject **progress)
+ PyObject **progress,
+ PyObject **repoid)
{
PyObject *callback;
- if (!PyArg_ParseTuple (args, "ssO", md_filename, checksum, &callback))
+ if (!PyArg_ParseTuple (args, "ssOO", md_filename, checksum, &callback,
+ repoid))
return FALSE;
if (PyObject_HasAttrString (callback, "log")) {
@@ -532,15 +545,20 @@
}
static void
-progress_cb (guint32 current, guint32 total, gpointer user_data)
- {
- PyObject *progress = (PyObject *) user_data;
+progress_cb (guint32 current, guint32 total, gpointer python_callback,
+ gpointer user_data)
+{
+ PyObject *progress = (PyObject *) python_callback;
+ PyObject *repoid = (PyObject *) user_data;
PyObject *args;
PyObject *result;
- args = PyTuple_New (2);
+ Py_INCREF(repoid);
+
+ args = PyTuple_New (3);
PyTuple_SET_ITEM (args, 0, PyInt_FromLong (current));
PyTuple_SET_ITEM (args, 1, PyInt_FromLong (total));
+ PyTuple_SET_ITEM (args, 2, repoid);
result = PyEval_CallObject (progress, args);
Py_DECREF (args);
@@ -587,6 +605,7 @@
typedef char * (*UpdateFn) (const char *md_filename,
const char *checksum,
ProgressFn progress_fn,
+ gpointer python_callback,
gpointer user_data,
GError **err);
@@ -597,12 +616,14 @@
const char *checksum = NULL;
PyObject *log = NULL;
PyObject *progress = NULL;
+ PyObject *repoid = NULL;
guint log_id = 0;
char *db_filename;
PyObject *ret = NULL;
GError *err = NULL;
- if (!py_parse_args (args, &md_filename, &checksum, &log, &progress))
+ if (!py_parse_args (args, &md_filename, &checksum, &log, &progress,
+ &repoid))
return NULL;
if (log) {
@@ -613,7 +634,7 @@
db_filename = update_fn (md_filename, checksum,
progress != NULL ? progress_cb : NULL,
- progress, &err);
+ progress, repoid, &err);
if (log_id)
g_log_remove_handler (NULL, log_id);
Index: sqlitecachec.py
===================================================================
RCS file: /home/groups/yum/cvs/yum-metadata-parser/sqlitecachec.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- sqlitecachec.py 6 Jun 2006 04:00:28 -0000 1.2
+++ sqlitecachec.py 23 Nov 2006 01:22:49 -0000 1.3
@@ -17,7 +17,8 @@
class RepodataParserSqlite:
def __init__(self, storedir, repoid, callback=None):
- self.callback = callback
+ self.callback = callback
+ self.repoid = repoid
def open_database(self, filename):
if not filename:
@@ -29,18 +30,21 @@
if required"""
return self.open_database(_sqlitecache.update_primary(location,
checksum,
- self.callback))
+ self.callback,
+ self.repoid))
def getFilelists(self, location, checksum):
"""Load filelist.xml.gz from an sqlite cache and update it if
required"""
return self.open_database(_sqlitecache.update_filelist(location,
checksum,
- self.callback))
+ self.callback,
+ self.repoid))
def getOtherdata(self, location, checksum):
"""Load other.xml.gz from an sqlite cache and update it if required"""
return self.open_database(_sqlitecache.update_other(location,
checksum,
- self.callback))
+ self.callback,
+ self.repoid))
More information about the Yum-cvs-commits
mailing list