From 0eb7cb45ccaa77b48e806f52288f872431e17dde Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 1 Sep 2019 05:00:03 +0200 Subject: [PATCH] Update the latest versions upstream --- data/pkgconfig.sh | 48 ++++++++++++++++++++++++++++-------- data/project.conf | 2 +- doc/gtkdoc.sh | 12 ++++++--- doc/project.conf | 8 +++--- tests/pylint.sh | 63 +++++++++++++++++++++++++++++++++-------------- tests/shlint.sh | 21 ++++++++++------ 6 files changed, 110 insertions(+), 44 deletions(-) diff --git a/data/pkgconfig.sh b/data/pkgconfig.sh index 8719e7b..cd4526c 100755 --- a/data/pkgconfig.sh +++ b/data/pkgconfig.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2011-2015 Pierre Pronchery +#Copyright (c) 2011-2019 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -25,8 +25,8 @@ #variables +CONFIGSH="${0%/pkgconfig.sh}/../config.sh" PREFIX="/usr/local" -[ -f "../config.sh" ] && . "../config.sh" DEBUG="_debug" DEVNULL="/dev/null" PROGNAME="pkgconfig.sh" @@ -35,13 +35,14 @@ INSTALL="install -m 0644" MKDIR="mkdir -m 0755 -p" RM="rm -f" SED="sed" +[ -f "$CONFIGSH" ] && . "$CONFIGSH" #functions #debug _debug() { - echo "$@" 1>&2 + echo "$@" 1>&3 "$@" } @@ -66,7 +67,7 @@ _usage() clean=0 install=0 uninstall=0 -while getopts "ciuP:" name; do +while getopts "ciuO:P:" name; do case $name in c) clean=1 @@ -79,6 +80,9 @@ while getopts "ciuP:" name; do install=0 uninstall=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; P) PREFIX="$OPTARG" ;; @@ -89,7 +93,7 @@ while getopts "ciuP:" name; do esac done shift $(($OPTIND - 1)) -if [ $# -eq 0 ]; then +if [ $# -lt 0 ]; then _usage exit $? fi @@ -103,8 +107,19 @@ if [ -z "$VERSION" ]; then _error "The VERSION variable needs to be set" exit $? fi +[ -z "$BINDIR" ] && BINDIR="$PREFIX/bin" +[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" +[ -z "$INCLUDEDIR" ] && INCLUDEDIR="$PREFIX/include" +[ -z "$LIBDIR" ] && LIBDIR="$PREFIX/lib" +[ -z "$LIBEXECDIR" ] && LIBEXECDIR="$PREFIX/libexec" +[ -z "$MANDIR" ] && MANDIR="$DATADIR/man" +if [ -z "$SYSCONFDIR" ]; then + SYSCONFDIR="$PREFIX/etc" + [ "$PREFIX" = "/usr" ] && SYSCONFDIR="/etc" +fi PKGCONFIG="$PREFIX/lib/pkgconfig" +exec 3>&1 while [ $# -gt 0 ]; do target="$1" shift @@ -122,7 +137,11 @@ while [ $# -gt 0 ]; do if [ "$install" -eq 1 ]; then source="${target#$OBJDIR}" $DEBUG $MKDIR -- "$PKGCONFIG" || exit 2 - $DEBUG $INSTALL "$target" "$PKGCONFIG/$source" || exit 2 + basename="$source" + if [ "${source##*/}" != "$source" ]; then + basename="${source##*/}" + fi + $DEBUG $INSTALL "$target" "$PKGCONFIG/$basename"|| exit 2 continue fi @@ -143,10 +162,19 @@ while [ $# -gt 0 ]; do #create source="${target#$OBJDIR}" source="${source}.in" - $DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;" \ - -e "s;@VERSION@;$VERSION;" \ - -e "s;@PREFIX@;$PREFIX;" \ - -e "s;@RPATH@;$RPATH;" \ + ([ -z "$OBJDIR" ] || $DEBUG $MKDIR -- "${target%/*}") || exit 2 + $DEBUG $SED -e "s;@PACKAGE@;$PACKAGE;g" \ + -e "s;@VERSION@;$VERSION;g" \ + -e "s;@PREFIX@;$PREFIX;g" \ + -e "s;@BINDIR@;$BINDIR;g" \ + -e "s;@DATADIR@;$DATADIR;g" \ + -e "s;@INCLUDEDIR@;$INCLUDEDIR;g" \ + -e "s;@LIBDIR@;$LIBDIR;g" \ + -e "s;@LIBEXECDIR@;$LIBEXECDIR;g" \ + -e "s;@MANDIR@;$MANDIR;g" \ + -e "s;@PWD@;$PWD;g" \ + -e "s;@RPATH@;$RPATH;g" \ + -e "s;@SYSCONFDIR@;$SYSCONFDIR;g" \ -- "$source" > "$target" if [ $? -ne 0 ]; then $DEBUG $RM -- "$target" diff --git a/data/project.conf b/data/project.conf index 035362c..379cd8c 100644 --- a/data/project.conf +++ b/data/project.conf @@ -4,5 +4,5 @@ dist=Makefile,libDatabase.pc.in,pkgconfig.sh [libDatabase.pc] type=script script=./pkgconfig.sh -depends=libDatabase.pc.in,../config.sh +depends=libDatabase.pc.in,pkgconfig.sh,../config.sh install= diff --git a/doc/gtkdoc.sh b/doc/gtkdoc.sh index 7435a5e..776e280 100755 --- a/doc/gtkdoc.sh +++ b/doc/gtkdoc.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2012-2015 Pierre Pronchery +#Copyright (c) 2012-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -47,7 +47,7 @@ TOUCH="touch" #debug _debug() { - echo "$@" 1>&2 + echo "$@" 1>&3 "$@" } @@ -72,7 +72,7 @@ _usage() clean=0 install=0 uninstall=0 -while getopts "ciuP:" name; do +while getopts "ciO:uP:" name; do case "$name" in c) clean=1 @@ -81,6 +81,9 @@ while getopts "ciuP:" name; do uninstall=0 install=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; u) install=0 uninstall=1 @@ -95,7 +98,7 @@ while getopts "ciuP:" name; do esac done shift $((OPTIND - 1)) -if [ $# -eq 0 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi @@ -110,6 +113,7 @@ MODULE="$PACKAGE" [ -z "$DATADIR" ] && DATADIR="$PREFIX/share" instdir="$DATADIR/gtk-doc/html" +exec 3>&1 while [ $# -gt 0 ]; do target="$1" target="${target#$OBJDIR}" diff --git a/doc/project.conf b/doc/project.conf index d42abc1..422b270 100644 --- a/doc/project.conf +++ b/doc/project.conf @@ -23,20 +23,20 @@ depends=../tools/subst.sh,database.xml.in [gtkdoc/libDatabase.types] type=script script=./gtkdoc.sh -depends=../config.sh +depends=gtkdoc.sh,../config.sh [gtkdoc/tmpl.stamp] type=script script=./gtkdoc.sh -depends=gtkdoc/libDatabase.types +depends=gtkdoc.sh,gtkdoc/libDatabase.types [gtkdoc/sgml.stamp] type=script script=./gtkdoc.sh -depends=gtkdoc/tmpl.stamp +depends=gtkdoc.sh,gtkdoc/tmpl.stamp [gtkdoc/html.stamp] type=script script=./gtkdoc.sh -depends=gtkdoc/libDatabase-docs.xml,gtkdoc/sgml.stamp +depends=gtkdoc.sh,gtkdoc/libDatabase-docs.xml,gtkdoc/sgml.stamp install= diff --git a/tests/pylint.sh b/tests/pylint.sh index 9fa1d12..90885d1 100755 --- a/tests/pylint.sh +++ b/tests/pylint.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2014-2015 Pierre Pronchery +#Copyright (c) 2014-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -26,22 +26,47 @@ #variables PROGNAME="pylint.sh" +PROJECTCONF="../project.conf" #executables +DATE="date" DEBUG="_debug" FIND="find" PYLINT="pep8" +SORT="sort -n" +TR="tr" #functions #pylint _pylint() { - filename="$1" + subdirs="data doc src tests tools" - #XXX ignores errors - $DEBUG $PYLINT -- "$filename" 2>&1 | while read line; do - echo "$line" 1>&2 - echo "$line" + $DATE + while read line; do + case "$line" in + "["*) + break + ;; + "subdirs="*) + subdirs=${line#subdirs=} + subdirs=$(echo "$subdirs" | $TR ',' ' ') + ;; + esac + done < "$PROJECTCONF" + for subdir in $subdirs; do + [ -d "../$subdir" ] || continue + for filename in $($FIND "../$subdir" -type f -a -name '*.py' | $SORT); do + echo + echo "Testing: $filename" + $DEBUG $PYLINT -- "$filename" 2>&1 + if [ $? -eq 0 ]; then + echo "$PROGNAME: $filename: OK" 1>&2 + else + #XXX ignore errors + echo "$PROGNAME: $filename: FAIL" 1>&2 + fi + done done } @@ -49,7 +74,7 @@ _pylint() #debug _debug() { - echo "$@" 1>&2 + echo "$@" 1>&3 "$@" res=$? #ignore errors when the command is not available @@ -61,18 +86,21 @@ _debug() #usage _usage() { - echo "Usage: $PROGNAME [-c] target" 1>&2 + echo "Usage: $PROGNAME [-c] target..." 1>&2 return 1 } #main clean=0 -while getopts "cP:" name; do +while getopts "cO:P:" name; do case "$name" in c) clean=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; P) #XXX ignored for compatibility ;; @@ -83,19 +111,18 @@ while getopts "cP:" name; do esac done shift $((OPTIND - 1)) -if [ $# -ne 1 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi -target="$1" #clean [ $clean -ne 0 ] && exit 0 -ret=0 -(date -echo -$FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | while read filename; do - _pylint "$filename" -done) > "$target" -exit $ret +exec 3>&1 +while [ $# -gt 0 ]; do + target="$1" + shift + + _pylint > "$target" || exit 2 +done diff --git a/tests/shlint.sh b/tests/shlint.sh index ef8fd97..0178b4e 100755 --- a/tests/shlint.sh +++ b/tests/shlint.sh @@ -1,6 +1,6 @@ #!/bin/sh #$Id$ -#Copyright (c) 2014-2016 Pierre Pronchery +#Copyright (c) 2014-2017 Pierre Pronchery # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: @@ -58,7 +58,7 @@ _shlint() done < "$PROJECTCONF" for subdir in $subdirs; do [ -d "../$subdir" ] || continue - for filename in $($FIND "../$subdir" -name '*.sh' | $SORT); do + for filename in $($FIND "../$subdir" -type f -a -name '*.sh' | $SORT); do _shlint_file "$filename" if [ $? -eq 0 ]; then echo "$filename:" @@ -109,7 +109,7 @@ _debug() #usage _usage() { - echo "Usage: $PROGNAME [-c] target" 1>&2 + echo "Usage: $PROGNAME [-c] target..." 1>&2 return 1 } @@ -124,11 +124,14 @@ _warning() #main clean=0 -while getopts "cP:" name; do +while getopts "cO:P:" name; do case "$name" in c) clean=1 ;; + O) + export "${OPTARG%%=*}"="${OPTARG#*=}" + ;; P) #XXX ignored for compatibility ;; @@ -139,14 +142,18 @@ while getopts "cP:" name; do esac done shift $((OPTIND - 1)) -if [ $# -ne 1 ]; then +if [ $# -lt 1 ]; then _usage exit $? fi -target="$1" #clean [ $clean -ne 0 ] && exit 0 exec 3>&1 -_shlint > "$target" +while [ $# -gt 0 ]; do + target="$1" + shift + + _shlint > "$target" || exit 2 +done