I don't really understand the point of using the cache. One possible purpose is to save the final state so the intermediate states can be run as a debug measure. But it is not designed that way, instead the cache is by default read in on a full run, when all of the values are going to be regenerated anyway.
One problem this causes is this. If you have a cache that was generated from a previous run, but you remove distros in a current _config, then rosindex crashes on build:
Generating packages search index...
/home/kent/rosindex/_plugins/rosindex_generator.rb:1519:in `sort': comparison of Hash with Hash failed (ArgumentError)
from /home/kent/rosindex/_plugins/rosindex_generator.rb:1519:in `generate'
from /home/kent/.bundle/ruby/2.7.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:193:in `block in generate'
from /home/kent/.bundle/ruby/2.7.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:191:in `each'
from /home/kent/.bundle/ruby/2.7.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:191:in `generate'
The code is:
sorted_packages_index = packages_index.sort do |a, b|
$all_distros.index(a['distro']) <=> $all_distros.index(b['distro'])
end
Investigating, packages_index (generated from @all_repos) has the older distros available, but they are not in $all_distros which just has the ones selected in the _config file, hence the error.
It seems to me that the default behavior should be to not use the cache on normal runs - but write to the cache at the end. If you want to debug something, enable the cache prior to the debug run.
I don't really understand the point of using the cache. One possible purpose is to save the final state so the intermediate states can be run as a debug measure. But it is not designed that way, instead the cache is by default read in on a full run, when all of the values are going to be regenerated anyway.
One problem this causes is this. If you have a cache that was generated from a previous run, but you remove distros in a current _config, then rosindex crashes on build:
The code is:
Investigating, packages_index (generated from @all_repos) has the older distros available, but they are not in $all_distros which just has the ones selected in the _config file, hence the error.
It seems to me that the default behavior should be to not use the cache on normal runs - but write to the cache at the end. If you want to debug something, enable the cache prior to the debug run.