Backport: Add support for modular updateinfo.xml data

This commit is contained in:
Pavla Kratochvilova 2019-02-26 08:52:28 +01:00
parent 4358b5aada
commit a46425354d
3 changed files with 164 additions and 1 deletions

View File

@ -0,0 +1,101 @@
From aac9f0c2d791fa96bc9423231050f9e18fb973d6 Mon Sep 17 00:00:00 2001
From: Jaroslav Mracek <jmracek@redhat.com>
Date: Thu, 17 Jan 2019 12:48:05 +0100
Subject: [PATCH] Add support for modular updateinfo.xml data
---
ext/repo_updateinfoxml.c | 37 +++++++++++++++++++++++++++++++++++++
src/knownid.h | 8 ++++++++
2 files changed, 45 insertions(+)
diff --git a/ext/repo_updateinfoxml.c b/ext/repo_updateinfoxml.c
index ff84d32..8a3d147 100644
--- a/ext/repo_updateinfoxml.c
+++ b/ext/repo_updateinfoxml.c
@@ -37,6 +37,7 @@
* <pkglist>
* <collection short="F8">
* <name>Fedora 8</name>
+ * <module name="pki-deps" stream="10.6" version="20181019123559" context="9edba152" arch="x86_64"/>
* <package arch="ppc64" name="imlib-debuginfo" release="6.fc8" src="http://download.fedoraproject.org/pub/fedora/linux/updates/8/ppc64/imlib-debuginfo-1.9.15-6.fc8.ppc64.rpm" version="1.9.15">
* <filename>imlib-debuginfo-1.9.15-6.fc8.ppc64.rpm</filename>
* <reboot_suggested>True</reboot_suggested>
@@ -70,6 +71,7 @@ enum state {
STATE_RELOGIN,
STATE_RIGHTS,
STATE_SEVERITY,
+ STATE_MODULE,
NUMSTATES
};
@@ -92,6 +94,7 @@ static struct solv_xmlparser_element stateswitches[] = {
{ STATE_PKGLIST, "collection", STATE_COLLECTION, 0 },
{ STATE_COLLECTION, "name", STATE_NAME, 1 },
{ STATE_COLLECTION, "package", STATE_PACKAGE, 0 },
+ { STATE_COLLECTION, "module", STATE_MODULE, 0 },
{ STATE_PACKAGE, "filename", STATE_FILENAME, 1 },
{ STATE_PACKAGE, "reboot_suggested",STATE_REBOOT, 1 },
{ STATE_PACKAGE, "restart_suggested",STATE_RESTART, 1 },
@@ -321,6 +324,40 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
repodata_set_id(pd->data, pd->collhandle, UPDATE_COLLECTION_ARCH, a);
break;
}
+ case STATE_MODULE:
+ {
+ const char *name = 0, *stream = 0, *version = 0, *context = 0, *arch = 0;
+ Id name_id, stream_id, version_id, context_id, arch_id = 0;
+ for (; *atts; atts += 2)
+ {
+ if (!strcmp(*atts, "arch"))
+ arch = atts[1];
+ else if (!strcmp(*atts, "name"))
+ name = atts[1];
+ else if (!strcmp(*atts, "stream"))
+ stream = atts[1];
+ else if (!strcmp(*atts, "version"))
+ version = atts[1];
+ else if (!strcmp(*atts, "context"))
+ context = atts[1];
+ }
+ name_id = pool_str2id(pool, name, 1);
+ if (arch)
+ arch_id = pool_str2id(pool, arch, 1);
+ stream_id = pool_str2id(pool, stream, 1);
+ version_id = pool_str2id(pool, version, 1);
+ context_id = pool_str2id(pool, context, 1);
+
+ Id module_handle = repodata_new_handle(pd->data);
+ repodata_set_id(pd->data, module_handle, UPDATE_MODULE_NAME, name_id);
+ repodata_set_id(pd->data, module_handle, UPDATE_MODULE_STREAM, stream_id);
+ repodata_set_id(pd->data, module_handle, UPDATE_MODULE_VERSION, version_id);
+ repodata_set_id(pd->data, module_handle, UPDATE_MODULE_CONTEXT, context_id);
+ if (arch_id)
+ repodata_set_id(pd->data, module_handle, UPDATE_MODULE_ARCH, arch_id);
+ repodata_add_flexarray(pd->data, pd->handle, UPDATE_MODULE, module_handle);
+ break;
+ }
default:
break;
diff --git a/src/knownid.h b/src/knownid.h
index 8e53183..b5b41d6 100644
--- a/src/knownid.h
+++ b/src/knownid.h
@@ -250,6 +250,14 @@ KNOWNID(SIGNATURE_TIME, "signature:time"),
KNOWNID(SIGNATURE_EXPIRES, "signature:expires"),
KNOWNID(SIGNATURE_DATA, "signature:data"),
+/* 'content' of patch, usually list of modules */
+KNOWNID(UPDATE_MODULE, "update:module"), /* "name stream version context arch" */
+KNOWNID(UPDATE_MODULE_NAME, "update:module:name"), /* name */
+KNOWNID(UPDATE_MODULE_STREAM, "update:module:stream"), /* stream */
+KNOWNID(UPDATE_MODULE_VERSION, "update:module:version"), /* version */
+KNOWNID(UPDATE_MODULE_CONTEXT, "update:module:context"), /* context */
+KNOWNID(UPDATE_MODULE_ARCH, "update:module:arch"), /* architecture */
+
KNOWNID(ID_NUM_INTERNAL, 0)
#ifdef KNOWNID_INITIALIZE
--
libgit2 0.27.7

View File

@ -0,0 +1,57 @@
From f9a8953aee107d148ddabddd7217ba7656ec46f8 Mon Sep 17 00:00:00 2001
From: Michael Schroeder <mls@suse.de>
Date: Wed, 13 Feb 2019 14:02:31 +0100
Subject: [PATCH] Simplify moldule code
---
ext/repo_updateinfoxml.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/ext/repo_updateinfoxml.c b/ext/repo_updateinfoxml.c
index 8a3d147..f375727 100644
--- a/ext/repo_updateinfoxml.c
+++ b/ext/repo_updateinfoxml.c
@@ -327,7 +327,8 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
case STATE_MODULE:
{
const char *name = 0, *stream = 0, *version = 0, *context = 0, *arch = 0;
- Id name_id, stream_id, version_id, context_id, arch_id = 0;
+ Id module_handle;
+
for (; *atts; atts += 2)
{
if (!strcmp(*atts, "arch"))
@@ -341,20 +342,17 @@ startElement(struct solv_xmlparser *xmlp, int state, const char *name, const cha
else if (!strcmp(*atts, "context"))
context = atts[1];
}
- name_id = pool_str2id(pool, name, 1);
+ module_handle = repodata_new_handle(pd->data);
+ if (name)
+ repodata_set_poolstr(pd->data, module_handle, UPDATE_MODULE_NAME, name);
+ if (stream)
+ repodata_set_poolstr(pd->data, module_handle, UPDATE_MODULE_STREAM, stream);
+ if (version)
+ repodata_set_poolstr(pd->data, module_handle, UPDATE_MODULE_VERSION, version);
+ if (context)
+ repodata_set_poolstr(pd->data, module_handle, UPDATE_MODULE_CONTEXT, context);
if (arch)
- arch_id = pool_str2id(pool, arch, 1);
- stream_id = pool_str2id(pool, stream, 1);
- version_id = pool_str2id(pool, version, 1);
- context_id = pool_str2id(pool, context, 1);
-
- Id module_handle = repodata_new_handle(pd->data);
- repodata_set_id(pd->data, module_handle, UPDATE_MODULE_NAME, name_id);
- repodata_set_id(pd->data, module_handle, UPDATE_MODULE_STREAM, stream_id);
- repodata_set_id(pd->data, module_handle, UPDATE_MODULE_VERSION, version_id);
- repodata_set_id(pd->data, module_handle, UPDATE_MODULE_CONTEXT, context_id);
- if (arch_id)
- repodata_set_id(pd->data, module_handle, UPDATE_MODULE_ARCH, arch_id);
+ repodata_set_poolstr(pd->data, module_handle, UPDATE_MODULE_ARCH, arch);
repodata_add_flexarray(pd->data, pd->handle, UPDATE_MODULE, module_handle);
break;
}
--
libgit2 0.27.7

View File

@ -42,7 +42,7 @@
Name: lib%{libname}
Version: 0.7.3
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Package dependency solver
License: BSD
@ -52,6 +52,8 @@ Source: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
# https://github.com/openSUSE/libsolv/pull/298
Patch0001: 0001-bindings-Add-pool.best_solvables.patch
Patch0002: 0002-bindings-Add-pool.whatmatchessolvable.patch
Patch0003: 0003-Add-support-for-modular-updateinfoxml-data.patch
Patch0004: 0004-Simplify-moldule-code.patch
BuildRequires: cmake
BuildRequires: gcc-c++
@ -301,6 +303,9 @@ Python 3 version.
%endif
%changelog
* Tue Feb 26 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.7.3-4
- Backport: Add support for modular updateinfo.xml data
* Wed Feb 13 2019 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 0.7.3-3
- bindings: Add best_solvables/whatmatchessolvable