aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavid <public@beloved.name>2018-07-04 01:31:32 +0200
committerdavid <public@beloved.name>2018-07-04 01:31:32 +0200
commit49145968147ca2e5938a21631ed449a6e383deee (patch)
tree2dd8d1fab5d2a21060c19d3dba5a54711edd9e61
parent76f64eb762434f5bafc38c5fdaba0d681ed6a444 (diff)
Added err and sourced it in doall.sh and license-reporter
-rwxr-xr-xaddons.mozilla.org-fsd/get-data/err69
-rwxr-xr-xaddons.mozilla.org-fsd/get-data/license-reporter17
-rwxr-xr-xdoall.sh5
-rwxr-xr-xerr69
4 files changed, 152 insertions, 8 deletions
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 <http://www.gnu.org/licenses/>.
+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" != "" ]];
diff --git a/doall.sh b/doall.sh
index a71d9d7..0f43b03 100755
--- a/doall.sh
+++ b/doall.sh
@@ -1,7 +1,6 @@
#!/bin/bash
-set -eE -o pipefail
-trap 'echo "$0:$LINENO:error: \"$BASH_COMMAND\" returned $?" >&2' ERR
+source err
set -x
x="$(readlink -f -- "$BASH_SOURCE")"; cd ${x%/*} # directory of this file
@@ -43,7 +42,7 @@ done
# this may return 8, because debian has removed a package from the time we made downloadlist, to the time we actually did the wget on a url in it
# so, we do a check to see if we downloaded at least the number of files - 10
while (( i=0; i<10; i++)); do
-
+
if wget -nc -nv -x --continue -i downloadlist; then
break
diff --git a/err b/err
new file mode 100755
index 0000000..57ea542
--- /dev/null
+++ b/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