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