import createrepo_c-0.15.11-2.el8

This commit is contained in:
CentOS Sources 2020-11-03 06:59:42 -05:00 committed by Andrew Lukoshko
parent 3372ebcf68
commit c271544a54
6 changed files with 173 additions and 526 deletions

View File

@ -1 +1 @@
e85178e66ca8c2157ef2da31cb8c25ff456631fd SOURCES/createrepo_c-0.15.1.tar.gz 49ce7de5c5d17fafba7dcc171837236f5ef189b6 SOURCES/createrepo_c-0.15.11.tar.gz

2
.gitignore vendored
View File

@ -1 +1 @@
SOURCES/createrepo_c-0.15.1.tar.gz SOURCES/createrepo_c-0.15.11.tar.gz

View File

@ -1,60 +0,0 @@
From 566311457542d08f48507b0ab7bd68cb848594e9 Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Fri, 29 Nov 2019 09:47:29 +0100
Subject: [PATCH 1/2] Libmagic to follow symlinks (RhBug:1776399)
If the input metadata file for modifyrepo_c was a symlink the
program failed to detect compression type. This patch instructs
libmagic to follow the symlinks when guessing the mime type.
Let modules.yaml be a symlink:
$ modifyrepo_c ./modules.yaml ./repodata
Cannot open ./modules.yaml: Cannot detect compression type
https://bugzilla.redhat.com/show_bug.cgi?id=1776399
---
src/compression_wrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
index d04ab24..6fdb8ea 100644
--- a/src/compression_wrapper.c
+++ b/src/compression_wrapper.c
@@ -166,7 +166,7 @@ cr_detect_compression(const char *filename, GError **err)
// No success? Let's get hardcore... (Use magic bytes)
- magic_t myt = magic_open(MAGIC_MIME);
+ magic_t myt = magic_open(MAGIC_MIME | MAGIC_SYMLINK);
if (myt == NULL) {
g_set_error(err, ERR_DOMAIN, CRE_MAGIC,
"magic_open() failed: Cannot allocate the magic cookie");
From b1b849c3bd63424760152981f96031ef578d752c Mon Sep 17 00:00:00 2001
From: Marek Blaha <mblaha@redhat.com>
Date: Fri, 29 Nov 2019 10:53:25 +0100
Subject: [PATCH 2/2] Add shortcut to detect *.yaml files as not compressed
---
src/compression_wrapper.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/compression_wrapper.c b/src/compression_wrapper.c
index 6fdb8ea..56d1dc5 100644
--- a/src/compression_wrapper.c
+++ b/src/compression_wrapper.c
@@ -158,12 +158,12 @@ cr_detect_compression(const char *filename, GError **err)
return CR_CW_ZCK_COMPRESSION;
} else if (g_str_has_suffix(filename, ".xml") ||
g_str_has_suffix(filename, ".tar") ||
+ g_str_has_suffix(filename, ".yaml") ||
g_str_has_suffix(filename, ".sqlite"))
{
return CR_CW_NO_COMPRESSION;
}
-
// No success? Let's get hardcore... (Use magic bytes)
magic_t myt = magic_open(MAGIC_MIME | MAGIC_SYMLINK);

View File

@ -0,0 +1,144 @@
From 76b4a34e04f09596c92fa0326001f18891695e17 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Fri, 24 Jul 2020 12:53:47 +0200
Subject: [PATCH 1/2] Add a test for parsing huge snippet (RhBug:1859689)
https://bugzilla.redhat.com/show_bug.cgi?id=1859689
---
tests/python/tests/test_xml_parser.py | 36 +++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/tests/python/tests/test_xml_parser.py b/tests/python/tests/test_xml_parser.py
index e2c48f0..8856096 100644
--- a/tests/python/tests/test_xml_parser.py
+++ b/tests/python/tests/test_xml_parser.py
@@ -476,6 +476,42 @@ class TestCaseXmlParserFilelists(unittest.TestCase):
self.assertEqual(userdata["pkgcb_calls"], 2)
self.assertEqual(userdata["warnings"], [])
+ def test_xml_parser_filelists_snippet_huge(self):
+
+ userdata = {
+ "pkgs": [],
+ "pkgcb_calls": 0,
+ "warnings": []
+ }
+
+ def newpkgcb(pkgId, name, arch):
+ pkg = cr.Package()
+ userdata["pkgs"].append(pkg)
+ return pkg
+
+ def pkgcb(pkg):
+ userdata["pkgcb_calls"] += 1
+
+ def warningcb(warn_type, msg):
+ userdata["warnings"].append((warn_type, msg))
+
+ # generete huge filelists snippet
+ content = """
+ <package pkgid="68743563000b2a85e7d9d7ce318719217f3bfee6167cd862efd201ff96c1ecbb" name="flat-remix-icon-theme" arch="noarch">
+ <version epoch="0" ver="0.0.20200511" rel="1.fc33"/>
+ """
+ for i in range(145951):
+ content += "<file>/usr/share/icons/Flat-Remix-Yellow/status/symbolic/user-available-symbolic.svg</file>"
+ content += "</package>"
+
+ cr.xml_parse_filelists_snippet(content, newpkgcb, pkgcb, warningcb)
+
+ self.assertEqual([pkg.name for pkg in userdata["pkgs"]],
+ ['flat-remix-icon-theme'])
+ self.assertEqual(userdata["pkgcb_calls"], 1)
+ self.assertEqual(userdata["warnings"], [])
+
+
def test_xml_parser_filelists_repo02_only_pkgcb(self):
--
2.28.0.rc1
From 6f08a56c36e6c60d216fff964b31a2c58ce12fc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Fri, 24 Jul 2020 12:41:50 +0200
Subject: [PATCH 2/2] Parse xml snippet in smaller parts (RhBug:1859689)
If string passed to xmlParseChunk (function froml ibxml2) is too
big the function errors out, its safer to parse the snippet in
smaller parts.
https://bugzilla.redhat.com/show_bug.cgi?id=1859689
---
src/xml_parser.c | 48 ++++++++++++++++++++++++++++++++----------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/src/xml_parser.c b/src/xml_parser.c
index 4727daa..9375107 100644
--- a/src/xml_parser.c
+++ b/src/xml_parser.c
@@ -243,29 +243,45 @@ cr_xml_parser_generic_from_string(xmlParserCtxtPtr parser,
/* Note: This function uses .err members of cr_ParserData! */
int ret = CRE_OK;
+ int block_size = XML_BUFFER_SIZE;
+ const char *next_data = xml_string;
+ const char *end_of_string = xml_string + strlen(xml_string);
+ int finished = 0;
assert(parser);
assert(pd);
assert(xml_string);
assert(!err || *err == NULL);
- if (xmlParseChunk(parser, xml_string, strlen(xml_string), 1)) {
- ret = CRE_XMLPARSER;
- xmlErrorPtr xml_err = xmlCtxtGetLastError(parser);
- g_critical("%s: parsing error '%s': %s",
- __func__,
- xml_string,
- xml_err->message);
- g_set_error(err, ERR_DOMAIN, CRE_XMLPARSER,
- "Parse error '%s' at line: %d (%s)",
- xml_string,
- (int) xml_err->line,
- (char *) xml_err->message);
- }
+ const char *data;
+ while (!finished) {
+ data = next_data;
+
+ // Check if we are in the last loop
+ next_data = data + block_size;
+ if (next_data > end_of_string) {
+ block_size = strlen(data);
+ finished = 1;
+ }
+
+ if (xmlParseChunk(parser, data, block_size, finished)) {
+ ret = CRE_XMLPARSER;
+ xmlErrorPtr xml_err = xmlCtxtGetLastError(parser);
+ g_critical("%s: parsing error '%s': %s",
+ __func__,
+ data,
+ xml_err->message);
+ g_set_error(err, ERR_DOMAIN, CRE_XMLPARSER,
+ "Parse error '%s' at line: %d (%s)",
+ data,
+ (int) xml_err->line,
+ (char *) xml_err->message);
+ }
- if (pd->err) {
- ret = pd->err->code;
- g_propagate_error(err, pd->err);
+ if (pd->err) {
+ ret = pd->err->code;
+ g_propagate_error(err, pd->err);
+ }
}
return ret;
--
2.28.0.rc1

View File

@ -1,458 +0,0 @@
From af9c8b4575749c3d03afe6c704060661622199bb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 3 Dec 2019 09:21:27 +0100
Subject: [PATCH 1/3] Add reboot_suggested field to UpdateRecord
(RhBug:1772466)
https://bugzilla.redhat.com/show_bug.cgi?id=1772466
---
src/python/updaterecord-py.c | 35 +++++++++++++++++++++++++++++++++++
src/updateinfo.c | 1 +
src/updateinfo.h | 1 +
src/xml_dump_updateinfo.c | 3 +++
src/xml_parser_updateinfo.c | 9 +++++++++
5 files changed, 49 insertions(+)
diff --git a/src/python/updaterecord-py.c b/src/python/updaterecord-py.c
index 4f41019..b74bcb8 100644
--- a/src/python/updaterecord-py.c
+++ b/src/python/updaterecord-py.c
@@ -248,6 +248,16 @@ static ListConvertor list_convertors[] = {
#define OFFSET(member) (void *) offsetof(cr_UpdateRecord, member)
+static PyObject *
+get_int(_UpdateRecordObject *self, void *member_offset)
+{
+ if (check_UpdateRecordStatus(self))
+ return NULL;
+ cr_UpdateRecord *rec = self->record;
+ gint64 val = *((int *) ((size_t) rec + (size_t) member_offset));
+ return PyLong_FromLongLong((long long) val);
+}
+
static PyObject *
get_str(_UpdateRecordObject *self, void *member_offset)
{
@@ -311,6 +321,29 @@ get_list(_UpdateRecordObject *self, void *conv)
return list;
}
+static int
+set_int(_UpdateRecordObject *self, PyObject *value, void *member_offset)
+{
+ long val;
+ if (check_UpdateRecordStatus(self))
+ return -1;
+ if (PyLong_Check(value)) {
+ val = PyLong_AsLong(value);
+ } else if (PyFloat_Check(value)) {
+ val = (long long) PyFloat_AS_DOUBLE(value);
+#if PY_MAJOR_VERSION < 3
+ } else if (PyInt_Check(value)) {
+ val = PyInt_AS_LONG(value);
+#endif
+ } else {
+ PyErr_SetString(PyExc_TypeError, "Number expected!");
+ return -1;
+ }
+ cr_UpdateRecord *rec = self->record;
+ *((int *) ((size_t) rec + (size_t) member_offset)) = (int) val;
+ return 0;
+}
+
static int
set_str(_UpdateRecordObject *self, PyObject *value, void *member_offset)
{
@@ -388,6 +421,8 @@ static PyGetSetDef updaterecord_getsetters[] = {
"List of UpdateReferences", &(list_convertors[0])},
{"collections", (getter)get_list, (setter)NULL,
"List of UpdateCollections", &(list_convertors[1])},
+ {"reboot_suggested", (getter)get_int, (setter)set_int,
+ "Suggested reboot", OFFSET(reboot_suggested)},
{NULL, NULL, NULL, NULL, NULL} /* sentinel */
};
diff --git a/src/updateinfo.c b/src/updateinfo.c
index cdc4747..bef06f2 100644
--- a/src/updateinfo.c
+++ b/src/updateinfo.c
@@ -249,6 +249,7 @@ cr_updaterecord_copy(const cr_UpdateRecord *orig)
rec->summary = cr_safe_string_chunk_insert(rec->chunk, orig->summary);
rec->description = cr_safe_string_chunk_insert(rec->chunk, orig->description);
rec->solution = cr_safe_string_chunk_insert(rec->chunk, orig->solution);
+ rec->reboot_suggested = orig->reboot_suggested;
if (orig->references) {
GSList *newlist = NULL;
diff --git a/src/updateinfo.h b/src/updateinfo.h
index 38883e0..2a69384 100644
--- a/src/updateinfo.h
+++ b/src/updateinfo.h
@@ -92,6 +92,7 @@ typedef struct {
gchar *summary; /*!< Short summary */
gchar *description; /*!< Update description */
gchar *solution; /*!< Solution */
+ gboolean reboot_suggested; /*!< Reboot suggested */
GSList *references; /*!< List of cr_UpdateReference */
GSList *collections;/*!< List of cr_UpdateCollection */
diff --git a/src/xml_dump_updateinfo.c b/src/xml_dump_updateinfo.c
index fafe686..0beed96 100644
--- a/src/xml_dump_updateinfo.c
+++ b/src/xml_dump_updateinfo.c
@@ -165,6 +165,9 @@ cr_xml_dump_updateinforecord_internal(xmlNodePtr root, cr_UpdateRecord *rec)
cr_xmlNewTextChild_c(update, NULL, BAD_CAST "description", BAD_CAST rec->description);
cr_xmlNewTextChild_c(update, NULL, BAD_CAST "solution", BAD_CAST rec->solution);
+ if (rec->reboot_suggested)
+ xmlNewChild(update, NULL, BAD_CAST "reboot_suggested", NULL);
+
// References
cr_xml_dump_updateinforecord_references(update, rec->references);
diff --git a/src/xml_parser_updateinfo.c b/src/xml_parser_updateinfo.c
index 5a2715a..3e458ec 100644
--- a/src/xml_parser_updateinfo.c
+++ b/src/xml_parser_updateinfo.c
@@ -58,6 +58,7 @@ typedef enum {
STATE_PACKAGE,
STATE_FILENAME,
STATE_SUM,
+ STATE_UPDATERECORD_REBOOTSUGGESTED,
STATE_REBOOTSUGGESTED,
STATE_RESTARTSUGGESTED, // Not implemented
STATE_RELOGINSUGGESTED, // Not implemented
@@ -86,6 +87,7 @@ static cr_StatesSwitch stateswitches[] = {
{ STATE_UPDATE, "message", STATE_MESSAGE, 1 }, // NI
{ STATE_UPDATE, "references", STATE_REFERENCES, 0 },
{ STATE_UPDATE, "pkglist", STATE_PKGLIST, 0 },
+ { STATE_UPDATE, "reboot_suggested", STATE_UPDATERECORD_REBOOTSUGGESTED,0 },
{ STATE_REFERENCES, "reference", STATE_REFERENCE, 0 },
{ STATE_PKGLIST, "collection", STATE_COLLECTION, 0 },
{ STATE_COLLECTION, "package", STATE_PACKAGE, 0 },
@@ -360,6 +362,12 @@ cr_start_handler(void *pdata, const char *element, const char **attr)
package->sum_type = cr_checksum_type(val);
break;
+ case STATE_UPDATERECORD_REBOOTSUGGESTED:
+ assert(pd->updateinfo);
+ assert(pd->updaterecord);
+ rec->reboot_suggested = TRUE;
+ break;
+
case STATE_REBOOTSUGGESTED:
assert(pd->updateinfo);
assert(pd->updaterecord);
@@ -406,6 +414,7 @@ cr_end_handler(void *pdata, G_GNUC_UNUSED const char *element)
case STATE_MODULE:
case STATE_PKGLIST:
case STATE_REBOOTSUGGESTED:
+ case STATE_UPDATERECORD_REBOOTSUGGESTED:
// All elements with no text data and without need of any
// post processing should go here
break;
--
2.24.1
From d4fb876b4475c7ede4b49219229638bf32e9574d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Tue, 3 Dec 2019 09:32:18 +0100
Subject: [PATCH 2/3] Extend unit tests with reboot_suggested for UpdateRecord
---
tests/python/tests/test_updateinfo.py | 6 ++++++
tests/python/tests/test_updaterecord.py | 5 +++++
tests/test_xml_parser_updateinfo.c | 8 ++++++++
tests/testdata/updateinfo_files/updateinfo_01.xml | 1 +
tests/testdata/updateinfo_files/updateinfo_03.xml | 2 ++
5 files changed, 22 insertions(+)
diff --git a/tests/python/tests/test_updateinfo.py b/tests/python/tests/test_updateinfo.py
index 727b707..7feaae9 100644
--- a/tests/python/tests/test_updateinfo.py
+++ b/tests/python/tests/test_updateinfo.py
@@ -36,6 +36,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
rec.summary = "summary"
rec.description = "description"
rec.solution = "solution"
+ rec.reboot_suggested = True
ui.append(rec)
@@ -57,6 +58,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
self.assertEqual(rec.summary, "summary")
self.assertEqual(rec.description, "description")
self.assertEqual(rec.solution, "solution")
+ self.assertEqual(rec.reboot_suggested, True)
self.assertEqual(len(rec.references), 0)
self.assertEqual(len(rec.collections), 0)
@@ -92,6 +94,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
rec.summary = "summary"
rec.description = "description"
rec.solution = "solution"
+ rec.reboot_suggested = True
ui.append(rec)
xml = ui.xml_dump()
@@ -111,6 +114,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
+ <reboot_suggested/>
<references/>
<pkglist/>
</update>
@@ -349,6 +353,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
rec.summary = "summary"
rec.description = "description"
rec.solution = "solution"
+ rec.reboot_suggested = True
rec.append_collection(col)
rec.append_reference(ref)
@@ -372,6 +377,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
+ <reboot_suggested/>
<references>
<reference href="href" id="id" type="type" title="title"/>
</references>
diff --git a/tests/python/tests/test_updaterecord.py b/tests/python/tests/test_updaterecord.py
index 6777f04..7a1a191 100644
--- a/tests/python/tests/test_updaterecord.py
+++ b/tests/python/tests/test_updaterecord.py
@@ -32,6 +32,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
self.assertEqual(rec.severity, None)
self.assertEqual(rec.summary, None)
self.assertEqual(rec.description, None)
+ self.assertEqual(rec.reboot_suggested, 0)
self.assertEqual(rec.solution, None)
self.assertEqual(rec.references, [])
self.assertEqual(rec.collections, [])
@@ -60,6 +61,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
rec.severity = "severity"
rec.summary = "summary"
rec.description = "description"
+ rec.reboot_suggested = True
rec.solution = "solution"
rec.append_reference(ref)
rec.append_collection(col)
@@ -77,6 +79,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
self.assertEqual(rec.pushcount, "pushcount")
self.assertEqual(rec.severity, "severity")
self.assertEqual(rec.summary, "summary")
+ self.assertEqual(rec.reboot_suggested, True)
self.assertEqual(rec.description, "description")
self.assertEqual(rec.solution, "solution")
self.assertEqual(len(rec.references), 1)
@@ -115,6 +118,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
rec.summary = "summary"
rec.description = "description"
rec.solution = "solution"
+ rec.reboot_suggested = True
xml = cr.xml_dump_updaterecord(rec)
self.assertEqual(xml,
@@ -130,6 +134,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
+ <reboot_suggested/>
<references/>
<pkglist/>
</update>
diff --git a/tests/test_xml_parser_updateinfo.c b/tests/test_xml_parser_updateinfo.c
index 976922e..07ef50e 100644
--- a/tests/test_xml_parser_updateinfo.c
+++ b/tests/test_xml_parser_updateinfo.c
@@ -76,6 +76,7 @@ test_cr_xml_parse_updateinfo_01(void)
g_assert_cmpstr(update->summary, ==, "summary_1");
g_assert_cmpstr(update->description, ==, "description_1");
g_assert_cmpstr(update->solution, ==, "solution_1");
+ g_assert(update->reboot_suggested);
g_assert_cmpint(g_slist_length(update->references), ==, 1);
ref = update->references->data;
@@ -137,6 +138,7 @@ test_cr_xml_parse_updateinfo_02(void)
g_assert(!update->pushcount);
g_assert(!update->severity);
g_assert(!update->summary);
+ g_assert(!update->reboot_suggested);
g_assert(!update->description);
g_assert(!update->solution);
@@ -186,6 +188,10 @@ test_cr_xml_parse_updateinfo_03(void)
g_assert_cmpint(ret, ==, CRE_OK);
g_assert_cmpint(g_slist_length(ui->updates), ==, 6);
+
+ update = g_slist_nth_data(ui->updates, 2);
+ g_assert(!update->reboot_suggested);
+
update = g_slist_nth_data(ui->updates, 3);
g_assert_cmpstr(update->from, ==, "errata@redhat.com");
@@ -195,6 +201,7 @@ test_cr_xml_parse_updateinfo_03(void)
g_assert_cmpstr(update->id, ==, "RHEA-2012:0058");
g_assert_cmpstr(update->title, ==, "Gorilla_Erratum");
g_assert_cmpstr(update->description, ==, "Gorilla_Erratum");
+ g_assert(update->reboot_suggested);
update = g_slist_nth_data(ui->updates, 4);
@@ -204,6 +211,7 @@ test_cr_xml_parse_updateinfo_03(void)
g_assert_cmpstr(update->issued_date, ==, "2018-01-27 16:08:09");
g_assert_cmpstr(update->updated_date, ==, "2018-07-20 06:00:01 UTC");
g_assert_cmpstr(update->release, ==, "1");
+ g_assert(update->reboot_suggested);
g_assert_cmpint(g_slist_length(update->references), ==, 0);
diff --git a/tests/testdata/updateinfo_files/updateinfo_01.xml b/tests/testdata/updateinfo_files/updateinfo_01.xml
index b757ef8..415140e 100644
--- a/tests/testdata/updateinfo_files/updateinfo_01.xml
+++ b/tests/testdata/updateinfo_files/updateinfo_01.xml
@@ -12,6 +12,7 @@
<summary>summary_1</summary>
<description>description_1</description>
<solution>solution_1</solution>
+ <reboot_suggested>True</reboot_suggested>
<references>
<reference href="https://foobar/foobarupdate_1" id="1" type="self" title="update_1"/>
</references>
diff --git a/tests/testdata/updateinfo_files/updateinfo_03.xml b/tests/testdata/updateinfo_files/updateinfo_03.xml
index ddbd99b..39dfbef 100644
--- a/tests/testdata/updateinfo_files/updateinfo_03.xml
+++ b/tests/testdata/updateinfo_files/updateinfo_03.xml
@@ -70,6 +70,7 @@
<issued date="2013-01-27 16:08:09"/>
<updated date="2014-07-20 06:00:01 UTC"/>
<description>Gorilla_Erratum</description>
+ <reboot_suggested>True</reboot_suggested>
<pkglist>
<collection short="">
<name>1</name>
@@ -87,6 +88,7 @@
<issued date="2018-01-27 16:08:09"/>
<updated date="2018-07-20 06:00:01 UTC"/>
<description>Duck_Kangaro_Erratum description</description>
+ <reboot_suggested/>
<pkglist>
<collection short="">
<name>coll_name1</name>
--
2.24.1
From c1ec192d14d751eed298ffff13fbbc76917d0b0e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
Date: Thu, 9 Jan 2020 08:52:22 +0100
Subject: [PATCH 3/3] Switch updateinfo to explicitly include bool values
(RhBug:1772466)
Elements <restart_suggested> and both <reboot_suggested> were previously
outputed just as an empty element which meant they are true, this patch
changes it to explicitly output:
<reboot_suggested>True</reboot_suggested>.
However we still don't output False values, in that case the element is
simply omitted.
https://bugzilla.redhat.com/show_bug.cgi?id=1772466
---
src/xml_dump_updateinfo.c | 4 ++--
tests/python/tests/test_updateinfo.py | 10 +++++-----
tests/python/tests/test_updaterecord.py | 2 +-
3 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/src/xml_dump_updateinfo.c b/src/xml_dump_updateinfo.c
index 0beed96..6974285 100644
--- a/src/xml_dump_updateinfo.c
+++ b/src/xml_dump_updateinfo.c
@@ -61,7 +61,7 @@ cr_xml_dump_updatecollectionpackages(xmlNodePtr collection, GSList *packages)
}
if (pkg->reboot_suggested)
- xmlNewChild(package, NULL, BAD_CAST "reboot_suggested", NULL);
+ xmlNewChild(package, NULL, BAD_CAST "reboot_suggested", "True");
}
}
@@ -166,7 +166,7 @@ cr_xml_dump_updateinforecord_internal(xmlNodePtr root, cr_UpdateRecord *rec)
cr_xmlNewTextChild_c(update, NULL, BAD_CAST "solution", BAD_CAST rec->solution);
if (rec->reboot_suggested)
- xmlNewChild(update, NULL, BAD_CAST "reboot_suggested", NULL);
+ xmlNewChild(update, NULL, BAD_CAST "reboot_suggested", "True");
// References
cr_xml_dump_updateinforecord_references(update, rec->references);
diff --git a/tests/python/tests/test_updateinfo.py b/tests/python/tests/test_updateinfo.py
index 7feaae9..f5becfe 100644
--- a/tests/python/tests/test_updateinfo.py
+++ b/tests/python/tests/test_updateinfo.py
@@ -114,7 +114,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
<references/>
<pkglist/>
</update>
@@ -207,7 +207,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<package name="foo" version="1.2" release="3" epoch="0" arch="x86" src="foo.src.rpm">
<filename>foo.rpm</filename>
<sum type="sha1">abcdef</sum>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
</package>
</collection>
</pkglist>
@@ -293,7 +293,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<package name="foo" version="1.2" release="3" epoch="0" arch="x86" src="foo.src.rpm">
<filename>foo.rpm</filename>
<sum type="sha1">abcdef</sum>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
</package>
</collection>
</pkglist>
@@ -377,7 +377,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
<references>
<reference href="href" id="id" type="type" title="title"/>
</references>
@@ -388,7 +388,7 @@ class TestCaseUpdateInfo(unittest.TestCase):
<package name="foo" version="1.2" release="3" epoch="0" arch="x86" src="foo.src.rpm">
<filename>foo.rpm</filename>
<sum type="sha1">abcdef</sum>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
</package>
</collection>
</pkglist>
diff --git a/tests/python/tests/test_updaterecord.py b/tests/python/tests/test_updaterecord.py
index 7a1a191..e8bc789 100644
--- a/tests/python/tests/test_updaterecord.py
+++ b/tests/python/tests/test_updaterecord.py
@@ -134,7 +134,7 @@ class TestCaseUpdateRecord(unittest.TestCase):
<summary>summary</summary>
<description>description</description>
<solution>solution</solution>
- <reboot_suggested/>
+ <reboot_suggested>True</reboot_suggested>
<references/>
<pkglist/>
</update>
--
2.24.1

View File

@ -22,13 +22,13 @@
%bcond_without python2 %bcond_without python2
%endif %endif
%if 0%{?rhel} || 0%{?fedora} < 29 %if 0%{?rhel} || (0%{?fedora} && 0%{?fedora} < 29)
%bcond_with zchunk %bcond_with zchunk
%else %else
%bcond_without zchunk %bcond_without zchunk
%endif %endif
%if 0%{?rhel} || 0%{?fedora} < 29 %if 0%{?rhel} < 8 || (0%{?fedora} && 0%{?fedora} < 29)
%bcond_with libmodulemd %bcond_with libmodulemd
%else %else
%bcond_without libmodulemd %bcond_without libmodulemd
@ -36,19 +36,17 @@
Summary: Creates a common metadata repository Summary: Creates a common metadata repository
Name: createrepo_c Name: createrepo_c
Version: 0.15.1 Version: 0.15.11
Release: 2%{?dist} Release: 2%{?dist}
License: GPLv2+ License: GPLv2+
URL: https://github.com/rpm-software-management/createrepo_c URL: https://github.com/rpm-software-management/createrepo_c
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Patch1: 0001-Libmagic-to-follow-symlinks-RhBug1776399.patch Patch1: 0001-Parse-xml-snippet-in-smaller-parts-RhBug1859689.patch
Patch2: 0002-Add-reboot_suggested-to-UpdateRecord-RhBug1772466.patch
BuildRequires: cmake BuildRequires: cmake
BuildRequires: gcc BuildRequires: gcc
BuildRequires: bzip2-devel BuildRequires: bzip2-devel
BuildRequires: doxygen BuildRequires: doxygen
BuildRequires: expat-devel
BuildRequires: file-devel BuildRequires: file-devel
BuildRequires: glib2-devel >= 2.22.0 BuildRequires: glib2-devel >= 2.22.0
BuildRequires: libcurl-devel BuildRequires: libcurl-devel
@ -264,6 +262,29 @@ ln -sr %{buildroot}%{_bindir}/modifyrepo_c %{buildroot}%{_bindir}/modifyrepo
%endif %endif
%changelog %changelog
* Thu Jul 30 2020 Ales Matej <amatej@redhat.com> - 0.15.11-2
- Parse xml snippet in smaller parts (RhBug:1859689)
* Wed Apr 29 2020 Ales Matej <amatej@redhat.com> - 0.15.11-1
- Update to 0.15.11
- Add --arch-expand option
- Fix various memory leaks
* Wed Apr 29 2020 Ales Matej <amatej@redhat.com> - 0.15.10-1
- Update to 0.15.10
- New option --recycle-pkglist for --update mode
- Add restart_suggested field to updatecollectionpackage in updateinfo.xml
- Add relogin_suggested field to updatecollectionpackage in updateinfo.xml (Rhbug:1779751)
- Export all changelog entries to other.xml in compatibility mode
- Enhance error handling when locating repositories (RhBug:1762697)
- Clean up temporary .repodata on sigint
- Support issued date in epoch format set by Python API (RhBug:1779751)
- Allow parsing of xml repodata from string via new API functions (RhBug:1804308)
- Fix a bug when setting updateCollectionModule (RhBug:1821781)
* Tue Mar 24 2020 Stephen Gallagher <sgallagh@redhat.com> - 0.15.1-3
- Fix incorrect conditional causing libmodulemd support to be disabled (RhBug:1816753)
* Mon Jan 13 2020 Ales Matej <amatej@redhat.com> - 0.15.1-2 * Mon Jan 13 2020 Ales Matej <amatej@redhat.com> - 0.15.1-2
- Add reboot_suggested to UpdateRecord (RhBug:1772466) - Add reboot_suggested to UpdateRecord (RhBug:1772466)
- Explicitly output boolean values for updateinfo.xml (RhBug:1772466) - Explicitly output boolean values for updateinfo.xml (RhBug:1772466)