diff options
Diffstat (limited to 'subprojects/spdx/spdx')
-rwxr-xr-x | subprojects/spdx/spdx | 86 |
1 files changed, 32 insertions, 54 deletions
diff --git a/subprojects/spdx/spdx b/subprojects/spdx/spdx index 901c6cd..e8a8208 100755 --- a/subprojects/spdx/spdx +++ b/subprojects/spdx/spdx @@ -2,36 +2,34 @@ # This file is part of SPDX-FSD # Copyright (C) 2018 David Hedlund # -# SPDX-FSD is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# FreeAMO is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see <http://www.gnu.org/licenses/>. +# 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"); -source "$run_path/err" +#source "$run_path/err" rm -fr "$run_path/build" mkdir -p build/json/licenses build/wiki cd build/json/ || exit + wget -q --show-progress "https://raw.githubusercontent.com/spdx/license-list-data/master/json/licenses.json" -O licenses.json -function show { +function build_wiki { - ((entry++)) # Should start with 1 to match "referenceNumber" in the json file -# referenceNumber=$(jq -r .licenses[$entry].referenceNumber licenses.json) license_file="licenses/$(jq -r .licenses[$entry].licenseId licenses.json).json" redirect_full_name="$(jq -r .licenses[$entry].name licenses.json | sed "s|w/|with |g; s|/|+|g;").wiki" wget -q --show-progress "$(jq -r .licenses[$entry].detailsUrl licenses.json)" -P licenses/ @@ -51,50 +49,30 @@ function show { echo "#REDIRECT [[License:$(jq -r .licenses[$entry].licenseId licenses.json)]] [[Category:$freedom license full name]]" > "$run_path/build/wiki/$redirect_full_name" - -} - - -###################################################################### -# Free licenses +} -for entry in $(jq -r ".licenses[] | select(.isFsfLibre != null) | .referenceNumber" licenses.json); do - - freedom="Free" - show - -done - -exit - -###################################################################### -# Nonfree licenses - -for entry in $(jq -r ".licenses[] | select(.isFsfLibre = null) | .referenceNumber" licenses.json); do - - freedom="Nonfree" - show - -done - - -###################################################################### -# Old code that didn't work out - -exit -for i in $(jq -r .licenses[].referenceNumber licenses.json); do + ###################################################################### + # Start loop + # Add false "isFsfLibre" value - https://github.com/spdx/spdx-spec/issues/93 + # I'd like to figure out licenses that are classified as nonfree by the FSF so this issue is still relevant so I can use something like: + # if [ "$(jq -r ".licenses[$entry].isFsfLibre" licenses.json)" == "false" ]; then echo "Nonfree"; fi - if [ "$(jq -r ".licenses[$i] | select(.isFsfLibre = null) | .isFsfLibre" licenses.json)" == "true" ]; then + for entry in $(jq -r .licenses[].referenceNumber licenses.json); do - freedom=false - - elif [ "$(jq -r ".licenses[$i] | select(.isFsfLibre != null) | .isFsfLibre" licenses.json)" == "true" ]; then + if [ "$(jq -r ".licenses[$entry].isFsfLibre" licenses.json)" == "true" ]; then - freedom=free + freedom="Free" + build_wiki - fi + # Code that will be useful once the "false" values has been added, see above notice: + # elif [ "$(jq -r ".licenses[$entry] | select(.isFsfLibre = null) | .isFsfLibre" licenses.json)" == "null" ]; then + + # printf "Unknown: " + # jq -r .licenses[$entry].name licenses.json -done + fi + + done |