[git] gnupg-doc - branch, master, updated. 9c504b531be386a895496fec02385a2a54aeb4d2
by Werner Koch
cvs at cvs.gnupg.org
Mon Apr 24 15:59:51 CEST 2017
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GnuPG website and other docs".
The branch, master has been updated
via 9c504b531be386a895496fec02385a2a54aeb4d2 (commit)
from 8630a81c45b2890fd5a398565c9e5e875ba1a7a0 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9c504b531be386a895496fec02385a2a54aeb4d2
Author: Werner Koch <wk at gnupg.org>
Date: Mon Apr 24 15:56:12 2017 +0200
tools: Allow building a preview page.
diff --git a/tools/build-website.sh b/tools/build-website.sh
index 3a8b945..b477c19 100755
--- a/tools/build-website.sh
+++ b/tools/build-website.sh
@@ -5,6 +5,7 @@
#
# webbuilder - the user to run this script
# webbuild-x - the user used by this script to run emacs
+# webbuild-y - the user used by this script to run emacs (for preview)
#
# A certain directory layout is required with permissions setup
# so that the webbuild-x has only write access to the stage area
@@ -17,6 +18,7 @@
# --8<---------------cut here---------------start------------->8---
# # Pull the master branch of the web pages
# */20 * * * * cd /home/webbuilder/gnupg-doc && git pull -q origin master
+# */18 * * * * cd /home/webbuilder/gnupg-doc-preview && git pull -q origin preview
#
# # In case of race conditions we try to build every few ours again.
# 35 */7 * * * /home/webbuilder/bin/build-website.sh --cron
@@ -25,7 +27,7 @@
# /etc/sudoers needs this:
# --8<---------------cut here---------------start------------->8---
# # Let webbuilder run any command as user webbuild-x
-# webbuilder ALL = (webbuild-x) NOPASSWD: ALL
+# webbuilder ALL = (webbuild-x,webbuild-y) NOPASSWD: ALL
# --8<---------------cut here---------------end--------------->8---
#
@@ -34,6 +36,7 @@ set -e
pgm=build-website.sh
mainuser=webbuilder
workuser=webbuild-x
+workuser_pv=webbuild-y
# We use a fixed HOME so that this script can be run here from other
# accounts.
@@ -45,12 +48,16 @@ fi
reponame=gnupg-doc
htdocs_web="/var/www/www/www.gnupg.org/htdocs"
+htdocs_preview="/var/www/www/preview.gnupg.org/htdocs"
htdocs_blog="/var/www/www/www.gnupg.org/misc/blog"
workuser_dir=$HOME/${workuser}
+workuser_pv_dir=$HOME/${workuser_pv}
log_dir="$HOME/log"
root_dir="$HOME/${reponame}"
+root_dir_pv="$HOME/${reponame}-preview"
stage_dir="$HOME/${reponame}-stage"
+stage_dir_pv="$HOME/${reponame}-preview-stage"
LOCKFILE="${log_dir}/${reponame}.lock"
if [ x"$1" = x"--git" ]; then
@@ -68,8 +75,14 @@ if ! id $workuser >/dev/null 2>&1 ; then
exit 1
fi
+if ! id $workuser_pv >/dev/null 2>&1 ; then
+ echo "$pgm: sudo user '${workuser_pv}' not available" >&2;
+ exit 1
+fi
+
# Check directories
-for f in "${workuser_dir}" "${root_dir}" "${stage_dir}"; do
+for f in "${workuser_dir}" "${root_dir}" "${stage_dir}" \
+ "${workuser_pv_dir}" "${root_dir_pv}" "${stage_dir_pv}"; do
if [ ! -d "$f" ]; then
echo "$pgm: directory '$f' missing" >&2;
exit 1
@@ -85,11 +98,21 @@ for f in "${workuser_dir}" "${stage_dir}"; do
exit 1
fi
done
+want="2775:${workuser_pv}:${mainuser}"
+for f in "${workuser_pv_dir}" "${stage_dir_pv}"; do
+ x=$(stat -c '%a:%U:%G' "$f")
+ if [ x"$x" != x"$want" ]; then
+ echo "$pgm: directory '$f' has wrong permissions" >&2
+ echo "$pgm: want: $want" >&2
+ echo "$pgm: have: $x" >&2
+ exit 1
+ fi
+done
cd "${root_dir}"
#
-# Take a lock so that only one instacne of this script runs.
+# Take a lock so that only one instance of this script runs.
#
if ! lockfile -l 7200 -r 2 $LOCKFILE; then
echo "$pgm: another instance is still running" >&2
@@ -101,6 +124,8 @@ trap "rm -f $LOCKFILE" 0
# These flags are set to the stage directory if a sync is required
sync_web=
sync_blog=
+sync_preview=
+
#
# Build main part
@@ -204,6 +229,54 @@ fi
#
+# Build the preview site (w/o blogs)
+#
+branch=preview
+subdir=web
+
+cd "${root_dir_pv}"
+
+revlastfile="${log_dir}/${reponame}.$branch.$(echo $subdir | tr / _).revlast"
+buildlog="${log_dir}/${reponame}.$branch.$(echo $subdir | tr / _).log"
+rev="$(git rev-parse --verify $branch:$subdir)"
+if [ -z "$rev" ]; then
+ echo "$pgm: No git revision found" >&2;
+ exit 1
+fi
+revlast="$(head -1 ${revlastfile} 2>/dev/null || true)"
+if [ x"$rev" = x"$revlast" ]; then
+ echo "$pgm: No need to build $subdir" >&2;
+else
+
+ echo "$(date -u -Iseconds) build started for $branch:$subdir" | tee ${buildlog}
+
+ if [ ! -d ${stage_dir_pv}/${subdir} ]; then
+ sudo -u webbuild-y mkdir ${stage_dir_pv}/${subdir}
+ fi
+
+ sudo 2>>${buildlog} -u webbuild-y emacs24 -q --batch \
+ --eval "(require 'assoc)" \
+ --eval "(require 'org)" \
+ --eval "(setq make-backup-files nil)" \
+ --eval "(setq gpgweb-root-dir \"${root_dir_pv}/${subdir}/\")" \
+ --eval "(setq gpgweb-stage-dir \"${stage_dir_pv}/${subdir}/\")" \
+ --eval "(require 'gpgweb (concat gpgweb-root-dir \"share/gpgweb.el\"))" \
+ --eval "(setq org-publish-use-timestamps-flag nil)" \
+ --eval "(setq org-export-html-toplevel-hlevel 1)" \
+ --eval "(setq org-export-html-coding-system 'utf-8)" \
+ --eval "(gpgweb-setup-project)" \
+ --eval "(org-publish-initialize-cache \"gpgweb\")" \
+ --eval "(message \"root=(%s)\" gpgweb-root-dir)" \
+ --eval "(org-publish \"gpgweb\" t nil)"
+
+ echo "$rev" > ${revlastfile}
+ sync_preview=${stage_dir_pv}/${subdir}
+ echo "$(date -u -Iseconds) build finished for $branch:$subdir" | tee -a ${buildlog}
+fi
+cd "${root_dir}"
+
+
+#
# Sync to the webspace
#
cd "${root_dir}"
@@ -229,6 +302,13 @@ if [ -n "$sync_blog" ]; then
any_sync=yes
fi
+if [ -n "$sync_preview" ]; then
+ cd "$sync_preview"
+ rsync -rlt --exclude '*~' --exclude '*.tmp' \
+ . ${htdocs_preview}/
+fi
+
+
cd "${root_dir}"
if [ "$any_sync" = yes ]; then
diff --git a/web/verein/index.org b/web/verein/index.org
index b54dcdf..ac42655 100644
--- a/web/verein/index.org
+++ b/web/verein/index.org
@@ -1,6 +1,6 @@
#+TITLE: GnuPG e.V.
#+STARTUP: showall indent
-#+SETUPFILE: "share/setup.inc"
+#+SETUPFILE: "../share/setup.inc"
#+macro: atgit [[https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg-verein.git;a=blob_plain;f=$1][$2]]
* The GnuPG e.V.
-----------------------------------------------------------------------
Summary of changes:
tools/build-website.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++--
web/verein/index.org | 2 +-
2 files changed, 84 insertions(+), 4 deletions(-)
hooks/post-receive
--
The GnuPG website and other docs
http://git.gnupg.org
More information about the Gnupg-commits
mailing list