import libcomps-0.1.11-4.el8
This commit is contained in:
parent
9b748bd175
commit
8b03bf863a
@ -0,0 +1,161 @@
|
||||
From 257df5670310775a9c279f5f34e3d088966759b1 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
Date: Mon, 7 Oct 2019 12:14:22 +0200
|
||||
Subject: [PATCH 1/3] Update couple of tests
|
||||
|
||||
- list indices cannot by of type float
|
||||
- remove unnecessary print
|
||||
- update print with parenthesis which are now required in python
|
||||
---
|
||||
libcomps/src/python/tests/__test.py | 2 +-
|
||||
libcomps/src/python/tests/test_libcomps.py | 1 -
|
||||
libcomps/src/python/tests/test_merge_comps.py | 4 ++--
|
||||
3 files changed, 3 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/libcomps/src/python/tests/__test.py b/libcomps/src/python/tests/__test.py
|
||||
index c9b4dd4..c7529f3 100644
|
||||
--- a/libcomps/src/python/tests/__test.py
|
||||
+++ b/libcomps/src/python/tests/__test.py
|
||||
@@ -225,7 +225,7 @@ def test_union3(self):
|
||||
def test_hash(self):
|
||||
s = set()
|
||||
for x in range(6):
|
||||
- s.add(self.obj_constructor(**self.obj_data[x/2]))
|
||||
+ s.add(self.obj_constructor(**self.obj_data[int(x/2)]))
|
||||
self.assertTrue(len(s) == 3)
|
||||
self.assertTrue(hash(self.obj_constructor(**self.obj_data[0])) ==\
|
||||
hash(self.obj_constructor(**self.obj_data[0])))
|
||||
diff --git a/libcomps/src/python/tests/test_libcomps.py b/libcomps/src/python/tests/test_libcomps.py
|
||||
index 2a18984..71311ef 100755
|
||||
--- a/libcomps/src/python/tests/test_libcomps.py
|
||||
+++ b/libcomps/src/python/tests/test_libcomps.py
|
||||
@@ -19,7 +19,6 @@
|
||||
class TestLibcomps(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
- print (dir(libcomps))
|
||||
self.comps = libcomps.Comps()
|
||||
self.comps.fromxml_f("comps/comps-f21.xml")
|
||||
self.tmp_dir = tempfile.mkdtemp()
|
||||
diff --git a/libcomps/src/python/tests/test_merge_comps.py b/libcomps/src/python/tests/test_merge_comps.py
|
||||
index beef2cf..73e743f 100755
|
||||
--- a/libcomps/src/python/tests/test_merge_comps.py
|
||||
+++ b/libcomps/src/python/tests/test_merge_comps.py
|
||||
@@ -7,10 +7,10 @@
|
||||
|
||||
try:
|
||||
import _libpycomps as libcomps
|
||||
- print "local tests"
|
||||
+ print("local tests")
|
||||
except ImportError:
|
||||
import libcomps
|
||||
- print "global tests"
|
||||
+ print("global tests")
|
||||
|
||||
|
||||
class TestMergeComps(unittest.TestCase):
|
||||
|
||||
From 1b7add27595b12b9f47e54c3e5f1bda2177da346 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
Date: Mon, 7 Oct 2019 12:50:21 +0200
|
||||
Subject: [PATCH 2/3] Fix segfault when converting empty dict to string
|
||||
(RhBug:1757959)
|
||||
|
||||
Handle all elements in single loop consistently, instead of handling
|
||||
last element separately which caused problems with empty dictionary.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1757959
|
||||
---
|
||||
libcomps/src/python/src/pycomps_dict.c | 20 +-------------------
|
||||
1 file changed, 1 insertion(+), 19 deletions(-)
|
||||
|
||||
diff --git a/libcomps/src/python/src/pycomps_dict.c b/libcomps/src/python/src/pycomps_dict.c
|
||||
index 1b42909..4a20cf7 100644
|
||||
--- a/libcomps/src/python/src/pycomps_dict.c
|
||||
+++ b/libcomps/src/python/src/pycomps_dict.c
|
||||
@@ -78,7 +78,7 @@ PyObject* PyCOMPSDict_str(PyObject *self) {
|
||||
pairlist = comps_objdict_pairs(((PyCOMPS_Dict*)self)->dict);
|
||||
char *tmpstr;
|
||||
|
||||
- for (it = pairlist->first; it != pairlist->last; it = it->next) {
|
||||
+ for (it = pairlist->first; it != NULL; it = it->next) {
|
||||
tmp = ret;
|
||||
tmpkey = __pycomps_lang_decode(((COMPS_ObjRTreePair*)it->data)->key);
|
||||
if (!tmpkey) {
|
||||
@@ -99,24 +99,6 @@ PyObject* PyCOMPSDict_str(PyObject *self) {
|
||||
Py_XDECREF(tmpkey);
|
||||
Py_XDECREF(tmpval);
|
||||
}
|
||||
- tmp = ret;
|
||||
- tmpkey = __pycomps_lang_decode(((COMPS_RTreePair*)it->data)->key);
|
||||
- if (!tmpkey) {
|
||||
- goto out;
|
||||
- }
|
||||
- tmpstr = comps_object_tostr(((COMPS_ObjRTreePair*)it->data)->data);
|
||||
- tmpval = __pycomps_lang_decode(tmpstr);
|
||||
- free(tmpstr);
|
||||
- if (!tmpval) {
|
||||
- //PyErr_SetString(PyExc_TypeError, "val convert error");
|
||||
- goto out;
|
||||
- }
|
||||
- tmp2 = PyUnicode_FromFormat("%U = '%U'", tmpkey, tmpval);
|
||||
- ret = PyUnicode_Concat(ret, tmp2);
|
||||
- Py_XDECREF(tmp);
|
||||
- Py_XDECREF(tmp2);
|
||||
- Py_XDECREF(tmpkey);
|
||||
- Py_XDECREF(tmpval);
|
||||
|
||||
tmp = ret;
|
||||
tmp2 = PyUnicode_FromString("}");
|
||||
|
||||
From 6b4bffb541e70a1715e91ba06de8172b57cd26f0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
Date: Mon, 7 Oct 2019 12:52:59 +0200
|
||||
Subject: [PATCH 3/3] Add test for python API with empty *_by_lang dictionary
|
||||
input
|
||||
|
||||
---
|
||||
.../python/tests/comps/comps_empty_by_lang_tags.xml | 12 ++++++++++++
|
||||
libcomps/src/python/tests/test_libcomps.py | 10 ++++++++++
|
||||
2 files changed, 22 insertions(+)
|
||||
create mode 100644 libcomps/src/python/tests/comps/comps_empty_by_lang_tags.xml
|
||||
|
||||
diff --git a/libcomps/src/python/tests/comps/comps_empty_by_lang_tags.xml b/libcomps/src/python/tests/comps/comps_empty_by_lang_tags.xml
|
||||
new file mode 100644
|
||||
index 0000000..2f40a86
|
||||
--- /dev/null
|
||||
+++ b/libcomps/src/python/tests/comps/comps_empty_by_lang_tags.xml
|
||||
@@ -0,0 +1,12 @@
|
||||
+<?xml version="1.0" encoding="UTF-8"?>
|
||||
+<!DOCTYPE comps PUBLIC "-//Red Hat, Inc.//DTD Comps info//EN" "comps.dtd">
|
||||
+<comps>
|
||||
+ <group>
|
||||
+ <id>birds</id>
|
||||
+ <description></description>
|
||||
+ </group>
|
||||
+ <category>
|
||||
+ <id>all</id>
|
||||
+ <name>all</name>
|
||||
+ </category>
|
||||
+</comps>
|
||||
diff --git a/libcomps/src/python/tests/test_libcomps.py b/libcomps/src/python/tests/test_libcomps.py
|
||||
index 71311ef..64c2b59 100755
|
||||
--- a/libcomps/src/python/tests/test_libcomps.py
|
||||
+++ b/libcomps/src/python/tests/test_libcomps.py
|
||||
@@ -153,6 +153,16 @@ def test_duplicate_groups(self):
|
||||
#print self.comps.xml_str()
|
||||
self.comps.fromxml_str(self.comps.xml_str())
|
||||
|
||||
+ def test_empty_by_lang_tags(self):
|
||||
+ self.comps = libcomps.Comps()
|
||||
+ self.comps.fromxml_f("comps/comps_empty_by_lang_tags.xml")
|
||||
+ for group in self.comps.groups:
|
||||
+ self.assertEqual("{}", str(group.name_by_lang))
|
||||
+ self.assertEqual("{}", str(group.desc_by_lang))
|
||||
+
|
||||
+ for category in self.comps.categories:
|
||||
+ self.assertEqual("{}", str(category.name_by_lang))
|
||||
+ self.assertEqual("{}", str(category.desc_by_lang))
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(testRunner = utest.MyRunner)
|
@ -0,0 +1,64 @@
|
||||
From be21c727509e252859d7850f7d7ec06c51ba15b3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ale=C5=A1=20Mat=C4=9Bj?= <amatej@redhat.com>
|
||||
Date: Mon, 6 Jan 2020 12:08:00 +0100
|
||||
Subject: [PATCH] Do not skip type=mandatory in xml output and test it
|
||||
(RhBug:1771224)
|
||||
|
||||
The mandatory type is used when no other configuration and no other
|
||||
type is specified but since this behavior can be overridden with passed
|
||||
configuration it doesn't make sense to always skip outputting the type
|
||||
mandatory.
|
||||
The user can specify for example optional type as default and then
|
||||
the knowledge that some specific <packagereq> were mandatory would be
|
||||
lost.
|
||||
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=1771224
|
||||
---
|
||||
libcomps/src/comps_docpackage.c | 5 +++--
|
||||
libcomps/src/python/tests/__test.py | 10 +++++++++-
|
||||
2 files changed, 12 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/libcomps/src/comps_docpackage.c b/libcomps/src/comps_docpackage.c
|
||||
index 25d8564..f2d6bae 100644
|
||||
--- a/libcomps/src/comps_docpackage.c
|
||||
+++ b/libcomps/src/comps_docpackage.c
|
||||
@@ -164,8 +164,9 @@ signed char comps_docpackage_xml(COMPS_DocGroupPackage *pkg,
|
||||
str = "conditional";
|
||||
else
|
||||
str = "default";
|
||||
- if (pkg->type != COMPS_PACKAGE_MANDATORY)
|
||||
- ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "type", BAD_CAST str);
|
||||
+
|
||||
+ ret = xmlTextWriterWriteAttribute(writer, BAD_CAST "type", BAD_CAST str);
|
||||
+
|
||||
if (pkg->requires) {
|
||||
str = comps_object_tostr((COMPS_Object*)pkg->requires);
|
||||
ret = xmlTextWriterWriteAttribute(writer, (xmlChar*) "requires",
|
||||
diff --git a/libcomps/src/python/tests/__test.py b/libcomps/src/python/tests/__test.py
|
||||
index c7529f3..9cb957a 100644
|
||||
--- a/libcomps/src/python/tests/__test.py
|
||||
+++ b/libcomps/src/python/tests/__test.py
|
||||
@@ -620,6 +620,14 @@ def test_hash(self):
|
||||
self.assertTrue(hash(pkg2) != hash(pkg3))
|
||||
self.assertTrue(len(set([pkg1,pkg2,pkg3])) == 2)
|
||||
|
||||
+ def test_mandatory_in_xml_out(self):
|
||||
+ self.comps = libcomps.Comps()
|
||||
+ self.comps.groups.append(libcomps.Group("g1", "group1", "group desc", 0, 0, 0, "en"))
|
||||
+ self.comps.groups[0].packages.append(libcomps.Package("kernel", libcomps.PACKAGE_TYPE_MANDATORY))
|
||||
+
|
||||
+ out = self.comps.xml_str()
|
||||
+ self.assertTrue("<packagereq type=\"mandatory\" requires=\"\">kernel</packagereq>" in out)
|
||||
+
|
||||
#@unittest.skip("skip")
|
||||
class DictTest(unittest.TestCase):
|
||||
def test_dict(self):
|
||||
@@ -998,7 +1006,7 @@ def test_xml_options(self):
|
||||
self.assertEqual(len(comps2.groups), 0)
|
||||
self.assertEqual(len(comps2.categories), 0)
|
||||
self.assertEqual(len(comps2.environments), 0)
|
||||
-
|
||||
+
|
||||
s = comps.toxml_str(xml_options={"empty_groups": True,
|
||||
"empty_categories": True,
|
||||
"empty_environments": True})
|
@ -14,13 +14,15 @@
|
||||
|
||||
Name: libcomps
|
||||
Version: 0.1.11
|
||||
Release: 2%{?dist}
|
||||
Release: 4%{?dist}
|
||||
Summary: Comps XML file manipulation library
|
||||
|
||||
License: GPLv2+
|
||||
URL: https://github.com/rpm-software-management/libcomps
|
||||
Source0: %{url}/archive/%{name}-%{version}/%{name}-%{version}.tar.gz
|
||||
Patch0: 0001-Fix-order-of-asserts-in-unit-test-RhBug1713220.patch
|
||||
Patch1: 0002-Empty-dict-created-by-_by_lang-in-python-api-causes-segfault.patch
|
||||
Patch2: 0003-Do-not-skip-type-mandatory-in-xml-output-and-test-it-RhBu1771224.patch
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: cmake
|
||||
@ -190,6 +192,12 @@ popd
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
* Mon Jan 13 2020 Ales Matej <amatej@redhat.com> - 0.1.11-4
|
||||
- Do not skip type=mandatory in xml output (RhBug:1771224)
|
||||
|
||||
* Wed Nov 13 2019 Ales Matej <amatej@redhat.com> - 0.1.11-3
|
||||
- Fix segfault caused by empty dict created by *_by_lang in python api (RhBug:1757959)
|
||||
|
||||
* Thu Aug 01 2019 Pavla Kratochvilova <pkratoch@redhat.com> - 0.1.11-2
|
||||
- Backport patch: Fix order of asserts in unit test (RhBug:1713220)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user