1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// This file is part of helpers4.
// Copyright (C) 2025 baxyz
// SPDX-License-Identifier: LGPL-3.0-or-later
use DEPRECATED;
/// The current SPDX identifier for a deprecated one.
///
/// SPDX split the GNU licenses into `-only` and `-or-later` and retired the bare forms and the
/// `+` suffix, but `GPL-3.0` and `LGPL-2.1+` are still what many manifests contain. The match
/// ignores case. Identifiers that are not deprecated give `None`.
///
/// # Arguments
///
/// - `id` - The identifier to update.
///
/// # Returns
///
/// The replacement, such as `"GPL-3.0-only"` for `"GPL-3.0"`, or `None` when `id` is not one of
/// the ten deprecated GNU identifiers (`GPL`, `LGPL` and `AGPL`, with and without `+`).
///
/// # Examples
///
/// ```
/// use helpers4::license::normalize;
///
/// assert_eq!(normalize("GPL-3.0"), Some("GPL-3.0-only"));
/// assert_eq!(normalize("GPL-3.0+"), Some("GPL-3.0-or-later"));
/// assert_eq!(normalize("MIT"), None);
/// ```