From 49145968147ca2e5938a21631ed449a6e383deee Mon Sep 17 00:00:00 2001 From: david Date: Wed, 4 Jul 2018 01:31:32 +0200 Subject: Added err and sourced it in doall.sh and license-reporter --- addons.mozilla.org-fsd/get-data/err | 69 ++++++++++++++++++++++++ addons.mozilla.org-fsd/get-data/license-reporter | 17 ++++-- 2 files changed, 81 insertions(+), 5 deletions(-) create mode 100755 addons.mozilla.org-fsd/get-data/err (limited to 'addons.mozilla.org-fsd/get-data') diff --git a/addons.mozilla.org-fsd/get-data/err b/addons.mozilla.org-fsd/get-data/err new file mode 100755 index 0000000..57ea542 --- /dev/null +++ b/addons.mozilla.org-fsd/get-data/err @@ -0,0 +1,69 @@ +#!/bin/bash +# this file was generated from gen-err and meant to be sourced +bash-trace() { + 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 +} +errallow() { + if [[ $1 ]]; then + echo "errallow help: Undo the complimentary errcatch function." + else + set +E +o pipefail; trap ERR + fi +} +errcatch() { + set -E; shopt -s extdebug + _err-trap() { + err=$? + exec >&2 + set +x + echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}:in \`$BASH_COMMAND' returned $err" + bash-trace 2 + set -e + "${_errcatch_cleanup[@]}" + echo "$0: exiting with code $err" + exit $err + } + trap _err-trap ERR + set -o pipefail +} +errexit() { + exec >&2 + code=1 + if [[ $@ ]]; then + if [[ ${1/[^0-9]/} == "$1" ]]; then + code=$1 + if [[ $2 ]]; then + echo "$2" + fi + else + echo "$0: $1" + fi + fi + echo "${BASH_SOURCE[1]}:${BASH_LINENO[0]}" + bash-trace 2 + echo "$0: exiting with code $code" + exit $err +} +errcatch diff --git a/addons.mozilla.org-fsd/get-data/license-reporter b/addons.mozilla.org-fsd/get-data/license-reporter index 9bf4263..3e01334 100755 --- a/addons.mozilla.org-fsd/get-data/license-reporter +++ b/addons.mozilla.org-fsd/get-data/license-reporter @@ -1,5 +1,4 @@ #!/usr/bin/env bash - # This file is part of license-reporter # Copyright (C) 2017, 2018 David Hedlund # @@ -16,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +source err #if [ "$data" == "search" ]; then search_page_variable='.results[]'; fi @@ -36,6 +36,7 @@ if [ "$2" == "--debug" ]; then debug=true; else debug=false; fi minimum_average_daily_users="10000"; +scriptsrc=$(readlink -f -- "${BASH_SOURCE[0]}") SCRIPTSRC=$(readlink -f "$0" || echo "$0") RUN_PATH=$(dirname "${SCRIPTSRC}" || echo .) filename=$(basename "$0"); @@ -678,15 +679,19 @@ s|http|\nhttp|g; echo "{{Entry" > wiki/$id.wiki # Dash have to be removed in jq 1.3: https://github.com/stedolan/jq/issues/341 - echo "|Name=$name + # Avoid specific versions since it's not compatible with all IceCat versions: + # |Version download=https://addons.mozilla.org/firefox/downloads/latest/$id/addon-$version_id-latest.xpi + # |Version identifier=$version + # |Version date=$version_date + + + echo "|Name=$name |Short description=$short_description |Full description=$full_description |Homepage URL=$homepage_url |Extension of=$extension_of |VCS checkout command=$vcs_checkout_command -|Version identifier=$version -|Version date=$version_date -|Version download=https://addons.mozilla.org/firefox/downloads/latest/$id/addon-$version_id-latest.xpi +|Version download=https://addons.mozilla.org/en-US/firefox/addon/$slug/versions/ |Last review by=$last_review_by |Last review date=$last_review_date |Submitted by=$submitted_by @@ -700,6 +705,8 @@ s|http|\nhttp|g; echo "{{Project license |License=$license |License copyright=$license_copyright +|License note=\"License: $original_license\" listed +at https://addons.mozilla.org/en-US/firefox/addon/adblock-plus/ }}" >> wiki/$id.wiki if [[ "$support_url" != "" ]]; -- cgit v1.2.3