diff options
Diffstat (limited to 'subprojects')
-rw-r--r-- | subprojects/spdx/ISSUES | 45 | ||||
-rwxr-xr-x | subprojects/spdx/err | 108 | ||||
-rwxr-xr-x | subprojects/spdx/spdx | 100 |
3 files changed, 253 insertions, 0 deletions
diff --git a/subprojects/spdx/ISSUES b/subprojects/spdx/ISSUES new file mode 100644 index 0000000..a9cd6ca --- /dev/null +++ b/subprojects/spdx/ISSUES @@ -0,0 +1,45 @@ +./spdx:37:in `wget -q --show-progress "$(jq -r .licenses[$entry].detailsUrl licenses.json)" -P licenses/' returned 4 + ↳./spdx:65:in `show' +./spdx: exiting with code 4 + + +Replace "wget -q --show-progress" with "--debug" in + wget --debug "$(jq -r .licenses[$entry].detailsUrl licenses.json)" -P licenses/ + +At the end of the script + +Saving HSTS entries to /home/me/.wget-hsts +Setting --directory-prefix (dirprefix) to licenses/ +DEBUG output created by Wget 1.17.1 on linux-gnu. + +Reading HSTS entries from /home/me/.wget-hsts +URI encoding = ‘UTF-8’ +--2018-08-17 11:56:31-- http://null/ +Resolving null (null)... failed: Name or service not known. +wget: unable to resolve host address ‘null’ +Saving HSTS entries to /home/me/.wget-hsts +jq: error: Could not open file licenses/null.json: No such file or directory +jq: error: Could not open file licenses/null.json: No such file or directory +jq: error (at licenses.json:4729): Cannot iterate over null (null) + + + +############################# + +https://github.com/spdx/spdx-spec/issues/93 + +Add false "isFsfLibre" value + + +https://github.com/spdx/spdx-spec/issues/46#issuecomment-413778513 + +In reviewing https://www.gnu.org/licenses/license-list.html, the FSF specifies "Free and Compatible with GPL", "Free and Incompatible with GPL" and "non-free". Do we need to capture all of these states? If so, do we want a second boolean ("FsfGplCompatible")? We could always implement a second boolean in the future. + +The Code for the left border at https://www.gnu.org/licenses/license-list.html defines five properties: + + Free licenses, compatible with the GNU GPL + Free licenses, compatible with the FDL + Free licenses, incompatible with the GNU GPL and FDL + Nonfree licenses + Licenses for works stating a viewpoint + diff --git a/subprojects/spdx/err b/subprojects/spdx/err new file mode 100755 index 0000000..4a68f0a --- /dev/null +++ b/subprojects/spdx/err @@ -0,0 +1,108 @@ +#!/bin/bash +# Copyright 2018 Ian Kelling + +# 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. + + +# Commentary: Bash stack trace and error handling functions. This file +# is meant to be sourced. It loads some functions which you may want to +# call manually (see the comments at the start of each one), and then +# runs err-catch. See the README file for a slightly longer explanation. + +err-allow() { + # help: turn off exit and stack trace on error. undoes err-catch + set +E +o pipefail; trap ERR +} + +err-bash-trace() { + # help: print stack trace + # + # Note: It does not show function args unless you first run: + # shopt -s extdebug + # err-catch runs this for you. + + local -i argc_index=0 frame i start=${1:-1} max_indent=8 indent + local source + local extdebug=false + if [[ $(shopt -p extdebug) == *-s* ]]; then + extdebug=true + fi + for ((frame=0; frame < ${#FUNCNAME[@]}-1; frame++)); do + argc=${BASH_ARGC[frame]} + argc_index+=$argc + ((frame < start)) && continue + if (( ${#BASH_SOURCE[@]} > 1 )); then + source="${BASH_SOURCE[frame+1]}:${BASH_LINENO[frame]}:" + fi + indent=$((frame-start+1)) + indent=$((indent < max_indent ? indent : max_indent)) + printf "%${indent}s↳%sin \`%s" '' "$source" "${FUNCNAME[frame]}" + if $extdebug; then + for ((i=argc_index-1; i >= argc_index-argc; i--)); do + printf " %s" "${BASH_ARGV[i]}" + done + fi + echo \' + done +} + +err-catch() { + # help: on errors: print stack trace and exit + # + # You can set "${_errcatch_cleanup[@]}" to a command and it will run before exiting. + # This function depends on err-bash-trace. + + set -E; shopt -s extdebug + _err-trap() { + err=$? + exec >&2 + set +x + echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}:in \`$BASH_COMMAND' returned $err" + # err trap does not work within an error trap, the following line: + err-bash-trace 2; set -e + "${_errcatch_cleanup[@]:-:}" # note :-: is to be compatible with set -u + echo "$0: exiting with code $err" + exit $err + } + trap _err-trap ERR + set -o pipefail +} + +err-exit() { + # usage: err-exit [EXIT_CODE] [MESSAGE] + # help: exit and print stack trace. + # + # Use this instead of the exit command to be more informative. default + # EXIT_CODE is 1. If only one of EXIT_CODE and MESSAGE is given, + # we consider it to be an exit code if it is a number. + # This function depends on err-bash-trace. + + exec >&2 + code=1 + if [[ "$*" ]]; then + if [[ ${1/[^0-9]/} == "$1" ]]; then + code=$1 + if [[ $2 ]]; then + printf '%s\n' "$2" + fi + else + printf '%s\n' "$0: $1" + fi + fi + echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}" + err-bash-trace 2 + echo "$0: exiting with code $code" + exit $err +} + +err-catch diff --git a/subprojects/spdx/spdx b/subprojects/spdx/spdx new file mode 100755 index 0000000..901c6cd --- /dev/null +++ b/subprojects/spdx/spdx @@ -0,0 +1,100 @@ +#!/usr/bin/env bash +# 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/>. + +scriptsrc=$(readlink -f -- "${BASH_SOURCE[0]}") +run_path=$(dirname "${scriptsrc}" || echo .) +filename=$(basename "$0"); + +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 { + + ((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/ + + echo "{{license +|Name=$(jq -r .licenses[$entry].name licenses.json) +|Short name=$(jq -r .licenses[$entry].licenseId licenses.json) +|URL=$(jq -r .licenses[$entry].detailsUrl licenses.json) +|Comment=$(jq -r .licenseComments "$license_file") +|Full text=$(jq -r .licenseText "$license_file") +|See also=$(jq -r .licenses[$entry].seeAlso[] licenses.json) +}} + +[[Category:$freedom license]] +" > "$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" + +} + + +###################################################################### +# 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 + + + if [ "$(jq -r ".licenses[$i] | select(.isFsfLibre = null) | .isFsfLibre" licenses.json)" == "true" ]; then + + freedom=false + + elif [ "$(jq -r ".licenses[$i] | select(.isFsfLibre != null) | .isFsfLibre" licenses.json)" == "true" ]; then + + freedom=free + + fi + +done |