diff --git a/webbuild/webbuild-functions b/webbuild/webbuild-functions index f14c220..2cccf89 100644 --- a/webbuild/webbuild-functions +++ b/webbuild/webbuild-functions @@ -1,7 +1,7 @@ #!/bin/bash # # webbuild functions -# Copyright (c) 2012-2014 by Silvan Calarco +# Copyright (c) 2012-2024 by Silvan Calarco # . /etc/autodist/config @@ -273,10 +273,10 @@ function parse_build_output() { s|^\([\+#] .*\)|\1|; s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; - s|\(.*\)\(error[^0-9A-Za-z]*:[[:space:]]*.*\)|\1\2|i; + s|\(.*\)\(^.*error[^0-9A-Za-z]*:[[:space:]]*.*\)|\1\2|i; s|^\(== =.*\)|\1|; s|^[[:cntrl:]]*\([!%?=][!%!=>] .*\)|\1|; - s|[[:cntrl:]]||g;" | iconv -c | google_search $1 + s|[[:cntrl:]]||g;" | iconv -c | hint_search $1 } function parse_generic_output() { @@ -288,17 +288,18 @@ function parse_generic_output() { s|</font|\1|; s|\(ftp[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|; - s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|;" | google_search $1 + s|\(http[s]*://[[:alnum:]+\,:&?/_.=~%#-]*\)|\1|;" | hint_search $1 } -function google_search() { +function hint_search() { while read line; do if [ "${line/\%SRCURL\%}" == "${line}" ]; then echo "$line" else local SEARCH_STRING=`echo "$line" | sed "s|.*%SRCURL%\(.*\)%SRCURLEND%.*|\1|;s|\<|<|"` - local SEARCH_STRING_ENCODED=`cgi_encodevar "$1 $SEARCH_STRING"` - echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://www.google.com/search?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g" + local SEARCH_STRING_ENCODED=`cgi_encodevar "I get this error while building $1: $SEARCH_STRING"` + #echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://duckduckgo.gom/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Search this error on the Web\"|g" + echo "$line" | sed "s|%SRCURL%.*%SRCURLEND%|href=\"https://chatgpt.com/?q=$SEARCH_STRING_ENCODED\" target=_new title=\"Query ChatGPT on this error\"|g" fi done }