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

problem with cached rules after changing a rule #1846

Closed
krutztq opened this issue Nov 26, 2019 · 2 comments
Closed

problem with cached rules after changing a rule #1846

krutztq opened this issue Nov 26, 2019 · 2 comments
Labels

Comments

@krutztq
Copy link

krutztq commented Nov 26, 2019

Description

If I add/update/delete a rule, scancode is somehow caching the old ones. I tried deleting ~/.cache/scancode-tk and drop the cache (/proc/sys/vm/drop_cache), unsuccessfully.
How can the cached data be updated or be ignored?

How To Reproduce

  • run a scan
  • add/update/delete a rule
  • run the same scan, again
  • scancode does not know the changes in the rules

System configuration

  • What OS are you running on? (Windows/MacOS/Linux)
    Ubuntu 18.04
  • What version of scancode-toolkit was used to generate the scan file?
    3.1.1
  • What installation method was used to install/run scancode? (pip/source download/other)
    download
@krutztq krutztq added the bug label Nov 26, 2019
@pombredanne
Copy link
Member

The short story:

Use this

  • add/update/delete a rule
  • run scancode --reindex-licenses
  • run the same scan, again

The long story:

There are two modes that drive license cache handling: the regular "user" mode and the "development" mode.

  • In "development" mode, (typically from a git checkout), you typically start by calling first ./configure. This will create an empty tag file at the root of your scancode checkout named SCANCODE_DEV_MODE. When this file is present, any change to the code or to the license data (e.g. rules or licenses) will trigger a cache deletion and reindexing. In that mode the cache is stored at the root of your scancode checkout in a .cache directory

  • Otherwise if that file is not present (e.g. when running from an archive and when you start with a call to ./scancode rather than ./configure), the cache is created once and never checked afterwards. The cache is created and used in ~/.cache/scancode-tk as you found out..

FWIW, the code that handles this is there https://github.com/nexB/scancode-toolkit/blob/9202df472aaec9dd6657e8babe8e79519140519f/src/licensedcode/cache.py#L184

In any case and in any mode, you can force a cache check and a reindexing by running scancode --reindex-licenses. If needed the cache will be recreated in the location used for your "mode"

(though it happens automatically when you have a SCANCODE_DEV_MODE tag file present)

Note also that there is this ticket #480 that has long been in the waiting.

@krutztq
Copy link
Author

krutztq commented Nov 26, 2019

Thanks, again :-)

@krutztq krutztq closed this as completed Nov 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants