diff options
-rw-r--r-- | bin/fdp-functions | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/bin/fdp-functions b/bin/fdp-functions new file mode 100644 index 0000000..a1f2c74 --- /dev/null +++ b/bin/fdp-functions @@ -0,0 +1,38 @@ +#!/bin/sh +# +# Some common functions for use in other FDP scripts +# + + +FDPDIR=${FDPDIR:-".."} +FDPBINDIR="${FDPDIR}/docs-common/bin" +FDPPKGDIR="${FDPDIR}/docs-common/packaging" +RPMINFO=${RPMINFO:-"rpm-info.xml"} +XSLTPROC=${XSLTPROC:-xsltproc} +XMLFORMAT=${XMLFORMAT:-"${FDPBINDIR}/xmlformat" -f "${FDPBINDIR}/xmlformat-fdp.conf"} + +get_all_workers() +{ + # Return list of workers, in format "email:wholename" + ${XSLTPROC} "${FDPPKGDIR}/get-all-workers.xsl" \ + "$RPMINFO" | sed 's/^ \+//g' | grep -v '^$' | cat -n + +} + +get_worker_attribute() +{ + # Return an attribute for a specific worker + if [ ! -z "$2" ]; then POS=$2 ; fi + if [ ! -z "$1" ]; then ATT="$1" ; fi + ${XSLTPROC} --stringparam att "$ATT" --param pos $POS \ + "${FDPPKGDIR}/get-worker.xsl" "$RPMINFO" +} + +get_latest_revision() +{ + # Return latest revision for an optional role argument + if [ ! -z "$1" ]; then + OPTS="--stringparam role $1" + fi + ${XSLTPROC} ${OPTS} "${FDPPKGDIR}/doc-version.xsl" "$RPMINFO" +} |