Other available CLIs
scancode-reindex-licenses
Usage
Usage: scancode-reindex-licenses [OPTIONS]
Reindex scancode licenses and exit
Options
- --all-languages
[EXPERIMENTAL] Rebuild the license index including texts all languages (and not only English) and exit.
- --only-builtin
Rebuild the license index excluding any additional license directory or additional license plugins which were added previously, i.e. with only builtin scancode license and rules.
- --additional-directory DIR
Include this directory with additional custom licenses and license rules in the license detection index.
- --load-dump
Load all license and rules from their respective files and then dump them back to those same files.
- -h, --help
Shows the options and explanations.
All Extractcode Options
This is intended to be used as an input preparation step, before running the scan. Archives found in an extracted archive are extracted recursively by default. Extraction is done in-place in a directory named ‘-extract’ side-by-side with an archive.
To extract the packages in the samples
directory
extractcode samples
This extracts the zlib.tar.gz package:
- --shallow
Do not extract recursively nested archives (e.g. Not archives in archives).
- --verbose
Print verbose file-by-file progress messages.
- --quiet
Do not print any summary or progress message.
- -h, --help
Show the extractcode help message and exit.
- --about
Show information about ScanCode and licensing and exit.
- --version
Show the version and exit.
scancode-reindex-licenses
command
ScanCode maintains a license index to search for and detect licenses. When Scancode is configured for the first time, a license index is built and used in every scan thereafter.
This scancode-reindex-licenses
command rebuilds the license index. Running this command
displays the following message to the terminal:
Checking and rebuilding the license index...
This has several CLI options as follows:
--additional-directory
Option:
The --additional-directory
option allows the user to include additional directories
of licenses to use in license detection.
This command only needs to be run once for each set of additional directories, in all subsequent runs of Scancode with the same directories all the licenses in the directories will be cached and used in License detection. But reindexing removes these directories, if they aren’t reintroduced as additional directories.
The directory structure should look something like this:
additional_license_directory/
├── licenses/
│ ├── example-installed-1.LICENSE
│ └── example-installed-1.yaml
├── rules/
│ ├── example-installed-1.RULE
│ └── example-installed-1.yaml
Here is an example of reindexing the license cache using the --additional-directory PATH
option
with a single directory:
scancode-reindex-licenses --additional-directory tests/licensedcode/data/additional_licenses/additional_dir/
You can also include multiple directories like so:
scancode-reindex-licenses --additional-directory /home/user/external_licenses/external1 --additional-directory /home/user/external_licenses/external2
If you want to continue running scans with /home/user/external_licenses/external1
and
/home/user/external_licenses/external2
, you can simply run scans after the command above
reindexing with those directories and they will be included.
scancode -l --license-text --json-pp output.json samples
However, if you wanted to run a scan with a new set of directories, such as
home/user/external_licenses/external1
and home/user/external_licenses/external3
, you would
need to reindex the license index with those directories as parameters:
scancode --additional-directory /home/user/external_licenses/external1 --additional-directory /home/user/external_licenses/external3
Note
Adding licenses/rules from an additional directory is not permanent. Another reindexing without the additional directory option would just use the builtin scancode licenses and rules, and will not have these additonal licenses/rules anymore.
Note
You can also install external licenses through a plugin for better reproducibility and distribution of those license/rules for use in conjunction with scancode-toolkit licenses. See How to install a plugin containing external licenses and/or rules
--only-builtin
Option:
Rebuild the license index excluding any additional license directory or additional license plugins which were added previously, i.e. with only builtin scancode license and rules.
This is applicable when there are additional license plugins installed already and you want to reindex the licenses without these licenses from the additional plugins.
Note
Running the --only-builtin
command won’t get rid of the installed license plugins, it
would just reindex without the licenses from these plugins for once. Another reindex afterwards
without this option would bring back the licenses from the plugins again in the index.
--all-languages
Option:
Rebuild the license index including texts all languages (and not only English) and exit. This is an EXPERIMENTAL option.
--load-dump
Option
Load all licenses and rules from their respective files and then dump them to their respective files. This is done to make small formatting changes across all licenses and rules, to be consistent across them.