Skip to content

RPM `other.xml` updater 'refactored'

Oleksandr Chernov requested to merge 372735-update-other-xml-refact into master

What does this MR do and why?

This MR is an refactored version for !98272 (merged) that is merged and for !98882 (closed) that is currently open. In the last MR you can find answers why this one is created. The main change here is for base_builder service that was refactored to xml_manager service.

Previous flow:

  • create empty xml empty = Packages::Rpm::RepositoryMetadata::BuildPrimaryXml.new.execute
  • update xml new_xml = Packages::Rpm::RepositoryMetadata::BuildPrimaryXml.new(xml: empty, data: data).execute

Current flow:

  • create empty xml empty = Packages::Rpm::RepositoryMetadata::XmlManager.new(filename: :primary).execute
  • update xml new_xml = Packages::Rpm::RepositoryMetadata::XmlManager.new(filename: :primary, xml: empty, data: data).execute

Added function remove_existing_packages that checks if node with provided pkgid exists in the xml and remove it to update with provided params.

Screenshots or screen recordings

  • Generate empty xml
  • Set payload data to update
  • Update empty xml -> new_xml updated with new node
  • Update new_xml with the same data -> No changes applied

Screenshot_2022-10-13_at_12.06.28

  • Update data name attribute and leave pkgid same
  • Update new_xml with new data -> Still have 1 node but with updated name tag

Screenshot_2022-10-13_at_12.09.41

  • Update data pkgid attribute
  • Update new_xml with new data -> New node added

Screenshot_2022-10-13_at_12.13.04

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #372735 (closed)

Edited by bohdan-barylo

Merge request reports