Skip to content

Commit

Permalink
Move to SPDX licenses (#449)
Browse files Browse the repository at this point in the history
* Move to SPDX licenses

Found a way to do this without breaking API compat, so here it is, instead of waiting for v3

Resolves MOD-129
Resolves #396

* License URL updates

* what was I thinking

* Do a thing

* Add open source filter

* Remove dead imports

* Borrow

* Update 20220910132835_spdx-licenses.sql

* Add license text route

* Update migration

* Address comments
  • Loading branch information
triphora authored Nov 30, 2022
1 parent 3468885 commit 820519b
Show file tree
Hide file tree
Showing 15 changed files with 730 additions and 989 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ itertools = "0.10.5"
validator = { version = "0.16.0", features = ["derive", "phone"] }
regex = "1.6.0"
censor = "0.2.0"
spdx = { version = "0.9.0", features = ["text"] }

dotenvy = "0.15.6"
log = "0.4.17"
Expand Down
27 changes: 27 additions & 0 deletions migrations/20221126222222_spdx-licenses.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ALTER TABLE mods ADD COLUMN license_new varchar(2048) DEFAULT 'LicenseRef-All-Rights-Reserved' NOT NULL;

UPDATE mods SET license_new = licenses.short FROM licenses WHERE mods.license = licenses.id;

UPDATE mods SET license_new = 'LicenseRef-Custom' WHERE license_new = 'custom';
UPDATE mods SET license_new = 'LicenseRef-All-Rights-Reserved' WHERE license_new = 'arr';
UPDATE mods SET license_new = 'Apache-2.0' WHERE license_new = 'apache';
UPDATE mods SET license_new = 'BSD-2-Clause' WHERE license_new = 'bsd-2-clause';
UPDATE mods SET license_new = 'BSD-3-Clause' WHERE license_new = 'bsd-3-clause' OR license_new = 'bsd';
UPDATE mods SET license_new = 'CC0-1.0' WHERE license_new = 'cc0';
UPDATE mods SET license_new = 'Unlicense' WHERE license_new = 'unlicense';
UPDATE mods SET license_new = 'MIT' WHERE license_new = 'mit';
UPDATE mods SET license_new = 'LGPL-3.0-only' WHERE license_new = 'lgpl-3';
UPDATE mods SET license_new = 'LGPL-2.1-only' WHERE license_new = 'lgpl-2.1' OR license_new = 'lgpl';
UPDATE mods SET license_new = 'MPL-2.0' WHERE license_new = 'mpl-2';
UPDATE mods SET license_new = 'ISC' WHERE license_new = 'isc';
UPDATE mods SET license_new = 'Zlib' WHERE license_new = 'zlib';
UPDATE mods SET license_new = 'GPL-2.0-only' WHERE license_new = 'gpl-2';
UPDATE mods SET license_new = 'GPL-3.0-only' WHERE license_new = 'gpl-3';
UPDATE mods SET license_new = 'AGPL-3.0-only' WHERE license_new = 'agpl';

UPDATE mods SET license_url = NULL WHERE license_url LIKE 'https://cdn.modrinth.com/licenses/%';

ALTER TABLE mods DROP COLUMN license;
ALTER TABLE mods RENAME COLUMN license_new TO license;

DROP TABLE licenses;
Loading

0 comments on commit 820519b

Please sign in to comment.