aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavid <public@beloved.name>2018-08-28 23:20:04 +0200
committerdavid <public@beloved.name>2018-08-28 23:20:04 +0200
commit09c05e86a1096b08eb7483b970207d47d0388665 (patch)
treefc2e822f5c404e1fdc6d0dcb70c3fdb3f48d512d
parentf942311de2f6640684a611eed97265462c07f97e (diff)
Added a maintenance script to modify license text to make it SPDX comatible
-rw-r--r--.gitignore1
-rwxr-xr-xsubprojects/maintenance/get-licenses48
-rwxr-xr-xsubprojects/maintenance/modify-wiki51
-rwxr-xr-xsubprojects/spdx/spdx5
4 files changed, 104 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index 5f77657..bc02c68 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,5 +6,6 @@ pkg.h5
metadata.ftp-master.debian.org/
output/
subprojects/freeamo/build/
+subprojects/maintenance/build/
subprojects/spdx/build/
diff --git a/subprojects/maintenance/get-licenses b/subprojects/maintenance/get-licenses
new file mode 100755
index 0000000..407d64d
--- /dev/null
+++ b/subprojects/maintenance/get-licenses
@@ -0,0 +1,48 @@
+#!/usr/bin/env bash
+# This file is part of Free Software Directory (Savannah)
+# Copyright (C) 2018 David Hedlund
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+
+# http://www.apache.org/licenses/LICENSE-2.0
+
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+scriptsrc=$(readlink -f -- "${BASH_SOURCE[0]}")
+run_path=$(dirname "${scriptsrc}" || echo .)
+filename=$(basename "$0");
+
+rm -fr "$run_path/build"
+mkdir -p "$run_path/build"
+
+######################################################################
+# List licenses from Debian packages
+
+for i in $(find ../../output/*.json); do
+
+ echo "$i"
+ jq -r '.[] | select(.[0] == "Project license") | .[1].License' "$i" >> "$run_path/build/current-licenses.txt"
+
+ (printf $(basename "$i")"\t" && jq -r '.[2][1].License' "$i") >> "$run_path/build/current-licenses-and-packages.txt"
+
+done
+
+sort -u "$run_path/build/current-licenses.txt" > "$run_path/build/current-licenses-unique.txt"
+
+######################################################################
+# Evaluate new licenses
+
+while IFS= read -r license; do
+
+ if ! grep -q "$license" modify-wiki ; then echo "$license" >> modify-wiki-EVALUATE.txt; fi
+
+done < "$run_path/build/current-licenses-unique.txt"
+
+if [ -f modify-wiki-EVALUATE.txt ]; then echo "========================================================
+Generated modify-wiki-EVALUATE.txt, merge it to modify-wiki and delete it."; fi
diff --git a/subprojects/maintenance/modify-wiki b/subprojects/maintenance/modify-wiki
new file mode 100755
index 0000000..c551805
--- /dev/null
+++ b/subprojects/maintenance/modify-wiki
@@ -0,0 +1,51 @@
+#!/usr/bin/env bash
+
+exit
+
+# This script will be build to
+# 1: Copy the output directory to say output-production
+# 2: Modify the "|License=" text in the .wiki files in the ouput-production directory
+
+sed -i "
+s|AGPLv3|AGPL-3.0|g
+s|AGPLv3orlater|AGPL-3.0-or-later|g
+s|BSD_2Clause|BSD-2-Clause|g
+s|BSD_3Clause|BSD-3-Clause|g
+s|Creative Commons Attribution 3.0|CC-BY-3.0|g
+s|Creative Commons Attribution Share-Alike 2.5|CC-BY-2.5|g
+s|EPLv1.0|EPL-1.0|g
+s|Expat|MIT|g
+s|GPLv2|GPL-2.0|g
+s|GPLv2orlater|GPL-2.0-or-later|g
+s|GPLv2orlater with exception|GPL-2.0-or-later-with-exception|g
+s|GPLv3|GPL-3.0|g
+s|GPLv3orlater|GPL-3.0-or-later|g
+s|GPLv3orlater with exception|GPL-3.0-or-later-with-exception|g
+s|LGPLv2|LGPL-2.0|g
+s|LGPLv2orlater|LGPL-2.0-or-later|g
+s|LGPLv3|LGPL-3.0|g
+s|LGPLv3orlater|LGPL-3.0-or-later|g
+s|MPL1.1|MPL-1.1|g
+s|PublicDomain|Public-domain|g
+s|WTFPLv2|WTFPL-2.0|g
+s|Zope|ZPL|g
+"
+
+# Debian license identifiers that conflicts with SPDX short identifiers:
+# "GPLv2orlater with exception": Not on the SPDX license list
+# "GPLv3orlater with exception": Not on the SPDX license list
+# "AGPLv3": The SPDX short identifier "AGPL-3.0" is deprecated, should we use "AGPL-3.0-only"?
+# "GPLv2": The SPDX short identifier "GPL-2.0" is deprecated, should we use "GPL-2.0-only"?
+# "GPLv3": The SPDX short identifier "GPL-3.0" is deprecated, should we use "GPL-3.0-only"?
+# "LGPLv2": The SPDX short identifier "LGPL-2.0" is deprecated, should we use "LGPL-2.0-only"?
+# "LGPLv3": The SPDX short identifier "LGPL-3.0" is deprecated, should we use "LGPL-3.0-only"?
+# "Zope": Which version?
+
+
+# Incorporated SPDX short identifiers:
+# "ISC"
+# "Ruby"
+# "Zlib"
+
+# Irrelevant:
+# "Other"
diff --git a/subprojects/spdx/spdx b/subprojects/spdx/spdx
index 7204d82..eb4c76f 100755
--- a/subprojects/spdx/spdx
+++ b/subprojects/spdx/spdx
@@ -44,11 +44,14 @@ function build_wiki {
}}
[[Category:$freedom license]]
+[[Category:SPDX short identifier]]
" > "$run_path/build/wiki/$(jq -r .licenses[$entry].licenseId licenses.json).wiki"
echo "#REDIRECT [[License:$(jq -r .licenses[$entry].licenseId licenses.json)]]
-[[Category:$freedom license full name]]" > "$run_path/build/wiki/$redirect_full_name"
+[[Category:$freedom license full name]]
+[[Category:SPDX full name]]
+" > "$run_path/build/wiki/$redirect_full_name"
}