SUSE / rmt

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

Fix wrong directory content copying resulting in repodata/repodata #1144

Closed felixsch closed 1 month ago

felixsch commented 1 month ago

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:

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:

cheers!