Import newer scripts upstream

This commit is contained in:
Pierre Pronchery 2016-01-20 00:24:07 +01:00
parent 7dad2004e7
commit cff03e6137
4 changed files with 40 additions and 19 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#$Id$ #$Id$
#Copyright (c) 2011-2014 Pierre Pronchery <khorben@defora.org> #Copyright (c) 2011-2015 Pierre Pronchery <khorben@defora.org>
# #
#Redistribution and use in source and binary forms, with or without #Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met: #modification, are permitted provided that the following conditions are met:
@ -29,6 +29,7 @@ PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh" [ -f "../config.sh" ] && . "../config.sh"
DEBUG="_debug" DEBUG="_debug"
DEVNULL="/dev/null" DEVNULL="/dev/null"
PROGNAME="pkgconfig.sh"
#executables #executables
INSTALL="install -m 0644" INSTALL="install -m 0644"
MKDIR="mkdir -m 0755 -p" MKDIR="mkdir -m 0755 -p"
@ -40,7 +41,7 @@ SED="sed"
#debug #debug
_debug() _debug()
{ {
echo "$@" 1>&2 echo "$@" 1>&3
"$@" "$@"
} }
@ -48,7 +49,7 @@ _debug()
#error #error
_error() _error()
{ {
echo "pkgconfig.sh: $@" 1>&2 echo "$PROGNAME: $@" 1>&2
return 2 return 2
} }
@ -56,7 +57,7 @@ _error()
#usage #usage
_usage() _usage()
{ {
echo "Usage: pkgconfig.sh [-c|-i|-u][-P prefix] target..." 1>&2 echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
return 1 return 1
} }
@ -104,6 +105,7 @@ if [ -z "$VERSION" ]; then
fi fi
PKGCONFIG="$PREFIX/lib/pkgconfig" PKGCONFIG="$PREFIX/lib/pkgconfig"
exec 3>&1
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
shift shift
@ -121,7 +123,11 @@ while [ $# -gt 0 ]; do
if [ "$install" -eq 1 ]; then if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}" source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$PKGCONFIG" || exit 2 $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 continue
fi fi

View File

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
#$Id$ #$Id$
#Copyright (c) 2012-2014 Pierre Pronchery <khorben@defora.org> #Copyright (c) 2012-2015 Pierre Pronchery <khorben@defora.org>
# #
#Redistribution and use in source and binary forms, with or without #Redistribution and use in source and binary forms, with or without
#modification, are permitted provided that the following conditions are met: #modification, are permitted provided that the following conditions are met:
@ -27,6 +27,7 @@
#variables #variables
PREFIX="/usr/local" PREFIX="/usr/local"
[ -f "../config.sh" ] && . "../config.sh" [ -f "../config.sh" ] && . "../config.sh"
PROGNAME="docbook.sh"
#executables #executables
DEBUG="_debug" DEBUG="_debug"
FOP="fop" FOP="fop"
@ -41,7 +42,7 @@ XSLTPROC="xsltproc --nonet --xinclude"
#debug #debug
_debug() _debug()
{ {
echo "$@" 1>&2 echo "$@" 1>&3
"$@" "$@"
} }
@ -51,19 +52,25 @@ _docbook()
{ {
target="$1" target="$1"
source="${target#$OBJDIR}" source="${target%.*}.xml"
source="${source%.*}.xml" [ -f "$source" ] || source="${source#$OBJDIR}"
ext="${target##*.}" ext="${target##*.}"
ext="${ext##.}" ext="${ext##.}"
case "$ext" in case "$ext" in
html) html)
XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl" XSL="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl" [ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
[ -f "${target%.*}.css.xml" ] && XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1" if [ -f "${target%.*}.css.xml" ]; then
XSLTPROC="$XSLTPROC --param custom.css.source \"${target%.*}.css.xml\" --param generate.css.header 1"
elif [ -f "${source%.*}.css.xml" ]; then
XSLTPROC="$XSLTPROC --param custom.css.source \"${source%.*}.css.xml\" --param generate.css.header 1"
fi
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source" $DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;; ;;
pdf) pdf)
XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl" XSL="http://docbook.sourceforge.net/release/xsl/current/fo/docbook.xsl"
[ -f "${source%.*}.xsl" ] && XSL="${source%.*}.xsl"
[ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl" [ -f "${target%.*}.xsl" ] && XSL="${target%.*}.xsl"
$DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" && $DEBUG $XSLTPROC -o "${target%.*}.fo" "$XSL" "$source" &&
$DEBUG $FOP -fo "${target%.*}.fo" -pdf "$target" $DEBUG $FOP -fo "${target%.*}.fo" -pdf "$target"
@ -74,13 +81,13 @@ _docbook()
$DEBUG $XSLTPROC -o "$target" "$XSL" "$source" $DEBUG $XSLTPROC -o "$target" "$XSL" "$source"
;; ;;
*) *)
echo "$0: $target: Unknown type" 1>&2 _error "$target: Unknown type"
return 2 return 2
;; ;;
esac esac
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "$0: $target: Could not create page" 1>&2 _error "$target: Could not create page"
$RM -- "$target" $RM -- "$target"
return 2 return 2
fi fi
@ -90,7 +97,7 @@ _docbook()
#error #error
_error() _error()
{ {
echo "docbook.sh: $@" 1>&2 echo "$PROGNAME: $@" 1>&2
return 2 return 2
} }
@ -98,7 +105,7 @@ _error()
#usage #usage
_usage() _usage()
{ {
echo "Usage: docbook.sh [-c|-i|-u][-P prefix] target..." 1>&2 echo "Usage: $PROGNAME [-c|-i|-u][-P prefix] target..." 1>&2
return 1 return 1
} }
@ -144,6 +151,7 @@ fi
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" [ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
[ -z "$MANDIR" ] && MANDIR="$DATADIR/man" [ -z "$MANDIR" ] && MANDIR="$DATADIR/man"
exec 3>&1
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
shift shift
@ -169,7 +177,7 @@ while [ $# -gt 0 ]; do
instdir="$MANDIR/man$ext" instdir="$MANDIR/man$ext"
;; ;;
*) *)
echo "$0: $target: Unknown type" 1>&2 _error "$target: Unknown type"
exit 2 exit 2
;; ;;
esac esac
@ -187,7 +195,11 @@ while [ $# -gt 0 ]; do
#install #install
if [ "$install" -eq 1 ]; then if [ "$install" -eq 1 ]; then
source="${target#$OBJDIR}" source="${target#$OBJDIR}"
$DEBUG $MKDIR -- "$instdir" || exit 2 dirname=
if [ "${source%/*}" != "$source" ]; then
dirname="/${source%/*}"
fi
$DEBUG $MKDIR -- "$instdir$dirname" || exit 2
$DEBUG $INSTALL "$target" "$instdir/$source" || exit 2 $DEBUG $INSTALL "$target" "$instdir/$source" || exit 2
continue continue
fi fi

View File

@ -47,7 +47,7 @@ TOUCH="touch"
#debug #debug
_debug() _debug()
{ {
echo "$@" 1>&2 echo "$@" 1>&3
"$@" "$@"
} }
@ -110,6 +110,7 @@ MODULE="$PACKAGE"
[ -z "$DATADIR" ] && DATADIR="$PREFIX/share" [ -z "$DATADIR" ] && DATADIR="$PREFIX/share"
instdir="$DATADIR/gtk-doc/html" instdir="$DATADIR/gtk-doc/html"
exec 3>&1
while [ $# -gt 0 ]; do while [ $# -gt 0 ]; do
target="$1" target="$1"
target="${target#$OBJDIR}" target="${target#$OBJDIR}"

View File

@ -30,6 +30,7 @@ PROGNAME="pylint.sh"
DEBUG="_debug" DEBUG="_debug"
FIND="find" FIND="find"
PYLINT="pep8" PYLINT="pep8"
SORT="sort"
#functions #functions
@ -49,7 +50,7 @@ _pylint()
#debug #debug
_debug() _debug()
{ {
echo "$@" 1>&2 echo "$@" 1>&3
"$@" "$@"
res=$? res=$?
#ignore errors when the command is not available #ignore errors when the command is not available
@ -93,9 +94,10 @@ target="$1"
[ $clean -ne 0 ] && exit 0 [ $clean -ne 0 ] && exit 0
ret=0 ret=0
exec 3>&1
(date (date
echo echo
$FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | while read filename; do $FIND "../doc" "../src" "../tests" "../tools" -name '*.py' | $SORT | while read filename; do
_pylint "$filename" _pylint "$filename"
done) > "$target" done) > "$target"
exit $ret exit $ret