DOI: 10.5281/zenodo.8200352
title: The Software Heritage License Dataset (2022 Edition)

description: This dataset contains all “license files” extracted from a snapshot of the Software Heritage archive taken on 2022-04-25. (Other, possibly more recent, versions of the datasets can be found at https://annex.softwareheritage.org/public/dataset/license-blobs/). In this context, a <em>license file</em> is a unique file content (or “blob”) that appeared in a software origin archived by Software Heritage as a file whose name is often used to ship licenses in software projects. Some name examples are: <code>COPYING</code>, <code>LICENSE</code>, <code>NOTICE</code>, <code>COPYRIGHT</code>, etc. The exact file name pattern used to select the blobs contained in the dataset can be found in the SQL query file <code>01-select-blobs.sql</code>. Note that the file name was not expected to be at the project root, because project subdirectories can contain different licenses than the top-level one, and we wanted to include those too. <strong>Format</strong> The dataset is organized as follows: <code>blobs.tar.zst</code>: a Zst-compressed tarball containing deduplicated license blobs, one per file. The tarball contains 6’859’189 blobs, for a total uncompressed size on disk of 66 GiB. The blobs are organized in a sharded directory structure that contains files named like <code>blobs/86/24/8624bcdae55baeef00cd11d5dfcfa60f68710a02</code>, where: <code>blobs/</code> is the root directory containing all license blobs <code>8624bcdae55baeef00cd11d5dfcfa60f68710a02</code> is the SHA1 checksum of a specific license blobs, a copy of the GPL3 license in this case. Each license blob is ultimately named with its SHA1: <pre><code>$ head -n 3 blobs/86/24/8624bcdae55baeef00cd11d5dfcfa60f68710a02 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 $ sha1sum blobs/86/24/8624bcdae55baeef00cd11d5dfcfa60f68710a02 8624bcdae55baeef00cd11d5dfcfa60f68710a02 blobs/86/24/8624bcdae55baeef00cd11d5dfcfa60f68710a02</code></pre> <code>86</code> and <code>24</code> are, respectively, the first and second group of two hex digits in the blob SHA1 One blob is missing, because its size (313MB) prevented its inclusion; (it was originally a tarball containing source code): <pre><code>swh:1:cnt:61bf63793c2ee178733b39f8456a796b72dc8bde,1340d4e2da173c92d432026ecdc54b4859fe9911,"AUTHORS"</code></pre> <code>blobs-sample20k.tar.zst</code>: analogous to <code>blobs.tar.zst</code>, but containing “only” 20’000 randomly selected license blobs <code>license-blobs.csv.zst</code> a Zst-compressed CSV index of all the blobs in the dataset. Each line in the index (except the first one, which contains column headers) describes a license blob and is in the format <code>SWHID,SHA1,NAME</code>, for example: <pre><code> swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2,8624bcdae55baeef00cd11d5dfcfa60f68710a02,"COPYING" swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2,8624bcdae55baeef00cd11d5dfcfa60f68710a02,"COPYING.GPL3" swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2,8624bcdae55baeef00cd11d5dfcfa60f68710a02,"COPYING.GLP-3"</code></pre> where: <strong>SWHID:</strong> the Software Heritage persistent identifier of the blob. It can be used to retrieve and cross-reference the license blob via the Software Heritage archive, e.g., at: https://archive.softwareheritage.org/swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 <strong>SHA1:</strong> the blob SHA1, that can be used to cross-reference blobs in the <code>blobs/</code> directory <strong>NAME:</strong> <em>a</em> file name given to the license blob in a given software origin. As the same license blob can have different names in different contexts, the index contain multiple entries for the same blob with different names, as it is the case in the example above (yes, one of those has a typo in it, but it’s an <em>original</em> typo from some repository!). <code>blobs-fileinfo.csv.zst</code> a Zst-compressed CSV mapping from blobs to basic file information in the format: <code>SHA1,MIME_TYPE,ENCODING,LINE_COUNT,WORD_COUNT,SIZE</code>, where: <strong>SHA1:</strong> blob SHA1 <strong>MIME_TYPE:</strong> blob MIME type, as detected by libmagic <strong>ENCODING:</strong> blob character encoding, as detected by libmagic <strong>LINE_COUNT:</strong> number of lines in the blob (only for textual blobs with UTF8 encoding) <strong>WORD_COUNT:</strong> number of words in the blob (only for textual blobs with UTF8 encoding) <strong>SIZE:</strong> blob size in bytes <code>blobs-scancode.csv.zst</code> a Zst-compressed CSV mapping from blobs to software license detected in them by ScanCode, in the format: <code>SHA1,LICENSE,SCORE</code>, where: <strong>SHA1:</strong> blob SHA1 <strong>LICENSE:</strong> license detected in the blob, as an SPDX identifier (or ScanCode identifier for non-SPDX-indexed licenses) <strong>SCORE:</strong> confidence score in the result, as a decimal number between 0 and 100 There may be zero or arbitrarily many lines for each blob. <code>blobs-scancode.ndjson.zst</code> a Zst-compressed line-delimited JSON, containing a superset of the information in <code>blobs-scancode.csv.zst</code>. Each line is a JSON dictionary with three keys: <strong>sha1</strong>: blob SHA1 <strong>licenses</strong>: output of <code>scancode.api.get_licenses(..., min_score=0)</code> <strong>copyrights</strong>: output of <code>scancode.api.get_copyrights(...)</code> There is exactly one line for each blob. <code>licenses</code> and <code>copyrights</code> keys are omitted for files not detected as plain text. <code>blobs-origins.csv.zst</code> a Zst-compressed CSV mapping of where license blobs come from. Each line in the index associate a license blob to one of its origins in the format <code>SWHID&lt;TAB&gt;URL</code>, for example: <pre><code> swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 https://github.com/pombreda/Artemis</code></pre> Note that a license blob can come from many different places, only an arbitrary (and somewhat random) one is listed in this mapping. If no origin URL is found in the Software Heritage archive, then a blank is used instead. This happens when they were either being loaded when the dataset was generated, or the loader process crashed before completing the blob’s origin’s ingestion. <code>blobs-nb-origins.csv.zst</code> a Zst-compressed CSV mapping of how many origins of this blob are known to Software Heritage. Each line in the index associate a license blob to this count in the format <code>SWHID&lt;TAB&gt;NUMBER</code>, for example: <pre><code> swh:1:cnt:94a9ed024d3859793618152ea559a168bbcbb5e2 2822260</code></pre> Two blobs are missing because the computation crashes: <pre><code> swh:1:cnt:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 swh:1:cnt:8b137891791fe96927ad78e64b0aad7bded08bdc</code></pre> This issue will be fixed in a future version of the dataset <code>blobs-earliest.csv.zst</code> a Zst-compressed CSV mapping from blobs to information about their (earliest) known occurence(s) in the archive. Format: <code>SWHID&lt;TAB&gt;EARLIEST_SWHID&lt;TAB&gt;EARLIEST_TS&lt;TAB&gt;OCCURRENCES</code>, where: <strong>SWHID:</strong> blob SWHID <strong>EARLIEST_SWHID:</strong> SWHID of the earliest known commit containing the blob <strong>EARLIEST_TS:</strong> timestamp of the earliest known commit containing the blob, as a Unix time integer <strong>OCCURRENCES:</strong> number of known commits containing the blob <code>replication-package.tar.gz</code>: code and scripts used to produce the dataset <code>licenses-annotated-sample.tar.gz</code>: ground truth, i.e., manually annotated random sample of license blobs, with details about the kind of information they contain. <strong>Changes since the 2021-03-23 dataset</strong> More input data, due to the SWH archive growing: more origins in supported forges and package managers; and support for more forges and package managers. See the SWH Archive Changelog for details. Values in the <strong>NAME</strong> column of <code>license-blobs.csv.zst</code> are quoted, as some file names now contain commas. Replication package now contains all the steps needed to reproduce all artefacts including the <code>licenseblobs/fetch.py</code> script. <code>blobs-nb-origins.csv.zst</code> is added. <code>blobs-origins.csv.zst</code> is now generated using the first origin returned by swh-graph’s <code>leaves</code> endpoint, instead of its <code>randomwalk</code> endpoint. This should have no impact on the result, other than a different distribution of “random” origins being picked. <code>blobs-origins.csv.zst</code> was missing ~10% of its results in previous versions of the dataset, due to errors and/or timeouts in its generation, this is now down to 0.02% (1254 of the 6859445 unique blobs). Blobs with no known origins are now present, with a blank instead of URL. <code>blobs-earliest.csv.zst</code> was missing ~10% of its results in previous versions of the dataset. It is complete now. <code>blobs-scancode.csv.zst</code> is generated with a newer scancode-toolkit version (31.2.1) <code>blobs-scancode.ndjson.zst</code> is added. <strong>Errata</strong> A file name <code>.tmp_1340d4e2da173c92d432026ecdc54b4859fe9911</code> was present in the initial version of the dataset (published on 2022-11-07). It was removed on 2022-11-09 using these two commands: <pre><code>pv blobs-fileinfo.csv.zst | zstdcat | grep -v "\.tmp" | zstd -19 pv blobs.tar.zst| zstdcat | tar --delete blobs/13/40/.tmp_1340d4e2da173c92d432026ecdc54b4859fe9911 | zstd -19 -T12</code></pre> The total uncompressed size was announced as 84 GiB based on the physical size on ext4, but it is actually 66 GiB. <strong>Citation</strong> If you use this dataset for research purposes, please acknowledge its use by citing one or both of the following papers: Jesus M. Gonzalez-Barahona, Sergio Montes-Leon, Gregorio Robles, Stefano Zacchiroli. <em>The Software Heritage License Dataset (2022 Edition)</em>. To appear in Empirical Software Engineering, Springer. [pdf, bib] Stefano Zacchiroli. <em>A Large-scale Dataset of (Open Source) License Text Variants</em>. In proceedings of the 2022 Mining Software Repositories Conference (MSR 2022). 23-24 May 2022 Pittsburgh, Pennsylvania, United States. ACM 2022. <strong>References</strong> The dataset has been built using primarily the data sources described in the following papers: [pdf, bib] Roberto Di Cosmo, Stefano Zacchiroli. Software Heritage: Why and How to Preserve Software Source Code. In Proceedings of iPRES 2017: 14th International Conference on Digital Preservation, Kyoto, Japan, 25-29 September 2017. [pdf, bib] Antoine Pietri, Diomidis Spinellis, Stefano Zacchiroli. The Software Heritage Graph Dataset: Public software development under one roof. In proceedings of MSR 2019: The 16th International Conference on Mining Software Repositories, May 2019, Montreal, Canada. Pages 138-142, IEEE 2019.
description: Other, possibly more recent, versions of the datasets can be found at https://annex.softwareheritage.org/public/dataset/license-blobs/