当前仓库属于关闭状态,部分功能使用受限,详情请查阅 仓库状态说明
141 Star 0 Fork 4

src-openEuler/yum-metadata-parser
关闭

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
UPSTREAM-weak-deps.patch 6.06 KB
一键复制 编辑 原始数据 按行查看 历史
jinjin 提交于 2020-02-17 21:55 . init
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")) {
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-openeuler/yum-metadata-parser.git
git@gitee.com:src-openeuler/yum-metadata-parser.git
src-openeuler
yum-metadata-parser
yum-metadata-parser
master

搜索帮助