spdx.licenses

License list functionality, primarily provided by org.spdx.library.model.license.ListedLicenses.

canonicalise-id

(canonicalise-id id)

Canonicalises id (an SPDX license identifier), by returning it in its canonical case. Returns nil if id is nil or not a listed SPDX license identifier.

deprecated-id?

(deprecated-id? id)

Is id (a String) deprecated? Also returns false if id is not in the SPDX license list.

See this SPDX FAQ item for details on what this means.

equivalent-ids?

(equivalent-ids? id1 id2)

Are id1 and id2 (Strings) equivalent SPDX license identifiers (i.e. taking the SPDX case sensitivity rules in SPDX Annex B into account)?

Notes:

  • Returns false if id1 or id2 are not valid SPDX license identifiers

equivalent-license-refs?

(equivalent-license-refs? s1 s2)

Are s1 and s2 (Strings) equivalent LicenseRefs (i.e. taking the SPDX case sensitivity rules in SPDX Annex B into account)?

Notes:

  • Returns false if s1 or s2 are not valid LicenseRefs

equivalent?

(equivalent? s1 s2)

Are s1 and s2 (Strings) equivalent SPDX license identifiers or LicenseRefs (i.e. taking the SPDX case sensitivity rules in SPDX Annex B into account)?

Notes:

  • Returns false if s1 or s2 are not listed SPDX license identifiers or valid LicenseRefs

fsf-libre-id?

(fsf-libre-id? id)

Is id (a String) FSF Libre? Also returns false if id is not in the SPDX license list.

See this reference for details about what ‘FSF Libre’ means.

fsf-libre-ids

(fsf-libre-ids)(fsf-libre-ids ids)

Returns the set of SPDX license ids that identify FSF Libre licenses within the provided set of SPDX license ids (or all of them, if ids is not provided).

See this reference for details about what ‘FSF Libre’ means.

id->info

(id->info id)(id->info id {:keys [include-large-text-values?], :or {include-large-text-values? false}, :as opts})

Returns SPDX license list information for id as a map, or nil if id is not a valid SPDX license id.

opts are:

  • :include-large-text-values? (default false) - controls whether the following large text values are included in the result: :comment :text :text-html :text-template :header :header-html :header-template

ids

(ids)

The set of all SPDX license identifiers.

init!

(init!)

Initialises this namespace upon first call (and does nothing on subsequent calls), returning nil. Consumers of this namespace are not required to call this fn, as initialisation will occur implicitly anyway; it is provided to allow explicit control of the cost of initialisation to callers who need it.

Note: this method may have a substantial performance cost.

license-ref

(license-ref license-ref-var-section)(license-ref document-ref-var-section license-ref-var-section)

Constructs a LicenseRef (as a String) from individual ‘variable section’ Strings. Returns nil if license-ref is blank, or the resulting value is not a valid LicenseRef.

license-ref-map->string

(license-ref-map->string m)

Turns map m representing a LicenseRef into a String, returning nil if m is nil or the resulting value is not a valid LicenseRef.

Notes:

license-ref?

(license-ref? s)

Is s (a String) a valid LicenseRef? See SPDX Annex B for specifics.

listed-id?

(listed-id? id)

Is id (a String) one of the listed SPDX license identifiers?

Notes:

  • This fn supports any case of id, as per SPDX’s case insensitivity rules

non-deprecated-ids

(non-deprecated-ids)(non-deprecated-ids ids)

Returns the set of license ids that identify current (non-deprecated) licenses within the provided set of SPDX license ids (or all of them, if ids is not provided).

osi-approved-id?

(osi-approved-id? id)

Is id (a String) OSI Approved? Also returns false if id is not in the SPDX license list.

See this reference for details about what ‘OSI Approved’ means.

osi-approved-ids

(osi-approved-ids)(osi-approved-ids ids)

Returns the set of SPDX license ids that identify OSI Approved licenses within the provided set of SPDX license ids (or all of them, if ids is not provided).

See this reference for details about what ‘OSI Approved’ means.

string->license-ref-map

(string->license-ref-map s)

Turns s (a String containing a LicenseRef) into a map representing that same LicenseRef. Returns nil if s is nil or not a valid LicenseRef.

Notes:

version

(version)

The version of the license list (a String in major.minor format).

Note: identical to spdx.exceptions/version.