diff --git a/src/python/createrepo_c/__init__.py b/src/python/createrepo_c/__init__.py index 4b61f2dd..db6e8633 100644 --- a/src/python/createrepo_c/__init__.py +++ b/src/python/createrepo_c/__init__.py @@ -714,10 +714,8 @@ def finish(self): if self._updaterecords: upd_xml_path = self.repodata_dir / ("updateinfo.xml" + self._compression_suffix) writer = UpdateInfoXmlFile(str(upd_xml_path), compressiontype=self._compression) - updateinfo = UpdateInfo() for rec in self._updaterecords: - updateinfo.append(rec) - writer.add_chunk(updateinfo.xml_dump()) + writer.add_chunk(_createrepo_c.xml_dump_updaterecord(rec)) self.working_metadata_files["updateinfo"] = MetadataInfoHolder(upd_xml_path, writer) # Create all the repomdrecords for the standard metadata diff --git a/tests/python/tests/test_repository.py b/tests/python/tests/test_repository.py index bc65b8eb..c0f5fe27 100644 --- a/tests/python/tests/test_repository.py +++ b/tests/python/tests/test_repository.py @@ -99,13 +99,18 @@ def test_defaults(self): record_path = os.path.join(self.tmpdir, record.location_href) assert os.path.exists(record_path) - reader = cr.RepositoryReader.from_path(self.tmpdir) - for pkg in reader.iter_packages(): - # test that the package files are present where expected - pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) - # test that the package checksum type is correct - assert pkg.checksum_type == "sha256" + reader = cr.RepositoryReader.from_path(self.tmpdir) + for pkg in reader.iter_packages(): + # test that the package files are present where expected + pkg_path = os.path.join(self.tmpdir, pkg.location_href) + assert os.path.exists(pkg_path) + # test that the package checksum type is correct + assert pkg.checksum_type == "sha256" + + expected_updaterecords = [TEST_UPDATERECORD_UPDATE1] + for expected, actual in zip(expected_updaterecords, reader.advisories): + assert expected == actual + def test_options(self): """Test that overriding default options works as intended""" @@ -142,15 +147,20 @@ def test_options(self): record_path = os.path.join(self.tmpdir, record.location_href) assert os.path.exists(record_path) - reader = cr.RepositoryReader.from_path(self.tmpdir) - for pkg in reader.iter_packages(): - # test that the package files are present where expected - pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) - # test that changelog_limit works - assert len(pkg.changelogs) <= 1 - # test that the package checksum type is correct - assert pkg.checksum_type == "sha512" + reader = cr.RepositoryReader.from_path(self.tmpdir) + for pkg in reader.iter_packages(): + # test that the package files are present where expected + pkg_path = os.path.join(self.tmpdir, pkg.location_href) + assert os.path.exists(pkg_path) + # test that changelog_limit works + assert len(pkg.changelogs) <= 1 + # test that the package checksum type is correct + assert pkg.checksum_type == "sha512" + + expected_updaterecords = [TEST_UPDATERECORD_UPDATE1] + for expected, actual in zip(expected_updaterecords, reader.advisories): + assert expected == actual + def test_add_repo_metadata(self): """Test adding an additional repo metadata file to the repository.""" @@ -239,4 +249,4 @@ def test_add_package(self): assert pkg.location_href.startswith("Packages/") # test that the package files are present where expected pkg_path = os.path.join(self.tmpdir, pkg.location_href) - assert os.path.exists(pkg_path) \ No newline at end of file + assert os.path.exists(pkg_path)