tarantool / mkrepo

Maintain DEB and RPM repositories on S3
70 stars 24 forks source link

rpm: fix sync of live/1.10/el/7/x86_64 repo #63

Closed ylobankov closed 2 years ago

ylobankov commented 2 years ago

This patch fixes the issue occurred while syncing live/1.10/el/7/x86_64 tarantool repo:

2022-06-01T15:43:52.167754425Z app[web.1]: Traceback (most recent call last):
2022-06-01T15:43:52.167954314Z app[web.1]:   File "/app/.heroku/python/bin/mkrepo", line 5, in <module>
2022-06-01T15:43:52.167969891Z app[web.1]:     mkrepo.main()
2022-06-01T15:43:52.167979377Z app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/mkrepo.py", line 117, in main
2022-06-01T15:43:52.168122234Z app[web.1]:     update_repo(path, args)
2022-06-01T15:43:52.168157987Z app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/mkrepo.py", line 59, in update_repo
2022-06-01T15:43:52.168168105Z app[web.1]:     rpmrepo.update_repo(stor, args.sign, args.temp_dir, args.force)
2022-06-01T15:43:52.168177668Z app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/rpmrepo.py", line 1097, in update_repo
2022-06-01T15:43:52.168187173Z app[web.1]:     primary_str = dump_primary(primary)
2022-06-01T15:43:52.168196066Z app[web.1]:   File "/app/.heroku/python/lib/python3.9/site-packages/rpmrepo.py", line 495, in dump_primary
2022-06-01T15:43:52.168413070Z app[web.1]:     for key in sorted(fmt['provides']):
2022-06-01T15:43:52.168456583Z app[web.1]: TypeError: '<' not supported between instances of 'str' and 'NoneType'
2022-06-01T15:43:52.253078579Z app[web.1]: 2022-06-01 15:43:52,252 (WARNING) Synchronization failed: live/1.10/el/7/x86_64

As we can see from the traceback, the sorted() function cannot sort keys from the fmt['provides'] dict because these keys are tuples with different types of items (None and str). So the sort_key function was introdused to handle such cases. Also, a test was added.

Fixes #62