Saw that licenses are not correctly mirrored if available. This is due to we scan for repositories ending with product instead of products/. See second commit.
Added a cleanup method obsolete or broken metadata. This means .old_* directories getting automatically removed and repodata/repodata is deleted if present.
How to test this pull request:
#### set the stage
$ cd <rmt-src>
$ git checkout master
$ bin/rmt-cli product enable SLES/15.5/x86_64
$ bin/rmt-cli mirror repository 5664
# Do it twice to trigger the issue
$ bin/rmt-cli mirror repository 5664
$ ls -la public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product/repodata/
# expect: Now you have `repodata` in `repodata`
# For comparison later
$ stat public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product/repodata/repomd.xml
$ ls -la public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product.license/
# expect: Does not exist
#### perform the review
$ git checkout fix-broken-move-metadata
$ bin/rmt-cli mirror repository 5664
# expect: licenses are now mirrored, check the log output
$ ls -la public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product/repodata/
# expect: has no repodata in repodata
$ stat public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product/repodata/repomd.xml
# expect: Compared to the stat above this should now be updated
$ ls -la public/repo/SUSE/Products/SLE-Product-SLES/15-SP5/x86_64/product.license/
# expect: Exists and has licenses mirrored
Thanks for the review. I you have questions please do no hesitate to ask! :rocket:
Description
card: https://trello.com/c/DZm26xHm/3342-rmt-metadata-is-not-correctly-moved-to-repoistory-root-but-into-repodata-repodata-if-exists issue: https://github.com/SUSE/rmt/issues/1136
Due to changed mechanics after removing the
.old_*
backup mechanism from https://github.com/SUSE/rmt/blob/master/lib/rmt/mirror/base.rb#L134 in https://github.com/SUSE/rmt/commit/5aae83e193d93f87418689578527b04cfded7ba3 does move the directory into the destination directory if already exists, instead of merging them.Additional fixes in this PR:
Saw that licenses are not correctly mirrored if available. This is due to we scan for repositories ending with
product
instead ofproducts/
. See second commit.Added a cleanup method obsolete or broken metadata. This means
.old_*
directories getting automatically removed andrepodata/repodata
is deleted if present.How to test this pull request:
Thanks for the review. I you have questions please do no hesitate to ask! :rocket:
cheers!