|
| 1 | +Other available CLIs |
| 2 | +==================== |
| 3 | + |
| 4 | +.. _other_cli: |
| 5 | + |
| 6 | +---- |
| 7 | + |
| 8 | +.. include:: /rst_snippets/scancode-reindex-licenses.rst |
| 9 | + |
| 10 | +---- |
| 11 | + |
| 12 | +.. include:: /rst_snippets/extract.rst |
| 13 | + |
| 14 | +---- |
| 15 | + |
| 16 | +``scancode-reindex-licenses`` command |
| 17 | +------------------------------------- |
| 18 | + |
| 19 | +ScanCode maintains a license index to search for and detect licenses. When Scancode is |
| 20 | +configured for the first time, a license index is built and used in every scan thereafter. |
| 21 | + |
| 22 | +This ``scancode-reindex-licenses`` command rebuilds the license index. Running this command |
| 23 | +displays the following message to the terminal:: |
| 24 | + |
| 25 | + Checking and rebuilding the license index... |
| 26 | + |
| 27 | +This has several CLI options as follows: |
| 28 | + |
| 29 | +``--additional-directory`` Option: |
| 30 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 31 | + |
| 32 | +The ``--additional-directory`` option allows the user to include additional directories |
| 33 | +of licenses to use in license detection. |
| 34 | + |
| 35 | +This command only needs to be run once for each set of additional directories, in all subsequent |
| 36 | +runs of Scancode with the same directories all the licenses in the directories will be cached |
| 37 | +and used in License detection. But reindexing removes these directories, if they aren't |
| 38 | +reintroduced as additional directories. |
| 39 | + |
| 40 | +The directory structure should look something like this:: |
| 41 | + |
| 42 | + additional_license_directory/ |
| 43 | + ├── licenses/ |
| 44 | + │ ├── example-installed-1.LICENSE |
| 45 | + │ └── example-installed-1.yaml |
| 46 | + ├── rules/ |
| 47 | + │ ├── example-installed-1.RULE |
| 48 | + │ └── example-installed-1.yaml |
| 49 | + |
| 50 | +Here is an example of reindexing the license cache using the ``--additional-directory PATH`` option |
| 51 | +with a single directory:: |
| 52 | + |
| 53 | + scancode-reindex-licenses --additional-directory tests/licensedcode/data/additional_licenses/additional_dir/ |
| 54 | + |
| 55 | +You can also include multiple directories like so:: |
| 56 | + |
| 57 | + scancode-reindex-licenses --additional-directory /home/user/external_licenses/external1 --additional-directory /home/user/external_licenses/external2 |
| 58 | + |
| 59 | +If you want to continue running scans with ``/home/user/external_licenses/external1`` and |
| 60 | +``/home/user/external_licenses/external2``, you can simply run scans after the command above |
| 61 | +reindexing with those directories and they will be included. :: |
| 62 | + |
| 63 | + scancode -l --license-text --json-pp output.json samples |
| 64 | + |
| 65 | +However, if you wanted to run a scan with a new set of directories, such as |
| 66 | +``home/user/external_licenses/external1`` and ``home/user/external_licenses/external3``, you would |
| 67 | +need to reindex the license index with those directories as parameters:: |
| 68 | + |
| 69 | + scancode --additional-directory /home/user/external_licenses/external1 --additional-directory /home/user/external_licenses/external3 |
| 70 | + |
| 71 | +.. include:: /rst_snippets/note_snippets/additional_directory_is_temp.rst |
| 72 | + |
| 73 | + |
| 74 | +.. note:: |
| 75 | + |
| 76 | + You can also install external licenses through a plugin for |
| 77 | + better reproducibility and distribution of those license/rules |
| 78 | + for use in conjunction with scancode-toolkit licenses. |
| 79 | + See :ref:`install_new_license_plugin` |
| 80 | + |
| 81 | + |
| 82 | +``--only-builtin`` Option: |
| 83 | +^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 84 | + |
| 85 | +Rebuild the license index excluding any additional license directory or additional |
| 86 | +license plugins which were added previously, i.e. with only builtin scancode license and rules. |
| 87 | + |
| 88 | +This is applicable when there are additional license plugins installed already and you want to |
| 89 | +reindex the licenses without these licenses from the additional plugins. |
| 90 | + |
| 91 | +.. note:: |
| 92 | + |
| 93 | + Running the ``--only-builtin`` command won't get rid of the installed license plugins, it |
| 94 | + would just reindex without the licenses from these plugins for once. Another reindex afterwards |
| 95 | + without this option would bring back the licenses from the plugins again in the index. |
| 96 | + |
| 97 | + |
| 98 | +``--all-languages`` Option: |
| 99 | +^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
| 100 | + |
| 101 | +Rebuild the license index including texts all languages (and not only |
| 102 | +English) and exit. This is an EXPERIMENTAL option. |
0 commit comments