From 8079f8bd5569eb7f5853f5a7cf1499403b2a463a Mon Sep 17 00:00:00 2001 From: ng0 Date: Wed, 27 Nov 2019 21:18:50 +0000 Subject: gnunet-bugreport: rewrite large parts to make better use of awk, replace grep with awk, require a shell which supports 'type' builtin, combine a few tests, and more. --- contrib/scripts/gnunet-bugreport | 287 +++++++++++++++++---------------------- 1 file changed, 127 insertions(+), 160 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport index 724c38e06..aaba45252 100755 --- a/contrib/scripts/gnunet-bugreport +++ b/contrib/scripts/gnunet-bugreport @@ -1,4 +1,10 @@ -#!/bin/sh +#!/usr/bin/env sh + +# Caveats: +# - checks with textprocessing assuming that system language is English. +# - maybe check last return status instead? +# - Do we need to set awk to which awk becomes available or is awk +# always available as just awk? progname=${0##*/} @@ -27,13 +33,15 @@ linemsg() statusmsg "=========================================" } -# It is okay to assume which(1) here because we provide -# more than 1 fallback. -TEST=`type type|grep not` -if test -n "$TEST"; then - WHICH=which -else - WHICH=type +errmsg='' + +# Check if shell support builtin 'type'. +if test -z "$errmsg"; then + if ! (eval 'type type') >/dev/null 2>&1 + then + errmsg='Shell does not support type builtin' + exit 1 + fi fi os_check() @@ -50,17 +58,17 @@ os_check() # awk isn't there it can't be found. awk_check() { - if test -n "`awk 2>&1 | tail -1 | awk '{print $1}'`"; then + if test -z "`type awk 2>&1 | awk '/not found/'`"; then infomsg "awk : Found" else warningmsg "awk : Not found!" + exit 1 fi } gcc_check() { - TEST=`$WHICH gcc | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + if test -z "`type gcc | awk '/not found/' 2>/dev/null`"; then VERS=`gcc --version 2>/dev/null | head -n 1` infomsg "gcc : $VERS" elif test -n "`gcc 2>&1 | tail -1 | awk '{print $1}'`"; then @@ -73,8 +81,7 @@ gcc_check() cc_check() { - TEST=`$WHICH cc | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + if test -z "`type cc | awk '/not found/' 2>/dev/null`"; then VERS=`cc --version 2>/dev/null | head -n 1` infomsg "cc : $VERS" else @@ -84,8 +91,7 @@ cc_check() cplusplus_check() { - TEST=`$WHICH c++ | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + if test -z "`type c++ | awk '/not found/' 2>/dev/null`"; then VERS=`c++ --version 2>/dev/null | head -n 1` infomsg "c++ : $VERS" else @@ -95,8 +101,8 @@ cplusplus_check() clang_check() { - TEST=`$WHICH clang | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + TEST=`type clang | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then VERS=`clang --version 2>/dev/null | head -n 1` infomsg "clang : $VERS" elif test -n "`clang 2>&1 | tail -1 | awk '{print $1}'`"; then @@ -109,7 +115,7 @@ clang_check() clangplusplus_check() { - TEST=`$WHICH clang++ | grep -v "not found" 2>/dev/null` + TEST=`type clang++ | awk '/not found/' 2>/dev/null` if test -n "$TEST"; then VERS=`clang++ --version 2>/dev/null | head -n 1` infomsg "clang++ : $VERS" @@ -123,35 +129,41 @@ clangplusplus_check() gmake_check() { - TEST=`$WHICH gmake | grep -v "not found" 2>/dev/null` - if test -n "$TEST" ; then + TEST=`type gmake | awk '/not found/' 2>/dev/null` + if test -z "$TEST" ; then VER=$(gmake --version 2>/dev/null | awk '/GNU Make/ {print $3}') infomsg "gmake : $VER" else TEST=`make --version 2>/dev/null` if test -n "$TEST"; then - VER=$(make --version 2>/dev/null | awk '/GNU Make/ {print $3}') + VER=$(make --version 2>/dev/null | awk '/GNU Make/ {print $3}') infomsg "gmake : $VER" else - warningmsg "gmake : Not Found" + warningmsg "gmake : Not Found" fi fi } -# Applies for NetBSD make and possibly every make. +# Applies at least for NetBSD make. This test is a little awkward, +# we should probably grep the output of 'make -dA'. nbmake identifies, +# NetBSD make from NetBSD (nbmake is portable, external) does not identify. make_check() { - if test -n "`make 2>/dev/null`"; then - infomsg "make : Found" - else - warningmsg "make : Not Found" + TEST=`type make | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then + VER=$(make --version 2>/dev/null | awk '// {print $0}') + if test -z "$VER"; then + infomsg "make : Found" + else + warningmsg "make : Not Found (unexpected result)" + fi fi } autoconf_check() { - TEST=`$WHICH autoconf | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + TEST=`type autoconf | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then autoconf --version |\ head -n 1 |\ awk '{\ @@ -167,8 +179,8 @@ autoconf_check() automake_check() { - TEST=`$WHICH automake | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + TEST=`type automake | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then VER=`automake --version 2>/dev/null | head -n 1 | awk '{print $4}'` infomsg "automake : $VER" else @@ -179,8 +191,8 @@ automake_check() # TODO: More libtool variants. libtool_check() { - TEST=`$WHICH libtoolize | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + TEST=`type libtoolize | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then VER=`libtoolize --version 2>/dev/null | head -n 1 | awk '{print $4}'` infomsg "libtool : $VER" else @@ -190,8 +202,8 @@ libtool_check() libextractor_check() { - TEST=`$WHICH extract | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then + TEST=`type extract | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then VER=`extract -v 2>/dev/null | head -n 1 | awk '{print $2}'` infomsg "libextractor : $VER" else @@ -199,63 +211,36 @@ libextractor_check() fi } -gnunet08_check() +gnunet_version_check() { - if test -x gnunetd; then - VER=`gnunetd -v | sed -e "s/v//" 2>/dev/null` - warningmsg "GNUnet 0.8 : $VER (may conflict!)" - else + # historical, should not be matched + T08=`type gnunetd | awk '/not found/' 2>/dev/null` + if test -z "$T08"; then + VER08=`gnunetd -v | awk '{if(/0.8/) { gsub("v",""); print $2}}'` infomsg "GNUnet 0.8 : Not Found (good)" + # else + # warningmsg "GNUnet 0.8 : $VER08 (may conflict!)" fi -} - -gnunet09x_check() -{ - TEST=`$WHICH gnunet-arm | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then - VER=`gnunet-arm -v | sed -e "s/v//" 2>/dev/null | awk '{print $2}'` - VER9=`echo $VER | grep ^0\.9\.` - if test -n "$VER9"; then - warningmsg "GNUnet 0.9 : $VER" - else - infomsg "GNUnet 0.9 : Not Found (good)" - fi - else - infomsg "GNUnet 0.9 : Not Found (good)" - fi -} - -gnunet010x_check() -{ - TEST=`$WHICH gnunet-arm | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then - VER=`gnunet-arm -v | sed -e "s/v//" 2>/dev/null | awk '{print $2}'` - VER10=`echo $VER | grep ^0\.10\.` - if test -n "$VER10"; then - warningmsg "GNUnet 0.10 : $VER" - else - infomsg "GNUnet 0.10 : Not Found (good)" - fi - else - infomsg "GNUnet 0.10 : Not Found (good)" - fi -} - -gnunet011x_check() -{ - TEST=`$WHICH gnunet-arm | grep -v "not found" 2>/dev/null` - if test -n "$TEST"; then - VER=`gnunet-arm -v | sed -e "s/v//" 2>/dev/null | awk '{print $2}'` - infomsg "GNUnet 0.11 : $VER" + TEST=`type gnunet-arm | awk '/not found/' 2>/dev/null` + if test -z "$TEST"; then + gnunet-arm --version |\ + awk '{\ + if (/not found/) {\ + print " INFO: GNUnet : Not found"\ + } else if (/[0-9]/) {\ + gsub("v",""); print " INFO: GNUnet : "$2\ + } else {\ + print " INFO: GNUnet : Test failed"\ + }}' else - warningmsg "GNUnet 0.11.x : Not Found" + warningmsg "GNUnet : Not Found" fi } gitcommit_check() { - TEST=$(git | grep -v "not found" 2> /dev/null) - if test -n "$TEST"; then + TEST=$(git | awk '/not found/' 2> /dev/null) + if test -z "$TEST"; then VER=$(git rev-parse HEAD) infomsg "git commit : $VER" else @@ -265,8 +250,8 @@ gitcommit_check() gcrypt_check() { - TEST=`$WHICH libgcrypt-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type libgcrypt-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then VER=`libgcrypt-config --version 2> /dev/null` infomsg "libgcrypt : $VER" else @@ -276,8 +261,8 @@ gcrypt_check() mysql_check() { - TEST=`$WHICH mysql_config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type mysql_config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then VER=`mysql_config --version 2> /dev/null` infomsg "mysql : $VER" else @@ -287,18 +272,14 @@ mysql_check() pkgconf_check() { - TEST=`$WHICH pkgconf | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type pkgconf | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then pkgconf --version 2> /dev/null | awk '{print " INFO: pkgconf : "$1}' else infomsg "pkgconf : Not Found" fi -} - -pkgconfig_check() -{ - TEST=`$WHICH pkg-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type pkg-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then VER=`pkg-config --version 2> /dev/null | awk '{print $1}'` infomsg "pkg-config : $VER" else @@ -308,8 +289,8 @@ pkgconfig_check() glib2_check() { - TEST=`$WHICH pkg-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type pkg-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then VER=`pkg-config --modversion glib-2.0 2> /dev/null | awk '{print $1}'` infomsg "glib2 : $VER" else @@ -317,55 +298,47 @@ glib2_check() fi } -gtk2_check() +gtk_check() { - TEST=`$WHICH pkg-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type pkg-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then VER=`pkg-config --modversion gtk+-2.0 2> /dev/null | awk '{print $1}'` if test -n "$VER"; then - infomsg "gtk2+ : $VER" + infomsg "GTK2 : $VER" else - infomsg "gtk2+ : Not found" + infomsg "GTK2 : Not found" fi else - infomsg "gtk2+ : Not Found" + infomsg "GTK2 : Not Found" fi -} -gtk3_check() -{ - TEST=`$WHICH pkg-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + if test -z "$TEST"; then VER=`pkg-config --modversion gtk+-3.0 2> /dev/null | awk '{print $1}'` if test -n "$VER"; then - infomsg "gtk3+ : $VER" + infomsg "GTK3 : $VER" else - infomsg "gtk3+ : Not found" + infomsg "GTK3 : Not found" fi else - infomsg "gtk3+ : Not Found" + infomsg "GTK3 : Not Found" fi -} -gtk4_check() -{ - TEST=`$WHICH pkg-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + if test -z "$TEST"; then VER=`pkg-config --modversion gtk+-4.0 2> /dev/null | awk '{print $1}'` - if test -n "$VER"; then - infomsg "gtk4+ : $VER" + if test -z "$VER"; then + infomsg "GTK4 : $VER" else - infomsg "gtk4+ : Not found" + infomsg "GTK4 : Not found" fi else - infomsg "gtk4+ : Not Found" + infomsg "GTK4 : Not Found" fi } gmp_check() { - TEST=`$WHICH dpkg | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type dpkg | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then LINES=`dpkg -s libgmp-dev | grep Version | wc -l 2> /dev/null` if test "$LINES" = "1" then @@ -375,15 +348,15 @@ gmp_check() errormsg "GMP : dpkg: libgmp-dev not installed" fi else - TEST=`$WHICH rpm | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type rpm | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then rpm -q gmp | sed -e "s/gmp-//" 2> /dev/null | \ infomsg "GMP : $1.rpm" else infomsg "GMP : Test not available" fi - TEST=$($WHICH pkg_info | grep -v "not found" 2> /dev/null) - if test -n "$TEST"; then + TEST=$(type pkg_info | awk '/not found/' 2> /dev/null) + if test -z "$TEST"; then VER=$(pkg_info -e gmp) infomsg "GMP : $VER" else @@ -394,26 +367,26 @@ gmp_check() libunistring_check() { - TEST=`$WHICH dpkg | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then - LINES=`dpkg -s libunistring-dev | grep Version | wc -l` + TEST=`type dpkg | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then + LINES=`dpkg -s libunistring-dev | awk '/Version/' | wc -l` if test "$LINES" = "1" then - VERSION=`dpkg -s libunistring-dev | grep Version | awk '{print $2}'` + VERSION=`dpkg -s libunistring-dev | awk '/Version/ {print $2}'` infomsg "libunistring : libunistring3-dev-$VERSION.deb" else errormsg "libunistring : dpkg: libunistring3-dev not installed" fi else - TEST=`$WHICH rpm | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type rpm | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then rpm -q unistring | sed -e "s/unistring-//" 2> /dev/null | \ awk '{print "libunistring : "$1.rpm}' else infomsg "libunistring : Test not available" fi - TEST=$($WHICH pkg_info | grep -v "not found" 2> /dev/null) - if test -n "$TEST"; then + TEST=$(type pkg_info | awk '/not found/' 2> /dev/null) + if test -z "$TEST"; then VER=$(pkg_info -e libunistring) infomsg "libunistring : $VER" else @@ -424,8 +397,8 @@ libunistring_check() gnugettext_check() { - TEST=`$WHICH gettext | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then + TEST=`type gettext | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then if test -n "$(gettext --version 2>&1 | awk '/unknown option/')"; then infomsg "GNU gettext : Not found" else @@ -437,7 +410,7 @@ gnugettext_check() gettext_check() { - if test -n "`$WHICH getext 2>/dev/null`"; then + if test -n "`type getext 2>/dev/null`"; then infomsg "gettext : Found" else infomsg "gettext : Not Found" @@ -448,9 +421,9 @@ gettext_check() # found (yes those systems exist) curl_check() { - TEST=`$WHICH curl-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then - VER=`curl-config --version | head -n1 2> /dev/null | awk '{print $2}'` + TEST=`type curl-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then + VER=`curl-config --version 2> /dev/null | awk '{print $NF}'` infomsg "libcurl : $VER" else infomsg "libcurl : Not found" @@ -459,9 +432,9 @@ curl_check() gnurl_check() { - TEST=`$WHICH gnurl-config | grep -v "not found" 2> /dev/null` - if test -n "$TEST"; then - VER=`gnurl-config --version | head -n1 2> /dev/null | awk '{print $2}'` + TEST=`type gnurl-config | awk '/not found/' 2> /dev/null` + if test -z "$TEST"; then + VER=`gnurl-config --version 2> /dev/null | awk '{print $NF}'` infomsg "libgnurl : $VER" else infomsg "libgnurl : Not found" @@ -481,10 +454,10 @@ int main() return 0; } EOF - if test -x `$WHICH gcc | awk '{print $NF}'`; then + if test -x `type gcc | awk '{print $NF}'`; then gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin "$TMPFILE" VER=`./"$TMPFILE".bin` - elif test -x `$WHICH cc | awk '{print $NF}'`; then + elif test -x `type cc | awk '{print $NF}'`; then cc $CPPFLAGS $CFLAGS -o $TMPFILE.bin $TMPFILE VER=`./$TMPFILE.bin` else @@ -507,10 +480,10 @@ int main() return 0; } EOF - if test -x `$WHICH gcc | awk '{print $NF}'`; then + if test -x `type gcc | awk '{print $NF}'`; then gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE VER=`./$TMPFILE.bin` - elif test -x `$WHICH cc | awk '{print $NF}'`; then + elif test -x `type cc | awk '{print $NF}'`; then cc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE VER=`./"$TMPFILE".bin` else @@ -533,10 +506,10 @@ int main() return 0; } EOF - if test -x `$WHICH gcc | awk '{print $NF}'`; then + if test -x `type gcc | awk '{print $NF}'`; then gcc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE VER=`./"$TMPFILE".bin` - elif test -x `$WHICH cc | awk '{print $NF}'`; then + elif test -x `type cc | awk '{print $NF}'`; then cc $CPPFLAGS $CFLAGS -o "$TMPFILE".bin $TMPFILE VER=`./"$TMPFILE".bin` else @@ -554,8 +527,8 @@ main() echo "CPPFLAGS='-I/usr/pkg/include' LDFLAGS='-L/usr/pkg/lib' ${progname}" return 0 fi - echo $LDFLAGS - echo $CPPFLAGS + #echo $LDFLAGS + #echo $CPPFLAGS infomsg "${progname} 0.11.0" infomsg infomsg "Please submit the following" @@ -568,25 +541,19 @@ main() cplusplus_check clang_check clangplusplus_check - gmake_check make_check + gmake_check autoconf_check automake_check libtool_check libextractor_check - gnunet08_check - gnunet09x_check - gnunet010x_check - gnunet011x_check + gnunet_version_check gitcommit_check gcrypt_check mysql_check pkgconf_check - pkgconfig_check glib2_check - gtk2_check - gtk3_check - gtk4_check + gtk_check gmp_check libunistring_check gnugettext_check -- cgit v1.2.3 From f6d13407fa22dcb8585bf261de8ebd4d0720e482 Mon Sep 17 00:00:00 2001 From: ng0 Date: Wed, 27 Nov 2019 21:40:37 +0000 Subject: contrib/scripts: use awk to modify interpreter substitution lines. --- contrib/scripts/Makefile.am | 2 +- contrib/scripts/gnunet-chk.py.in | 2 +- contrib/scripts/gnunet-logread/Makefile.am | 2 +- contrib/scripts/gnunet-logread/gnunet-logread-ipc-sdedit.in | 2 +- contrib/scripts/gnunet-logread/gnunet-logread.in | 2 +- contrib/scripts/gnunet_janitor.py.in | 2 +- contrib/scripts/gnunet_pyexpect.py.in | 2 +- contrib/scripts/pydiffer.py.in | 2 +- contrib/scripts/removetrailingwhitespace.py.in | 2 +- contrib/scripts/terminate.py.in | 2 +- 10 files changed, 10 insertions(+), 10 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/Makefile.am b/contrib/scripts/Makefile.am index 91b2bcd5a..367e5c4c9 100644 --- a/contrib/scripts/Makefile.am +++ b/contrib/scripts/Makefile.am @@ -29,7 +29,7 @@ EXTRA_DIST = \ CLEANFILES = \ $(noinst_SCRIPTS) -do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' +do_subst = $(AWK) -v py="$(PYTHON)" '{gsub("@PYTHONEXE@",py); print $$0}' # Use SUFFIX Extension rules, they are more portable for every # implementation of 'make'. diff --git a/contrib/scripts/gnunet-chk.py.in b/contrib/scripts/gnunet-chk.py.in index 7d2cf73d3..afc0924f4 100755 --- a/contrib/scripts/gnunet-chk.py.in +++ b/contrib/scripts/gnunet-chk.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ # This file is part of GNUnet. # (C) 2013, 2018 Christian Grothoff (and other contributing authors) # diff --git a/contrib/scripts/gnunet-logread/Makefile.am b/contrib/scripts/gnunet-logread/Makefile.am index 7903c07de..790b58fea 100644 --- a/contrib/scripts/gnunet-logread/Makefile.am +++ b/contrib/scripts/gnunet-logread/Makefile.am @@ -1,7 +1,7 @@ # This Makefile.am is in the public domain AM_CPPFLAGS = -I$(top_srcdir)/src/include -I$(top_builddir)/src/include -do_subst = $(SED) -e 's,[@]PERL[@],$(PERL),g' +do_subst = $(AWK) -v py="$(PERL)" '{gsub("@PERLEXE@",py); print $$0}' SUFFIXES = .in diff --git a/contrib/scripts/gnunet-logread/gnunet-logread-ipc-sdedit.in b/contrib/scripts/gnunet-logread/gnunet-logread-ipc-sdedit.in index f8b7dc735..72a1551ae 100755 --- a/contrib/scripts/gnunet-logread/gnunet-logread-ipc-sdedit.in +++ b/contrib/scripts/gnunet-logread/gnunet-logread-ipc-sdedit.in @@ -1,4 +1,4 @@ -#!@PERL@ +#!@PERLEXE@ # 1. Start sdedit and enable 'RT diagram server' in 'Global preferences'. # diff --git a/contrib/scripts/gnunet-logread/gnunet-logread.in b/contrib/scripts/gnunet-logread/gnunet-logread.in index 9b1c65401..e27c1d3fc 100755 --- a/contrib/scripts/gnunet-logread/gnunet-logread.in +++ b/contrib/scripts/gnunet-logread/gnunet-logread.in @@ -1,4 +1,4 @@ -#!@PERL@ +#!@PERLEXE@ # helper tool to make gnunet logs more readable # try 'gnunet-logread -h' for usage diff --git a/contrib/scripts/gnunet_janitor.py.in b/contrib/scripts/gnunet_janitor.py.in index d6834bfb4..9d28d38e6 100644 --- a/contrib/scripts/gnunet_janitor.py.in +++ b/contrib/scripts/gnunet_janitor.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ # This file is part of GNUnet. # (C) 2011, 2018 Christian Grothoff (and other contributing authors) # diff --git a/contrib/scripts/gnunet_pyexpect.py.in b/contrib/scripts/gnunet_pyexpect.py.in index 48f8acdc1..1124dc33c 100644 --- a/contrib/scripts/gnunet_pyexpect.py.in +++ b/contrib/scripts/gnunet_pyexpect.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ # This file is part of GNUnet. # (C) 2010, 2018 Christian Grothoff (and other contributing authors) # diff --git a/contrib/scripts/pydiffer.py.in b/contrib/scripts/pydiffer.py.in index 08f0f4ae6..5235df3f7 100644 --- a/contrib/scripts/pydiffer.py.in +++ b/contrib/scripts/pydiffer.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ import os import sys diff --git a/contrib/scripts/removetrailingwhitespace.py.in b/contrib/scripts/removetrailingwhitespace.py.in index e6c2d9014..6a133ecd0 100755 --- a/contrib/scripts/removetrailingwhitespace.py.in +++ b/contrib/scripts/removetrailingwhitespace.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ import sys import re diff --git a/contrib/scripts/terminate.py.in b/contrib/scripts/terminate.py.in index 2cb4a13c4..c82fdc981 100644 --- a/contrib/scripts/terminate.py.in +++ b/contrib/scripts/terminate.py.in @@ -1,4 +1,4 @@ -#!@PYTHON@ +#!@PYTHONEXE@ # This file is part of GNUnet. # (C) 2011, 2018 Christian Grothoff (and other contributing authors) # -- cgit v1.2.3 From 3fcb02bf06baa99375359a5d7ed768f36bde44d9 Mon Sep 17 00:00:00 2001 From: ng0 Date: Wed, 27 Nov 2019 21:56:13 +0000 Subject: gnunet-bugreport: license and typo --- contrib/scripts/gnunet-bugreport | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport index aaba45252..203981ad5 100755 --- a/contrib/scripts/gnunet-bugreport +++ b/contrib/scripts/gnunet-bugreport @@ -1,10 +1,12 @@ #!/usr/bin/env sh - +# # Caveats: # - checks with textprocessing assuming that system language is English. # - maybe check last return status instead? # - Do we need to set awk to which awk becomes available or is awk # always available as just awk? +# +# SPDX-License-Identifier: 0BSD progname=${0##*/} @@ -35,7 +37,7 @@ linemsg() errmsg='' -# Check if shell support builtin 'type'. +# Check if shell supports builtin 'type'. if test -z "$errmsg"; then if ! (eval 'type type') >/dev/null 2>&1 then -- cgit v1.2.3 From 023159cac94b2166eac66d35dd72fa072c419ac7 Mon Sep 17 00:00:00 2001 From: ng0 Date: Thu, 28 Nov 2019 09:07:58 +0000 Subject: gnunet-bugreport: improve libextrator + git detection, merge gnurl+curl checks --- contrib/scripts/gnunet-bugreport | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport index 203981ad5..6759c21c0 100755 --- a/contrib/scripts/gnunet-bugreport +++ b/contrib/scripts/gnunet-bugreport @@ -6,6 +6,7 @@ # - Do we need to set awk to which awk becomes available or is awk # always available as just awk? # +# Dedicated to the Public Domain. # SPDX-License-Identifier: 0BSD progname=${0##*/} @@ -206,10 +207,13 @@ libextractor_check() { TEST=`type extract | awk '/not found/' 2>/dev/null` if test -z "$TEST"; then - VER=`extract -v 2>/dev/null | head -n 1 | awk '{print $2}'` - infomsg "libextractor : $VER" - else - warningmsg "libextractor : Not Found" + TEST=`strings $(type extract | awk '{print $NF}') | awk '/EXTRACTOR_extract/' 2>/dev/null` + if test -n "$TEST"; then + VER=`extract -v 2>/dev/null | awk '{gsub("v",""); print $NF}'` + infomsg "libextractor : $VER" + else + warningmsg "libextractor : Not Found" + fi fi } @@ -241,7 +245,7 @@ gnunet_version_check() gitcommit_check() { - TEST=$(git | awk '/not found/' 2> /dev/null) + TEST=$(type git | awk '/not found/' 2> /dev/null) if test -z "$TEST"; then VER=$(git rev-parse HEAD) infomsg "git commit : $VER" @@ -419,28 +423,27 @@ gettext_check() fi } -# Merge curl_check + gnurl_check -> error if neither is -# found (yes those systems exist) -curl_check() +gnurl_curl_check() { - TEST=`type curl-config | awk '/not found/' 2> /dev/null` - if test -z "$TEST"; then + TESTCURL=`type curl-config | awk '/not found/' 2> /dev/null` + if test -z "$TESTCURL"; then VER=`curl-config --version 2> /dev/null | awk '{print $NF}'` infomsg "libcurl : $VER" else infomsg "libcurl : Not found" fi -} -gnurl_check() -{ - TEST=`type gnurl-config | awk '/not found/' 2> /dev/null` - if test -z "$TEST"; then - VER=`gnurl-config --version 2> /dev/null | awk '{print $NF}'` + TESTGNURL=`type gnurl-config | awk '/not found/' 2> /dev/null` + if test -z "$TESTGNURL"; then + VER=`gnurl-config --version 2>&1 /dev/null | awk '{print $NF}'` infomsg "libgnurl : $VER" else infomsg "libgnurl : Not found" fi + + if test -z "$TESTCURL" -a "$TESTGNURL"; then + warningmsg "libgnurl or libcurl : Not found" + fi } libmicrohttpd_check() @@ -560,8 +563,7 @@ main() libunistring_check gnugettext_check gettext_check - curl_check - gnurl_check + gnurl_curl_check libmicrohttpd_check glpk_check gnutls_check -- cgit v1.2.3 From 2889b023ff826452128bda422fcff545e2c47155 Mon Sep 17 00:00:00 2001 From: ng0 Date: Thu, 28 Nov 2019 09:18:15 +0000 Subject: remove some output redirections. --- contrib/scripts/gnunet-bugreport | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'contrib') diff --git a/contrib/scripts/gnunet-bugreport b/contrib/scripts/gnunet-bugreport index 6759c21c0..21808273a 100755 --- a/contrib/scripts/gnunet-bugreport +++ b/contrib/scripts/gnunet-bugreport @@ -61,7 +61,7 @@ os_check() # awk isn't there it can't be found. awk_check() { - if test -z "`type awk 2>&1 | awk '/not found/'`"; then + if test -z "`type awk | awk '/not found/'`"; then infomsg "awk : Found" else warningmsg "awk : Not found!" @@ -403,7 +403,7 @@ libunistring_check() gnugettext_check() { - TEST=`type gettext | awk '/not found/' 2> /dev/null` + TEST=`type gettext | awk '/not found/'` if test -z "$TEST"; then if test -n "$(gettext --version 2>&1 | awk '/unknown option/')"; then infomsg "GNU gettext : Not found" @@ -416,7 +416,7 @@ gnugettext_check() gettext_check() { - if test -n "`type getext 2>/dev/null`"; then + if test -z "`type getext | awk '/not found/'`"; then infomsg "gettext : Found" else infomsg "gettext : Not Found" @@ -448,7 +448,6 @@ gnurl_curl_check() libmicrohttpd_check() { - # TMPFILE=`mktemp /tmp/mhd-version-testXXXXXX` TMPFILE="bugreport-test_lmhd.c" cat - >$TMPFILE < @@ -474,7 +473,6 @@ EOF glpk_check() { - # TMPFILE=`mktemp /tmp/glpk-version-testXXXXXX` TMPFILE="bugreport-glpk_check.c" cat - >$TMPFILE < @@ -500,7 +498,6 @@ EOF gnutls_check() { - # TMPFILE=`mktemp /tmp/gnutls-version-testXXXXXX` TMPFILE="bugreport-gnutls_check.c" cat - >$TMPFILE < @@ -532,8 +529,6 @@ main() echo "CPPFLAGS='-I/usr/pkg/include' LDFLAGS='-L/usr/pkg/lib' ${progname}" return 0 fi - #echo $LDFLAGS - #echo $CPPFLAGS infomsg "${progname} 0.11.0" infomsg infomsg "Please submit the following" -- cgit v1.2.3