RPM `primary.xml` updater
What does this MR do and why?
Extends RepositoryMetadata
builder services with update_xml_document
function to update existed xml files with metadata from new packages and update_package_count
function to update packages
attribute in root tag.
Screenshots or screen recordings
How to set up and validate locally
- Generate empty
xml
empty = Packages::Rpm::RepositoryMetadata::BuildPrimaryXml.new.execute
- Set variable with parsed RPM package metadata
data = {:files=>["/usr/bin/hello.sh"],
:changelogs=>[{:changelogtext=>"- First build", :changelogtime=>1662552000}],
:requirements=>
[{:requirename=>"bash", :requireversion=>"", :requireflags=>0},
{:requirename=>"rpmlib(CompressedFileNames)", :requireversion=>"3.0.4-1", :requireflags=>16777226},
{:requirename=>"rpmlib(FileDigests)", :requireversion=>"4.6.0-1", :requireflags=>16777226},
{:requirename=>"rpmlib(PayloadFilesHavePrefix)", :requireversion=>"4.0-1", :requireflags=>16777226},
{:requirename=>"rpmlib(PayloadIsXz)", :requireversion=>"5.2-1", :requireflags=>16777226}],
:provides=>
[{:providename=>"hello", :provideflags=>8, :provideversion=>"0.0.1-1.fc29"},
{:providename=>"hello(x86-64)", :provideflags=>8, :provideversion=>"0.0.1-1.fc29"}],
:name=>"hello",
:version=>"0.0.1",
:release=>"1.fc29",
:summary=>"Simple RPM package",
:description=>"Fake rpm package",
:arch=>"x86_64",
:license=>"MIT",
:sourcerpm=>"hello-0.0.1-1.fc29.src.rpm",
:group=>"Unspecified",
:buildhost=>"localhost",
:packager=>nil,
:vendor=>nil}
- Call service again passing empty
xml
anddata
new_xml = Packages::Rpm::RepositoryMetadata::BuildPrimaryXml.new(xml: empty, data: data).execute
Empty xml gets new child and packages
attribute incremented by 1
4) You can call it again with new_xml
and same data
and it will append new child
Packages::Rpm::RepositoryMetadata::BuildPrimaryXml.new(xml: new_xml, data: data).execute
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #372733 (closed)
Edited by bohdan-barylo