SUSE / rmt

RPM repository mirroring tool and registration proxy for SUSE Customer Center.
Other
38 stars 45 forks source link

[4/x] Refactor repomd mirroring #1060

Closed ngetahun closed 10 months ago

ngetahun commented 11 months ago

This PR is part of our code sprint: https://trello.com/c/hU27QHob/3134-rdeb-sprint-tracker

The whole changeset is:

[1/5] Prepare code sprint and implement repository type detection [2/5] Add flat debian mirroring support to RMT [3/5] Refactor suma mirroring [4/5] Refactor repomd mirroring [5/5] Fixes and cleanup [6/6] Nested debian repository support

Implementation in this merge request:

DO NOT MERGE UNTIL COMPLETELY READY

Demo steps

Testing the license mirroring

> repo = Repository.find(3624)
> licences  = RMT::Mirror::License.new(repository: repo, logger: RMT::Logger.new($stdout))
# verify license path
> licenses.repository_path
# should output %your_base_rmt_dir/public/repo/SUSE/Products/SLE-Product-SLES/15-SP4/x86_64/product.license/"
> licenses.mirror
# verify output
> `ls #{licenses.repository_path}`.chomp.split("\n")
# should output ["directory.yast", "license.cs.txt", "license.de.txt", "license.es.txt", "license.fr.txt", "license.it.txt", "license.ja.txt", "license.ko.txt", "license.pt_BR.txt", "license.ru.txt", "license.txt", "license.zh_CN.txt", "license.zh_TW.txt"]

Testing repomd mirroring

# Expose repository_path and repository_url, for testing purposes
> RMT::Mirror::Repomd.send(:public, *[:repository_path, :repository_url])
> repo = Repository.find(3624)
> repomd = RMT::Mirror::Repomd.new(repository: repo, logger: RMT::Logger.new($stdout))
> repomd.repository_path
# %rmt_home_dir%/public/repo/SUSE/Products/SLE-Product-SLES/15-SP4/x86_64/product/
> repomd.mirror
> `ls #{repomd.repository_path}`.chomp.split("\n")
# should output ["noarch", "repodata", "x86_64"]
> `ls #{repomd.repository_path}/x86_64`.chomp.split("\n")
# should output ["skelcd-control-SLES-15.4.1-150400.1.6.x86_64.rpm", "sles-release-15.4-150400.55.1.x86_64.rpm"]

Thanks for reviewing this pull request!

If you have any question please do not hesitate to approach me! :rocket: