Bug: 269303659

Clone this repo:
  1. 46c4c49 Added OWNERS to licenseclassifier am: c79e4c5e53 am: 355107e119 am: 2f992e8459 am: ce410de1ad am: c271f3cc87 by Ibrahim Kanouche · 1 year, 2 months ago android14-qpr2-release android14-qpr2-s1-release android14-qpr2-s2-release android14-qpr2-s3-release main master android-14.0.0_r29 android-14.0.0_r30 android-14.0.0_r31 android-14.0.0_r32 android-14.0.0_r33
  2. 11bae8c Added OWNERS to licenseclassifier am: c79e4c5e53 am: 355107e119 am: 2f992e8459 am: ce410de1ad am: 017ec2ccf7 by Ibrahim Kanouche · 1 year, 2 months ago
  3. 017ec2c Added OWNERS to licenseclassifier am: c79e4c5e53 am: 355107e119 am: 2f992e8459 am: ce410de1ad by Ibrahim Kanouche · 1 year, 2 months ago aml_tz5_341510010 android14-mainline-adbd-release android14-mainline-adservices-release android14-mainline-appsearch-release android14-mainline-art-release android14-mainline-cellbroadcast-release android14-mainline-conscrypt-release android14-mainline-extservices-release android14-mainline-media-release android14-mainline-media-swcodec-release android14-mainline-mediaprovider-release android14-mainline-networking-release android14-mainline-os-statsd-release android14-mainline-permission-release android14-mainline-resolv-release android14-mainline-sdkext-release android14-mainline-tethering-release android14-mainline-uwb-release android14-mainline-wifi-release aml_adb_340912000 aml_adb_340912200 aml_adb_340912350 aml_adb_340912530 aml_adb_341517070 aml_ads_340915050 aml_ads_341027030 aml_ads_341131050 aml_ads_341316030 aml_ads_341413000 aml_ads_341517040 aml_art_340915060 aml_art_341010050 aml_art_341110060 aml_art_341110110 aml_art_341311100 aml_art_341411300 aml_art_341514410 aml_ase_340913000 aml_ase_341113000 aml_ase_341310010 aml_ase_341410000 aml_ase_341510000 aml_cbr_340914000 aml_cbr_341011000 aml_cbr_341110000 aml_cbr_341311010 aml_cbr_341410010 aml_cbr_341510010 aml_cfg_341510000 aml_con_341110000 aml_con_341310090 aml_con_341410300 aml_con_341511080 aml_doc_340916000 aml_doc_341012000 aml_doc_341112000 aml_doc_341312010 aml_doc_341510050 aml_ext_341027030 aml_ext_341131030 aml_ext_341317010 aml_ext_341414010 aml_ext_341518010 aml_ips_340914000 aml_ips_340914200 aml_ips_340914280 aml_ips_341510000 aml_med_340922010 aml_med_341011000 aml_med_341111000 aml_med_341312020 aml_med_341312300 aml_med_341513600 aml_mpr_340919000 aml_mpr_341015030 aml_mpr_341015090 aml_mpr_341111020 aml_mpr_341111030 aml_mpr_341313030 aml_mpr_341411070 aml_mpr_341511070 aml_net_340913000 aml_net_341014000 aml_net_341111030 aml_net_341310020 aml_net_341311010 aml_net_341411030 aml_net_341510000 aml_net_341510050 aml_neu_341010000 aml_neu_341010080 aml_neu_341510000 aml_per_340916010 aml_per_341011020 aml_per_341011100 aml_per_341110010 aml_per_341110020 aml_per_341311000 aml_per_341410020 aml_per_341510010 aml_res_340912000 aml_res_341110000 aml_res_341311030 aml_res_341410010 aml_res_341510000 aml_sch_341510000 aml_sdk_340912010 aml_sdk_341010000 aml_sdk_341110000 aml_sdk_341110080 aml_sdk_341410000 aml_sdk_341510000 aml_sta_340911000 aml_sta_340912000 aml_sta_341010020 aml_sta_341111000 aml_sta_341114000 aml_sta_341311010 aml_sta_341410000 aml_sta_341511040 aml_swc_340922010 aml_swc_341011020 aml_swc_341111000 aml_swc_341312020 aml_swc_341312300 aml_swc_341513600 aml_tet_340913030 aml_tet_341010040 aml_tet_341112070 aml_tet_341310230 aml_tet_341411060 aml_tet_341511010 aml_tz5_341510010 aml_tz5_341510050 aml_uwb_341011000 aml_uwb_341111010 aml_uwb_341310030 aml_uwb_341310300 aml_uwb_341511050 aml_wif_340913010 aml_wif_341011010 aml_wif_341110010 aml_wif_341310010 aml_wif_341410080 aml_wif_341510000
  4. c271f3c Added OWNERS to licenseclassifier am: c79e4c5e53 am: 355107e119 am: 2f992e8459 am: ce410de1ad by Ibrahim Kanouche · 1 year, 2 months ago android14-qpr1-release android14-qpr1-s2-release android-14.0.0_r16 android-14.0.0_r17 android-14.0.0_r18 android-14.0.0_r19 android-14.0.0_r20 android-14.0.0_r21 android-14.0.0_r22 android-14.0.0_r23 android-14.0.0_r24 android-14.0.0_r25 android-14.0.0_r26 android-14.0.0_r27
  5. ce410de Added OWNERS to licenseclassifier am: c79e4c5e53 am: 355107e119 am: 2f992e8459 by Ibrahim Kanouche · 1 year, 2 months ago android14-dev

License Classifier

Build status

Introduction

The license classifier is a library and set of tools that can analyze text to determine what type of license it contains. It searches for license texts in a file and compares them to an archive of known licenses. These files could be, e.g., LICENSE files with a single or multiple licenses in it, or source code files with the license text in a comment.

A “confidence level” is associated with each result indicating how close the match was. A confidence level of 1.0 indicates an exact match, while a confidence level of 0.0 indicates that no license was able to match the text.

Adding a new license

Adding a new license is straight-forward:

  1. Create a file in licenses/.

    • The filename should be the name of the license or its abbreviation. If the license is an Open Source license, use the appropriate identifier specified at https://spdx.org/licenses/.
    • If the license is the “header” version of the license, append the suffix “.header” to it. See licenses/README.md for more details.
  2. Add the license name to the list in license_type.go.

  3. Regenerate the licenses.db file by running the license serializer:

    $ license_serializer -output licenseclassifier/licenses
    
  4. Create and run appropriate tests to verify that the license is indeed present.

Tools

Identify license

identify_license is a command line tool that can identify the license(s) within a file.

$ identify_license LICENSE
LICENSE: GPL-2.0 (confidence: 1, offset: 0, extent: 14794)
LICENSE: LGPL-2.1 (confidence: 1, offset: 18366, extent: 23829)
LICENSE: MIT (confidence: 1, offset: 17255, extent: 1059)

License serializer

The license_serializer tool regenerates the licenses.db archive. The archive contains preprocessed license texts for quicker comparisons against unknown texts.

$ license_serializer -output licenseclassifier/licenses

This is not an official Google product (experimental or otherwise), it is just code that happens to be owned by Google.