Skip to content

Commit

Permalink
docbook-build.sh update after build scripts move
Browse files Browse the repository at this point in the history
Revise the script following the move of the Python build scripts to the
the main MantisBT repo.
  • Loading branch information
dregad committed Mar 7, 2021
1 parent 91ce1e6 commit ddc8692
Showing 1 changed file with 54 additions and 11 deletions.
65 changes: 54 additions & 11 deletions docbook-builds.sh
@@ -1,27 +1,70 @@
#!/bin/bash
#-----------------------------------------------------------------------------
#
# MantisBT manuals build
#
# This script is intended to be scheduled with cron, and will build the
# MantisBT manual.
#
#-----------------------------------------------------------------------------

LOGFILE=/var/log/$(basename $0).log
#------------------------------------------------------------------------------
# Parameters (edit variables as appropriate)
#

# references to build
refs=origin/master-1.3.x,origin/master
# Log file - set to /dev/null for no log
LOGFILE=/var/log/$(basename "$0" .sh).log
#LOGFILE=/dev/null

# MantisBT repository
repo=/srv/mantisbt
# MantisBT repository, used to retrieve the build script (since 2.25.0)
# and to checkout the reference to build
# To avoid cluttering the log with unnecessary output, configure the repo
# with `git config advice.detachedHead false`
pathRepo=/srv/mantisbt

# Target directory for manuals
docs=/srv/www/docs
pathDocs=/srv/www/docs

# References to process
# Comma-delimited list of branches, prefixed by remote (e.g. origin/master)
refs=origin/master

# Languages to build (blank = all)
lang=


#------------------------------------------------------------------------------
# Functions
#

function log()
{
DATE=$(date +"%F %T")
echo "$@"
echo "$DATE $*" >>"$LOGFILE"
}


#------------------------------------------------------------------------------
# Main
#

log "Building MantisBT manuals"

cd "$pathRepo" >> "$LOGFILE" || exit 1

# Update reference repository
log "Updating repository in '$pathRepo'"
git checkout --force master |tee -a "$LOGFILE"
git pull --rebase |tee -a "$LOGFILE"

# Force build
if [[ "$1" = "-f" ]] || [[ "$1" = "--force" ]]
then
force="--force"
force="--force"
fi

echo $(date +"%F %T") ' Building MantisBT manuals' >>$LOGFILE
/srv/mantisbt-tools/docbook-manual-repo.py --all $force --ref=$refs $repo $docs $lang >>$LOGFILE 2>&1
echo $(date +"%F %T") ' Build complete' >>$LOGFILE
echo "--------------------------------------------" >>$LOGFILE
build/docbook-manual-repo.py --all $force --ref=$refs "$pathRepo" "$pathDocs" "$lang" 2>&1 |tee -a "$LOGFILE"

log "Build complete"
echo "--------------------------------------------" >>"$LOGFILE"

0 comments on commit ddc8692

Please sign in to comment.