Skip to content

Commit

Permalink
fix: check licenses via SPDX identifiers
Browse files Browse the repository at this point in the history
Fixes #16
  • Loading branch information
fosskers committed Oct 2, 2023
1 parent 9cca4c1 commit 00c323a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
- The PKGBUILD and tarball are now output to `target/cargo-aur` to avoid
cluttering the top-level of the repo.

#### Fixed

- LICENSE file checking is now done via SPDX identifiers.

## 1.5.0 (2022-04-20)

#### Added
Expand Down
22 changes: 18 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,25 @@ use std::ops::Not;
use std::path::{Path, PathBuf};
use std::process::{Command, ExitCode};

/// Licenses avaiable from the Arch Linux `licenses` package.
/// Licenses available from the Arch Linux `licenses` package.
///
/// That package contains other licenses, but I've excluded here those unlikely
/// to be used by Rust crates.
const LICENSES: &[&str] = &[
"AGPL3", "APACHE", "GPL2", "GPL3", "LGPL2.1", "LGPL3", "MPL", "MPL2",
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"Apache-2.0",
"BSL-1.0", // Boost Software License.
"GPL-2.0-only",
"GPL-2.0-or-later",
"GPL-3.0-only",
"GPL-3.0-or-later",
"LGPL-2.0-only",
"LGPL-2.0-or-later",
"LGPL-3.0-only",
"LGPL-3.0-or-later",
"MPL-2.0", // Mozilla Public License.
"Unlicense", // Not to be confused with "Unlicensed".
];

#[derive(Options)]
Expand Down Expand Up @@ -245,8 +258,9 @@ fn cargo_config() -> Result<Config, Error> {
}

/// If a AUR package's license isn't included in `/usr/share/licenses/common/`,
/// then it must be installed manually by the PKGBUILD. MIT is such a missing
/// license, and since many Rust crates use MIT we must make this check.
/// then it must be installed manually by the PKGBUILD. MIT and BSD3 are such
/// missing licenses, and since many Rust crates use them we must make this
/// check.
fn must_copy_license(license: &str) -> bool {
LICENSES.contains(&license).not()
}
Expand Down

0 comments on commit 00c323a

Please sign in to comment.