rpms/yum-metadata-parser/devel yum-metadata-parser-1.1.2-delay-indexes.patch, NONE, 1.1 yum-metadata-parser-1.1.2-no-updates.patch, NONE, 1.1 yum-metadata-parser.spec, 1.24, 1.25

James Antill james at fedoraproject.org
Wed Oct 15 13:31:17 UTC 2008


Author: james

Update of /cvs/pkgs/rpms/yum-metadata-parser/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv1445

Modified Files:
	yum-metadata-parser.spec 
Added Files:
	yum-metadata-parser-1.1.2-delay-indexes.patch 
	yum-metadata-parser-1.1.2-no-updates.patch 
Log Message:
* Tue Oct 14 2008 James Antill <james at fedoraproject.org> 1.1.2-9
- Add delay indexes and no updates patches from upstream.
- Resolves: bug 465898


yum-metadata-parser-1.1.2-delay-indexes.patch:

--- NEW FILE yum-metadata-parser-1.1.2-delay-indexes.patch ---
commit 90e97a9c6cd8715b977af5c213d18c6f249e0f08
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Wed Sep 10 16:27:37 2008 -0400

    commit patches from Ville Skyttä to make indexes after the data has been
    inserted. Closed rh bug 461403

diff --git a/db.c b/db.c
index d2b51d6..a6af904 100644
--- a/db.c
+++ b/db.c
@@ -349,24 +349,6 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
         return;
     }
 
-    sql = "CREATE INDEX packagename ON packages (name)";
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create packagename index: %s",
-                     sqlite3_errmsg (db));
-        return;
-    }
-    
-    sql = "CREATE INDEX packageId ON packages (pkgId)";
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create packageId index: %s",
-                     sqlite3_errmsg (db));
-        return;
-    }
-
     sql =
         "CREATE TABLE files ("
         "  name TEXT,"
@@ -380,15 +362,6 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
         return;
     }
 
-    sql = "CREATE INDEX filenames ON files (name)";
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create filenames index: %s",
-                     sqlite3_errmsg (db));
-        return;
-    }
-
     sql =
         "CREATE TABLE %s ("
         "  name TEXT,"
@@ -401,9 +374,6 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
     const char *deps[] = { "requires", "provides", "conflicts", "obsoletes", NULL };
     int i;
 
-    const char *pkgindexsql = "CREATE INDEX pkg%s on %s (pkgKey)";
-    const char *nameindexsql = "CREATE INDEX %sname ON %s (name)";
-
     for (i = 0; deps[i]; i++) {
         const char *prereq;
         char *query;
@@ -423,6 +393,68 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
                          deps[i], sqlite3_errmsg (db));
             return;
         }
+    }
+
+    sql =
+        "CREATE TRIGGER removals AFTER DELETE ON packages"
+        "  BEGIN"
+        "    DELETE FROM files WHERE pkgKey = old.pkgKey;"
+        "    DELETE FROM requires WHERE pkgKey = old.pkgKey;"
+        "    DELETE FROM provides WHERE pkgKey = old.pkgKey;"
+        "    DELETE FROM conflicts WHERE pkgKey = old.pkgKey;"
+        "    DELETE FROM obsoletes WHERE pkgKey = old.pkgKey;"
+        "  END;";
+
+    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
+    if (rc != SQLITE_OK) {
+        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                     "Can not create removals trigger: %s",
+                     sqlite3_errmsg (db));
+        return;
+    }
+}
+
+void
+yum_db_index_primary_tables (sqlite3 *db, GError **err)
+{
+    int rc;
+    const char *sql;
+
+    sql = "CREATE INDEX IF NOT EXISTS packagename ON packages (name)";
+    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
+    if (rc != SQLITE_OK) {
+        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                     "Can not create packagename index: %s",
+                     sqlite3_errmsg (db));
+        return;
+    }
+    
+    sql = "CREATE INDEX IF NOT EXISTS packageId ON packages (pkgId)";
+    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
+    if (rc != SQLITE_OK) {
+        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                     "Can not create packageId index: %s",
+                     sqlite3_errmsg (db));
+        return;
+    }
+
+    sql = "CREATE INDEX IF NOT EXISTS filenames ON files (name)";
+    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
+    if (rc != SQLITE_OK) {
+        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
+                     "Can not create filenames index: %s",
+                     sqlite3_errmsg (db));
+        return;
+    }
+
+    const char *deps[] = { "requires", "provides", "conflicts", "obsoletes", NULL };
+    int i;
+
+    const char *pkgindexsql = "CREATE INDEX IF NOT EXISTS pkg%s on %s (pkgKey)";
+    const char *nameindexsql = "CREATE INDEX IF NOT EXISTS %sname ON %s (name)";
+
+    for (i = 0; deps[i]; i++) {
+        char *query;
 
         query = g_strdup_printf(pkgindexsql, deps[i], deps[i]);
         rc = sqlite3_exec (db, query, NULL, NULL, NULL);
@@ -445,25 +477,6 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
                 return;
             }
         }
-
-    }
-
-    sql =
-        "CREATE TRIGGER removals AFTER DELETE ON packages"
-        "  BEGIN"
-        "    DELETE FROM files WHERE pkgKey = old.pkgKey;"
-        "    DELETE FROM requires WHERE pkgKey = old.pkgKey;"
-        "    DELETE FROM provides WHERE pkgKey = old.pkgKey;"
-        "    DELETE FROM conflicts WHERE pkgKey = old.pkgKey;"
-        "    DELETE FROM obsoletes WHERE pkgKey = old.pkgKey;"
-        "  END;";
-
-    rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
-    if (rc != SQLITE_OK) {
-        g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create removals trigger: %s",
-                     sqlite3_errmsg (db));
-        return;
     }
 }
 
@@ -677,43 +690,50 @@ yum_db_create_filelist_tables (sqlite3 *db, GError **err)
         return;
     }
 
-    sql = "CREATE INDEX keyfile ON filelist (pkgKey)";
+    sql =
+        "CREATE TRIGGER remove_filelist AFTER DELETE ON packages"
+        "  BEGIN"
+        "    DELETE FROM filelist WHERE pkgKey = old.pkgKey;"
+        "  END;";
+
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create keyfile index: %s",
+                     "Can not create remove_filelist trigger: %s",
                      sqlite3_errmsg (db));
         return;
     }
+}
 
-    sql = "CREATE INDEX pkgId ON packages (pkgId)";
+void
+yum_db_index_filelist_tables (sqlite3 *db, GError **err)
+{
+    int rc;
+    const char *sql;
+
+    sql = "CREATE INDEX IF NOT EXISTS keyfile ON filelist (pkgKey)";
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create pkgId index: %s",
+                     "Can not create keyfile index: %s",
                      sqlite3_errmsg (db));
         return;
     }
 
-    sql = "CREATE INDEX dirnames ON filelist (dirname)";
+    sql = "CREATE INDEX IF NOT EXISTS pkgId ON packages (pkgId)";
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create dirnames index: %s",
+                     "Can not create pkgId index: %s",
                      sqlite3_errmsg (db));
         return;
     }
 
-    sql =
-        "CREATE TRIGGER remove_filelist AFTER DELETE ON packages"
-        "  BEGIN"
-        "    DELETE FROM filelist WHERE pkgKey = old.pkgKey;"
-        "  END;";
-
+    sql = "CREATE INDEX IF NOT EXISTS dirnames ON filelist (dirname)";
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create remove_filelist trigger: %s",
+                     "Can not create dirnames index: %s",
                      sqlite3_errmsg (db));
         return;
     }
@@ -852,34 +872,41 @@ yum_db_create_other_tables (sqlite3 *db, GError **err)
         return;
     }
 
-    sql = "CREATE INDEX keychange ON changelog (pkgKey)";
+    sql =
+        "CREATE TRIGGER remove_changelogs AFTER DELETE ON packages"
+        "  BEGIN"
+        "    DELETE FROM changelog WHERE pkgKey = old.pkgKey;"
+        "  END;";
+
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create keychange index: %s",
+                     "Can not create remove_changelogs trigger: %s",
                      sqlite3_errmsg (db));
         return;
     }
+}
 
-    sql = "CREATE INDEX pkgId ON packages (pkgId)";
+void
+yum_db_index_other_tables (sqlite3 *db, GError **err)
+{
+    int rc;
+    const char *sql;
+
+    sql = "CREATE INDEX IF NOT EXISTS keychange ON changelog (pkgKey)";
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create pkgId index: %s",
+                     "Can not create keychange index: %s",
                      sqlite3_errmsg (db));
         return;
     }
 
-    sql =
-        "CREATE TRIGGER remove_changelogs AFTER DELETE ON packages"
-        "  BEGIN"
-        "    DELETE FROM changelog WHERE pkgKey = old.pkgKey;"
-        "  END;";
-
+    sql = "CREATE INDEX IF NOT EXISTS pkgId ON packages (pkgId)";
     rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
     if (rc != SQLITE_OK) {
         g_set_error (err, YUM_DB_ERROR, YUM_DB_ERROR,
-                     "Can not create remove_changelogs trigger: %s",
+                     "Can not create pkgId index: %s",
                      sqlite3_errmsg (db));
         return;
     }
diff --git a/db.h b/db.h
index a91d329..fce455d 100644
--- a/db.h
+++ b/db.h
@@ -44,6 +44,7 @@ GHashTable   *yum_db_read_package_ids       (sqlite3 *db, GError **err);
 /* Primary */
 
 void          yum_db_create_primary_tables  (sqlite3 *db, GError **err);
+void          yum_db_index_primary_tables   (sqlite3 *db, GError **err);
 sqlite3_stmt *yum_db_package_prepare        (sqlite3 *db, GError **err);
 void          yum_db_package_write          (sqlite3 *db,
                                              sqlite3_stmt *handle,
@@ -67,6 +68,7 @@ void          yum_db_file_write             (sqlite3 *db,
 /* Filelists */
 
 void          yum_db_create_filelist_tables (sqlite3 *db, GError **err);
+void          yum_db_index_filelist_tables  (sqlite3 *db, GError **err);
 sqlite3_stmt *yum_db_package_ids_prepare    (sqlite3 *db, GError **err);
 void          yum_db_package_ids_write      (sqlite3 *db,
                                              sqlite3_stmt *handle,
@@ -79,6 +81,7 @@ void          yum_db_filelists_write        (sqlite3 *db,
 
 /* Other */
 void          yum_db_create_other_tables    (sqlite3 *db, GError **err);
+void          yum_db_index_other_tables     (sqlite3 *db, GError **err);
 sqlite3_stmt *yum_db_changelog_prepare      (sqlite3 *db, GError **err);
 void          yum_db_changelog_write        (sqlite3 *db,
                                              sqlite3_stmt *handle,
diff --git a/sqlitecache.c b/sqlitecache.c
index 63888b1..3857be7 100644
--- a/sqlitecache.c
+++ b/sqlitecache.c
@@ -37,6 +37,8 @@ typedef void (*XmlParseFn)  (const char *filename,
 
 typedef void (*WriteDbPackageFn) (UpdateInfo *update_info, Package *package);
 
+typedef void (*IndexTablesFn) (sqlite3 *db, GError **err);
+
 struct _UpdateInfo {
     sqlite3 *db;
     sqlite3_stmt *remove_handle;
@@ -55,6 +57,7 @@ struct _UpdateInfo {
     CreateTablesFn create_tables;
     WriteDbPackageFn write_package;
     XmlParseFn xml_parse;
+    IndexTablesFn index_tables;
 
     gpointer user_data;
 };
@@ -423,6 +426,10 @@ update_packages (UpdateInfo *update_info,
         goto cleanup;
     sqlite3_exec (update_info->db, "COMMIT", NULL, NULL, NULL);
 
+    update_info->index_tables (update_info->db, err);
+    if (*err)
+        goto cleanup;
+
     update_info_remove_old_entries (update_info);
     yum_db_dbinfo_update (update_info->db, checksum, err);
 
@@ -566,6 +573,7 @@ py_update_primary (PyObject *self, PyObject *args)
     info.update_info.create_tables = yum_db_create_primary_tables;
     info.update_info.write_package = write_package_to_db;
     info.update_info.xml_parse = yum_xml_parse_primary;
+    info.update_info.index_tables = yum_db_index_primary_tables;
 
     return py_update (self, args, (UpdateInfo *) &info);
 }
@@ -581,6 +589,7 @@ py_update_filelist (PyObject *self, PyObject *args)
     info.update_info.create_tables = yum_db_create_filelist_tables;
     info.update_info.write_package = write_filelist_package_to_db;
     info.update_info.xml_parse = yum_xml_parse_filelists;
+    info.update_info.index_tables = yum_db_index_filelist_tables;
 
     return py_update (self, args, (UpdateInfo *) &info);
 }
@@ -596,6 +605,7 @@ py_update_other (PyObject *self, PyObject *args)
     info.update_info.create_tables = yum_db_create_other_tables;
     info.update_info.write_package = write_other_package_to_db;
     info.update_info.xml_parse = yum_xml_parse_other;
+    info.update_info.index_tables = yum_db_index_other_tables;
 
     return py_update (self, args, (UpdateInfo *) &info);
 }

yum-metadata-parser-1.1.2-no-updates.patch:

--- NEW FILE yum-metadata-parser-1.1.2-no-updates.patch ---
commit c5033bfe5484ec3ecd49f1bf8801c6a8163df482
Author: James Antill <james at and.org>
Date:   Tue Oct 14 13:13:54 2008 -0400

    Turn off .sqlite updating from new .xml data, bug 465898

diff --git a/db.c b/db.c
index a6af904..a1e4fe8 100644
--- a/db.c
+++ b/db.c
@@ -19,6 +19,11 @@
 #include <unistd.h>
 #include "db.h"
 
+/*  We have a lot of code so we can "quickly" update the .sqlite file using
+ * the old .sqlite data and the new .xml data. However it seems to have weird
+ * edge cases where it doesn't work, rhbz 465898 etc. ... so we turn it off. */
+#define YMP_CONFIG_UPDATE_DB 0
+
 GQuark
 yum_db_error_quark (void)
 {
@@ -196,10 +201,13 @@ yum_db_open (const char *path,
                 return NULL;
                 break;
             case DB_STATUS_CHECKSUM_MISMATCH:
-                sqlite3_exec (db, "PRAGMA synchronous = 0", NULL, NULL, NULL);
-                sqlite3_exec (db, "DELETE FROM db_info", NULL, NULL, NULL);
-                return db;
-                break;
+                if (YMP_CONFIG_UPDATE_DB) {
+                    sqlite3_exec (db, "PRAGMA synchronous = 0", NULL,NULL,NULL);
+                    sqlite3_exec (db, "DELETE FROM db_info", NULL, NULL, NULL);
+                    return db;
+                    break;
+                }
+                /* FALL THROUGH */
             case DB_STATUS_VERSION_MISMATCH:
             case DB_STATUS_ERROR:
                 sqlite3_close (db);


Index: yum-metadata-parser.spec
===================================================================
RCS file: /cvs/pkgs/rpms/yum-metadata-parser/devel/yum-metadata-parser.spec,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- yum-metadata-parser.spec	14 Feb 2008 13:19:21 -0000	1.24
+++ yum-metadata-parser.spec	15 Oct 2008 13:30:46 -0000	1.25
@@ -4,10 +4,12 @@
 Summary: A fast metadata parser for yum
 Name: yum-metadata-parser
 Version: 1.1.2
-Release: 8%{?dist}
+Release: 9%{?dist}
 Source0: http://linux.duke.edu/projects/yum/download/%{name}/%{name}-%{version}.tar.gz
 Patch0: yum-metadata-parser-1.1.2-null-pkgid.patch
 Patch1: yum-metadata-parser-exclusive-lock.patch
+Patch2: yum-metadata-parser-1.1.2-delay-indexes.patch
+Patch3: yum-metadata-parser-1.1.2-no-updates.patch
 License: GPLv2
 Group: Development/Libraries
 URL: http://linux.duke.edu/projects/yum/
@@ -27,6 +29,8 @@
 %setup -q
 %patch0 -p1
 %patch1 -p1
+%patch2 -p1
+%patch3 -p1
 
 %build
 %{__python} setup.py build
@@ -49,6 +53,10 @@
 %{python_sitelib_platform}/*egg-info
 
 %changelog
+* Tue Oct 14 2008 James Antill <james at fedoraproject.org> 1.1.2-9
+- Add delay indexes and no updates patches from upstream.
+- Resolves: bug 465898
+
 * Thu Feb 14 2008 Seth Vidal <skvidal at fedoraproject.org> 1.1.2-8
 - bump for gcc 
 




More information about the scm-commits mailing list