Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use of cache causes crash when repos are removed #405

Open
rkent opened this issue Jul 20, 2024 · 0 comments
Open

Use of cache causes crash when repos are removed #405

rkent opened this issue Jul 20, 2024 · 0 comments

Comments

@rkent
Copy link

rkent commented Jul 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant