代码拉取完成,页面将自动刷新
commit 053f4ca3d18b5d36a84e43c8bc929d94b0e15068
Author: Michael Schroeder <mls@suse.de>
Date: Mon Mar 10 15:41:45 2014 -0400
Parse and generate sqlite for weak deps. data.
diff --git a/db.c b/db.c
index 80f87af..ae9552c 100644
--- a/db.c
+++ b/db.c
@@ -379,7 +379,8 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
" release TEXT,"
" pkgKey INTEGER %s)";
- const char *deps[] = { "requires", "provides", "conflicts", "obsoletes", NULL };
+ const char *deps[] = { "requires", "provides", "conflicts", "obsoletes",
+ "suggests", "enhances", "recommends", "supplements", NULL };
int i;
for (i = 0; deps[i]; i++) {
@@ -411,6 +412,10 @@ yum_db_create_primary_tables (sqlite3 *db, GError **err)
" DELETE FROM provides WHERE pkgKey = old.pkgKey;"
" DELETE FROM conflicts WHERE pkgKey = old.pkgKey;"
" DELETE FROM obsoletes WHERE pkgKey = old.pkgKey;"
+ " DELETE FROM suggests WHERE pkgKey = old.pkgKey;"
+ " DELETE FROM enhances WHERE pkgKey = old.pkgKey;"
+ " DELETE FROM recommends WHERE pkgKey = old.pkgKey;"
+ " DELETE FROM supplements WHERE pkgKey = old.pkgKey;"
" END;";
rc = sqlite3_exec (db, sql, NULL, NULL, NULL);
diff --git a/package.c b/package.c
index dfd9ed9..1ee626d 100644
--- a/package.c
+++ b/package.c
@@ -85,6 +85,26 @@ package_free (Package *package)
g_slist_free (package->obsoletes);
}
+ if (package->suggests) {
+ g_slist_foreach (package->suggests, (GFunc) g_free, NULL);
+ g_slist_free (package->suggests);
+ }
+
+ if (package->enhances) {
+ g_slist_foreach (package->enhances, (GFunc) g_free, NULL);
+ g_slist_free (package->enhances);
+ }
+
+ if (package->recommends) {
+ g_slist_foreach (package->recommends, (GFunc) g_free, NULL);
+ g_slist_free (package->recommends);
+ }
+
+ if (package->supplements) {
+ g_slist_foreach (package->supplements, (GFunc) g_free, NULL);
+ g_slist_free (package->supplements);
+ }
+
if (package->files) {
g_slist_foreach (package->files, (GFunc) g_free, NULL);
g_slist_free (package->files);
diff --git a/package.h b/package.h
index abce671..28a87ce 100644
--- a/package.h
+++ b/package.h
@@ -72,6 +72,10 @@ typedef struct {
GSList *provides;
GSList *conflicts;
GSList *obsoletes;
+ GSList *suggests;
+ GSList *enhances;
+ GSList *recommends;
+ GSList *supplements;
GSList *files;
GSList *changelogs;
diff --git a/sqlitecache.c b/sqlitecache.c
index 3857be7..ef4a703 100644
--- a/sqlitecache.c
+++ b/sqlitecache.c
@@ -155,6 +155,10 @@ typedef struct {
sqlite3_stmt *provides_handle;
sqlite3_stmt *conflicts_handle;
sqlite3_stmt *obsoletes_handle;
+ sqlite3_stmt *suggests_handle;
+ sqlite3_stmt *enhances_handle;
+ sqlite3_stmt *recommends_handle;
+ sqlite3_stmt *supplements_handle;
sqlite3_stmt *files_handle;
} PackageWriterInfo;
@@ -178,6 +182,18 @@ package_writer_info_init (UpdateInfo *update_info, sqlite3 *db, GError **err)
info->obsoletes_handle = yum_db_dependency_prepare (db, "obsoletes", err);
if (*err)
return;
+ info->suggests_handle = yum_db_dependency_prepare (db, "suggests", err);
+ if (*err)
+ return;
+ info->enhances_handle = yum_db_dependency_prepare (db, "enhances", err);
+ if (*err)
+ return;
+ info->recommends_handle = yum_db_dependency_prepare (db, "recommends", err);
+ if (*err)
+ return;
+ info->supplements_handle = yum_db_dependency_prepare (db, "supplements", err);
+ if (*err)
+ return;
info->files_handle = yum_db_file_prepare (db, err);
}
@@ -229,6 +245,14 @@ write_package_to_db (UpdateInfo *update_info, Package *package)
package->pkgKey, package->conflicts);
write_deps (update_info->db, info->obsoletes_handle,
package->pkgKey, package->obsoletes);
+ write_deps (update_info->db, info->suggests_handle,
+ package->pkgKey, package->suggests);
+ write_deps (update_info->db, info->enhances_handle,
+ package->pkgKey, package->enhances);
+ write_deps (update_info->db, info->recommends_handle,
+ package->pkgKey, package->recommends);
+ write_deps (update_info->db, info->supplements_handle,
+ package->pkgKey, package->supplements);
write_files (update_info->db, info->files_handle, package);
}
@@ -248,6 +272,14 @@ package_writer_info_clean (UpdateInfo *update_info)
sqlite3_finalize (info->conflicts_handle);
if (info->obsoletes_handle)
sqlite3_finalize (info->obsoletes_handle);
+ if (info->suggests_handle)
+ sqlite3_finalize (info->suggests_handle);
+ if (info->enhances_handle)
+ sqlite3_finalize (info->enhances_handle);
+ if (info->recommends_handle)
+ sqlite3_finalize (info->recommends_handle);
+ if (info->supplements_handle)
+ sqlite3_finalize (info->supplements_handle);
if (info->files_handle)
sqlite3_finalize (info->files_handle);
}
diff --git a/xml-parser.c b/xml-parser.c
index 35f04e6..03e1077 100644
--- a/xml-parser.c
+++ b/xml-parser.c
@@ -244,6 +244,18 @@ primary_parser_format_start (PrimarySAXContext *ctx,
} else if (!strcmp (name, "rpm:conflicts")) {
ctx->state = PRIMARY_PARSER_DEP;
ctx->current_dep_list = &sctx->current_package->conflicts;
+ } else if (!strcmp (name, "rpm:suggests")) {
+ ctx->state = PRIMARY_PARSER_DEP;
+ ctx->current_dep_list = &sctx->current_package->suggests;
+ } else if (!strcmp (name, "rpm:enhances")) {
+ ctx->state = PRIMARY_PARSER_DEP;
+ ctx->current_dep_list = &sctx->current_package->enhances;
+ } else if (!strcmp (name, "rpm:recommends")) {
+ ctx->state = PRIMARY_PARSER_DEP;
+ ctx->current_dep_list = &sctx->current_package->recommends;
+ } else if (!strcmp (name, "rpm:supplements")) {
+ ctx->state = PRIMARY_PARSER_DEP;
+ ctx->current_dep_list = &sctx->current_package->supplements;
}
else if (!strcmp (name, "file")) {
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。