Skip to content

Commit

Permalink
Fix for issue #529: Profiling no longer requires PI
Browse files Browse the repository at this point in the history
Profiling nos is enabled automatically if one of the profiling variables
is set or when the option --setdate is used
  • Loading branch information
fsundermeyer committed Mar 2, 2022
1 parent 4e83b32 commit f106e07
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 40 deletions.
13 changes: 8 additions & 5 deletions bin/daps.in
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ VARLIST=(
DAPSROOT_DEFAULT
DEF_FILE
DIA_OPTIONS
DOCBOOK4_PROFILE_URN
DOCBOOK4_STYLE_URI
DOCBOOK5_PROFILE_URN
DOCBOOK5_RNG
DOCBOOK5_RNG_URI
DOCBOOK5_STYLE_URI
Expand Down Expand Up @@ -1635,12 +1637,13 @@ DOCBOOK_STYLES=${DOCBOOK_STYLES%/}
[[ -d "$DOCBOOK_STYLES" ]] || exit_on_error "DOCBOOK4_STYLE_URI or DOCBOOK5_STYLE_URI points to a non-existing directory \"$DOCBOOK_STYLES\"."

# ----------------------------------------------------------------------------
# Get PROFILE_URN to determine whether profiling is turned on
# will get exported via VARLIST
# Determine whether profiling is turned on and if so, set PROFILE_URN
#
if [[ "xml" = "$SRC_FORMAT" ]]; then
PROFILE_URN=$($XSLTPROC --stylesheet "${DAPSROOT}/daps-xslt/common/get-xml-stylesheet.xsl" --file "$MAIN" "$XSLTPROCESSOR") || exit_on_error "Could not get DocBook version. Maybe $MAIN is not well-formed?"
fi
# This needs to be done in make/common_variables.mk to allow passing
# profiling variable via command line to make:
# daps -d DC-foo profile PROFCONDITION=foobar
# PROFCONDITION=foobar is directly passed on to make and therefore is
# not known here

# ----------------------------------------------------------------------------
# Check whether we have an assembly by checking the root element from MAIN
Expand Down
63 changes: 47 additions & 16 deletions etc/config.in
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,23 @@ CONVERT_OPTS_PNG="-type grayscale -colors 256"
#
DIA_OPTIONS="-t cairo-svg"

## Key: DOCBOOK4_PROFILE_URN
## -------------------------
## Description: URN to a DocBook 4 profiling stylesheet
## Type: URN
## Default: "urn:x-daps:xslt:profiling:docbook45-profile.xsl"
#
# URN to a stylesheet used to profile DocBook 4 content. The stylesheet
# should match the DocBook version you are using, see comments below for
# possible values
#
#
#DOCBOOK4_PROFILE_URN="urn:x-daps:xslt:profiling:docbook41-profile.xsl"
#DOCBOOK4_PROFILE_URN="urn:x-daps:xslt:profiling:docbook42-profile.xsl"
#DOCBOOK4_PROFILE_URN="urn:x-daps:xslt:profiling:docbook43-profile.xsl"
#DOCBOOK4_PROFILE_URN="urn:x-daps:xslt:profiling:docbook44-profile.xsl"
DOCBOOK4_PROFILE_URN="urn:x-daps:xslt:profiling:docbook45-profile.xsl"

## Key: DOCBOOK4_STYLE_URI
## ------------------
## Description: URI to DocBook 4 stylesheets
Expand All @@ -295,25 +312,19 @@ DIA_OPTIONS="-t cairo-svg"
#
DOCBOOK4_STYLE_URI="http://docbook.sourceforge.net/release/xsl/current/"

## Key: DOCBOOK5_STYLE_URI
## ------------------
## Description: URI to DocBook 5 stylesheets
## Type: URI
## Default: "http://docbook.sourceforge.net/release/xsl-ns/current/"
## Key: DOCBOOK5_PROFILE_URN
## -------------------------
## Description: URN to a DocBook 5 profiling stylesheet
## Type: URN
## Default: "urn:x-daps:xslt:profiling:docbook51-profile.xsl"
#
# URI to the DocBook 5 stylesheets that can be resolved by xmlcatalog
# There should be no need to change this entry
# Note:
# URI _must_ end with a "/", otherwise it will not be resolved on Ubuntu
# URN to a stylesheet used to profile DocBook 5 content. The stylesheet
# should match the DocBook version you are using, see comments below for
# possible values
#
# WARNING:
# This value needs to point to the original DocBook stylesheets. It will
# ensure that there always is a fallback in case the stylesheets specified
# elsewhere do not provide the requested output format. These styles are
# also used to generate text output. Only change if the default value
# cannot be resolved by xmlcatalog.
#
DOCBOOK5_STYLE_URI="http://docbook.sourceforge.net/release/xsl-ns/current/"
#DOCBOOK5_PROFILE_URN="urn:x-daps:xslt:profiling:docbook50-profile.xsl"
DOCBOOK5_PROFILE_URN="urn:x-daps:xslt:profiling:docbook51-profile.xsl"

## Key: DOCBOOK5_RNG_URI
## ------------------
Expand All @@ -332,6 +343,26 @@ DOCBOOK5_STYLE_URI="http://docbook.sourceforge.net/release/xsl-ns/current/"
#DOCBOOK5_RNG_URI="http://docbook.org/xml/5.1/rng/docbookxi.rng"
DOCBOOK5_RNG_URI="http://docbook.org/xml/@db5version@/rng/docbookxi.rng"

## Key: DOCBOOK5_STYLE_URI
## ------------------
## Description: URI to DocBook 5 stylesheets
## Type: URI
## Default: "http://docbook.sourceforge.net/release/xsl-ns/current/"
#
# URI to the DocBook 5 stylesheets that can be resolved by xmlcatalog
# There should be no need to change this entry
# Note:
# URI _must_ end with a "/", otherwise it will not be resolved on Ubuntu
#
# WARNING:
# This value needs to point to the original DocBook stylesheets. It will
# ensure that there always is a fallback in case the stylesheets specified
# elsewhere do not provide the requested output format. These styles are
# also used to generate text output. Only change if the default value
# cannot be resolved by xmlcatalog.
#
DOCBOOK5_STYLE_URI="http://docbook.sourceforge.net/release/xsl-ns/current/"

## Key: DRAFT
## ------------------
## Description: Print "DRAFT" watermarks in HTML or PDF builds
Expand Down
13 changes: 4 additions & 9 deletions lib/daps_functions
Original file line number Diff line number Diff line change
Expand Up @@ -667,15 +667,10 @@ function call_make {
echo

# Profiling
if [[ -z $PROFILE_URN ]]; then
printf "%${COLWIDTH}s: %s\n" "PROFILING" "Off"
else
printf "%${COLWIDTH}s: %s\n" "PROFILING" "On"
# show all profiling variables and their values
for PROFVAR in ${PROFVARIABLES[*]}; do
[[ -n ${!PROFVAR} ]] && printf "%${COLWIDTH}s: %s\n" "$PROFVAR" "${!PROFVAR}"
done
fi
# show all profiling variables and their values
for PROFVAR in ${PROFVARIABLES[*]}; do
[[ -n ${!PROFVAR} ]] && printf "%${COLWIDTH}s: %s\n" "$PROFVAR" "${!PROFVAR}"
done

echo

Expand Down
15 changes: 14 additions & 1 deletion make/common_variables.mk
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,20 @@ endif
# That setup allows to not have to redo profiling every time.
#

ifdef PROFILE_URN
# Determine whether profiling is turned on and if so, set PROFILE_URN
# Add SETDATE here, because is set we need to do profiling as well to
# be able to set a custom date
#
IS_PROFILE := $(PROFARCH) $(PROFAUDIENCE) $(PROFCONDITION) \
$(PROFCONFORMANCE) $(PROFLANG) $(PROFOS) $(PROFOUTPUTFORMAT) \
$(PROFREVISION) $(PROFREVISIONFLAG) $(PROFROLE) $(PROFSECURITY) \
$(PROFSTATUS) $(PROFUSERLEVEL) $(PROFVENDOR) $(PROFWORDSIZE) $(SETDATE)
ifneq "$(strip $(IS_PROFILE))" ""
ifeq "$(strip $(DOCBOOK_VERSION))" "4"
PROFILE_URN := $(DOCBOOK4_PROFILE_URN)
else
PROFILE_URN := $(DOCBOOK5_PROFILE_URN)
endif
ifdef PROFARCH
PROFILEDIR := $(PROFILEDIR)_$(PROFARCH)
PROFSTRINGS += --stringparam "profile.arch=$(PROFARCH)"
Expand Down
15 changes: 6 additions & 9 deletions test/lib/020_pdf
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ function test_pdfGrayscaleCropmarks () {
endSkipping

}

#--------------------------------
# * Is the draft watermark image included when using the --draft option?
# * Are remarks displayed when using the --remarks option?
Expand Down Expand Up @@ -244,16 +245,12 @@ function test_pdfRemarksDraftMeta () {
"$?"

# checking REMARKS
# --param "show.comments=1" needs to occur once for each XML file on
# profiling and another time when creating the fo-file
#
_REMARK_COUNT_ACTUAL=$(egrep -c -- "--param\s+\"show\.comments=1\"" $_LOGFILE)
let "_REMARK_COUNT_EXPECTED=${#_XML_FILES[@]} + 1"
assertEquals \
" └─ --param \"show.comments=1\" appears less often in the log file than expected" \
"$_REMARK_COUNT_EXPECTED" "$_REMARK_COUNT_ACTUAL"

expr "$_PDF_BUILD_PATH" : '.*\(_remarks\)' >/dev/null
egrep -q -- "--param\s+\"show\.comments=1\"" $_LOGFILE 2>/dev/null
assertTrue \
" └─ Param for Remarks mode is not correctly specified when generating the FO-file" \
"$?"
expr "$_PDF_BUILD_PATH" : '.*\(_remarks\)' >/dev/null 2>&1
assertTrue \
' └─ String "_remarks" does not appear in the PDF filename' \
"$?"
Expand Down

0 comments on commit f106e07

Please sign in to comment.