catay / rrst

Remote Repository Sync Tool
Apache License 2.0
5 stars 1 forks source link

Clean command fails as of the second run. #1

Closed catay closed 6 years ago

catay commented 6 years ago

Problem

Running the clean command more than one time bails out because it can't find the file to remove.

$ ./rrst -c examples/config.yaml clean   
Clean cache repositories:  
Clean all  
2018/04/16 23:16:35 remove /var/tmp/rrst/cache/SLES-12-3-X86_64-updates/repomd.xml: no such file or directory

Cause

The error handling of the os.Remove function returns an error when removing a file that doesn't exists. Issue is in repomd/repomd.go line 172.

Solution

Code needs to be refactored so the clean up of the cache gets simplified. In the end you simply want to clean up the entire cache_dir/<repo_name> in one go. Currently that's not happening which also leaves an empty directory.