[Fusionforge-commits] FusionForge branch 6.0 updated. ed0a6bc scmhook: sync postreceiveemail from upstream, to fix issues when some characters are used in the commit log + e1cbb1af7c00d8126879a10895857151ddd8eb5b use PHP instead of Perl to RFC2047 MIME-encode the eMail Subject still canât believe only PHP does it rightâ¦
Sylvain Beucler
beuc-inria at libremir.placard.fr.eu.org
Tue Jun 16 14:54:28 CEST 2015
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 "FusionForge".
The branch, 6.0 has been updated
via ed0a6bc07a44c1a9e0d0a0cee23a2d43d332bab9 (commit)
from ab009daf6dde729970c5bf061e69645826ce36f2 (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 -----------------------------------------------------------------
https://scm.fusionforge.org/anonscm/gitweb/?p=fusionforge/fusionforge.git;a=commitdiff;h=ed0a6bc07a44c1a9e0d0a0cee23a2d43d332bab9
commit ed0a6bc07a44c1a9e0d0a0cee23a2d43d332bab9
Author: Sylvain Beucler <sylvain.beucler at inria.fr>
Date: Tue Jun 16 14:49:41 2015 +0200
scmhook: sync postreceiveemail from upstream, to fix issues when some characters are used in the commit log
+ e1cbb1af7c00d8126879a10895857151ddd8eb5b
use PHP instead of Perl to RFC2047 MIME-encode the eMail Subject
still can’t believe only PHP does it right…
diff --git a/src/debian/plugins b/src/debian/plugins
index 5f7e6f7..ec620fc 100644
--- a/src/debian/plugins
+++ b/src/debian/plugins
@@ -83,7 +83,7 @@ Depends:
# Note: scmhook might need to be manually packaged to allow installing
# the commit hooks on a separate SCM server
Package: fusionforge-plugin-scmhook
-Depends: php5-cli, php5-curl, ${perl:Depends}
+Depends: php5-cli, php5-curl, mksh, ${perl:Depends}
Package: fusionforge-plugin-sysauthldap
Depends: php5-ldap
diff --git a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/LICENCE b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/LICENCE
index 083c2da..c0403e2 100644
--- a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/LICENCE
+++ b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/LICENCE
@@ -4,7 +4,7 @@ the following licence:
# Copyright © 2013
# Thorsten “mirabilos” Glaser <thorsten.glaser at teckids.org>
-# Copyright © 2011, 2012, 2013, 2014
+# Copyright © 2011, 2012, 2013, 2014, 2015
# Thorsten “mirabilos” Glaser <t.glaser at tarent.de>
#
# Copyright (c) 2007 Andy Parkins
diff --git a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/README b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/README
index cd6877e..1a96312 100644
--- a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/README
+++ b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/README
@@ -5,12 +5,13 @@
This git repository took out the contributed post-receive hook
from git.git with its full history and aims to continue to fix
and develop it. There is also FusionForge/Evolvis integration,
-in a separate branch.
+in a separate branch. (For some strange reason FusionForge has
+opted out of the integration and uses the standalone version.)
This repository is hosted on evolvis.org (a public FusionForge
instance by tarent). We mirror it on github for popularity, as
shown below. Development of the hook is partially sponsored by
-tarent, FreeWRT (now The MirOS Project), Teckids.
+tarent, FreeWRT (now The MirOS Project), Teckids, FusionForge.
• https://evolvis.org/plugins/scmgit/cgi-bin/gitweb.cgi?p=evolvis-platfrm/recvhook.git
• https://github.com/mirabilos/recvhook
@@ -58,6 +59,8 @@ There are notable new settings:
of the content of the description file)
• hooks.kgbconffile (full path to a configuration file
for kgb-client, triggers on-push IRC notifications)
+• hooks.curltrigger (whitespace-separated list of URIs
+ to trigger, with cURL, on each push)
There’s also noticeable effort to fix umlauts and
other nōn-ASCII characters in eMails – as long as
diff --git a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/post-receive-email b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/post-receive-email
index 91836b1..ed40048 100755
--- a/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/post-receive-email
+++ b/src/plugins/scmhook/library/scmgit/hooks/postreceiveemail/post-receive-email
@@ -1,8 +1,8 @@
-#!/bin/sh
+#!/bin/mksh
#
# Copyright © 2013
# Thorsten “mirabilos” Glaser <thorsten.glaser at teckids.org>
-# Copyright © 2011, 2012, 2013, 2014
+# Copyright © 2011, 2012, 2013, 2014, 2015
# Thorsten “mirabilos” Glaser <t.glaser at tarent.de>
#
# Copyright (c) 2007 Andy Parkins
@@ -35,9 +35,12 @@
# chmod a+x post-receive-email
# cd /path/to/your/repository.git
# ln -sf /usr/share/git-core/contrib/hooks/post-receive-email hooks/post-receive
+# # or
+# ln -sf /etc/gforge/plugins/scmgit/post-receive-email.sh hooks/post-receive
+# # but that can only be used for a Forge-controlled repository
#
# This hook script needs the “en_US.UTF-8” locale set up on the server.
-# The FusionForge version works with a POSIX shell.
+# The MirBSD Korn Shell (mksh) must be installed as /bin/mksh and usable.
#
# This hook script assumes it is enabled on the central repository of a
# project, with all users pushing only to it and not between each other. It
@@ -98,6 +101,9 @@
# hooks.kgbconffile
# Full path to a configuration file for kgb-client, or unset/empty.
# If set, kgb-client will be invoked.
+# hooks.curltrigger
+# List (expanded by shell “for”, so be careful) of URIs to trigger on
+# each push to be accessed with cURL.
#
# Notes
# -----
@@ -111,14 +117,10 @@
nl='
'
unset LANGUAGE LC_ALL
-LANG=C LC_ADDRESS=C LC_COLLATE=C LC_CTYPE=en_US.UTF-8 \
+export LANG=C LC_ADDRESS=C LC_COLLATE=C LC_CTYPE=en_US.UTF-8 \
LC_IDENTIFICATION=C LC_MEASUREMENT=C LC_MESSAGES=C \
LC_MONETARY=C LC_NAME=C LC_NUMERIC=C LC_PAPER=C \
LC_TELEPHONE=C LC_TIME=C
-export LANG LC_ADDRESS LC_COLLATE LC_CTYPE \
- LC_IDENTIFICATION LC_MEASUREMENT LC_MESSAGES \
- LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
- LC_TELEPHONE LC_TIME
# ---------------------------- Functions
@@ -251,6 +253,11 @@ generate_email()
# Email parameters
# The email subject will contain the best description of the ref
# that we can build from the parameters
+ describe=$(git describe $rev 2>/dev/null)
+ if [ -z "$describe" ]; then
+ describe=$rev
+ fi
+
generate_email_header
# Call the correct body generation function
@@ -275,19 +282,26 @@ generate_email()
generate_email_header()
{
+ local routing_headers subj
+
# --- Email (all stdout will be the email)
# Generate header
routing_headers="To: $recipients"
- test -n "$envelopesender" && routing_headers="From: $envelopesender${nl}$routing_headers"
- test -n "$replyto" && routing_headers="$routing_headers${nl}Reply-To: $replyto"
+ [[ -n $envelopesender ]] && routing_headers="From: $envelopesender${nl}$routing_headers"
+ [[ -n $replyto ]] && routing_headers="$routing_headers${nl}Reply-To: $replyto"
- subj="Subject: ${emailprefix}$shortdesc $refname_type $short_refname ${change_type}d. $(git show --no-patch --format='%h %s' $newrev)"
+ subj="Subject: ${emailprefix}$shortdesc $refname_type $short_refname ${change_type}d. $describe"
subj=$(print -nr -- "$subj" | php -r '
-mb_internal_encoding("UTF-8");
-echo mb_encode_mimeheader(file_get_contents("php://stdin"),
-"UTF-8", "Q", "\012");')
-
+ mb_internal_encoding("UTF-8");
+ echo mb_encode_mimeheader(file_get_contents("php://stdin"),
+ "UTF-8", "Q", "\012");')
+
+ if [[ -z $subj ]]; then
+ print -u2 "E: Subject empty, RFC2047 MIME encoding failed"
+ exit 1
+ fi
+
cat <<-EOF
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
@@ -297,7 +311,7 @@ echo mb_encode_mimeheader(file_get_contents("php://stdin"),
X-Git-Reftype: $refname_type
X-Git-Oldrev: $oldrev
X-Git-Newrev: $newrev
- $subj
+ $subj
Auto-Submitted: auto-generated
This is an automated email from the git hooks/post-receive script. It was
@@ -753,17 +767,16 @@ limit_lines()
send_mail()
{
- send_mail_x=$(cat; echo x)
+ local x=$(cat; echo x)
- send_mail_x=${send_mail_x%x}
- test -n "$send_mail_x" || return 1
+ x=${x%x}
+ [[ -n $x ]] || return 1
- printf '%s' "$send_mail_x" | if [ -n "$envelopesender" ]; then
+ print -nr -- "$x" | if [ -n "$envelopesender" ]; then
/usr/sbin/sendmail -t -f "$envelopesender"
else
/usr/sbin/sendmail -t
fi
- unset send_mail_x
}
# ---------------------------- main()
@@ -796,11 +809,11 @@ emailprefix=$(git config hooks.emailprefix)
custom_showrev=$(git config hooks.showrev)
maxlines=$(git config hooks.emailmaxlines)
diffopts=$(git config hooks.diffopts)
-: ${diffopts:="-p --stat --summary --find-copies-harder"}
+: "${diffopts:="-p --stat --summary --find-copies-harder"}"
kgbconffile=$(git config hooks.kgbconffile)
replyto=$(git config hooks.replyto)
shortdesc=$(git config hooks.shortdesc)
-: ${shortdesc:=$projectdesc}
+: "${shortdesc:=$projectdesc}"
# --- Main loop
# Allow dual mode: run from the command line just like the update hook, or
@@ -818,8 +831,13 @@ else
prep_for_email $oldrev $newrev $refname || continue
generate_email $maxlines | send_mail
done
- if test -n "$kgbconffile" && test -s "$kgbconffile"; then
- printf '%s' "$ilines" | kgb-client \
+ if [[ -n $kgbconffile && -s $kgbconffile ]]; then
+ print -nr -- "$ilines" | kgb-client \
--conf "$kgbconffile" --repository git --git-reflog -
fi
+ set -o noglob
+ for uri in $(git config hooks.curltrigger); do
+ print -r -- "‣‣‣ $uri"
+ curl "$uri"
+ done
fi
diff --git a/src/plugins/scmhook/library/scmgit/postReceiveEmail.class.php b/src/plugins/scmhook/library/scmgit/postReceiveEmail.class.php
index e724d29..a568b64 100644
--- a/src/plugins/scmhook/library/scmgit/postReceiveEmail.class.php
+++ b/src/plugins/scmhook/library/scmgit/postReceiveEmail.class.php
@@ -35,7 +35,7 @@ class GitPostReceiveEmail extends scmhook {
$this->label = "scmgit";
$this->unixname = "postreceiveemail";
$this->needcopy = 0;
- $this->command = '/bin/sh '.forge_get_config('plugins_path').'/scmhook/library/'.$this->label.'/hooks/'.$this->unixname.'/post-receive-email <<eoc '."\n".'$PARAMS'."\n".'eoc';
+ $this->command = forge_get_config('plugins_path').'/scmhook/library/'.$this->label.'/hooks/'.$this->unixname.'/post-receive-email <<eoc '."\n".'$PARAMS'."\n".'eoc';
}
function isAvailable() {
diff --git a/src/rpm/plugins b/src/rpm/plugins
index ead7cfa..7a4e3e10 100644
--- a/src/rpm/plugins
+++ b/src/rpm/plugins
@@ -59,7 +59,7 @@ Requires: moin, mod_wsgi, python-psycopg2
Requires:
%package plugin-scmhook
-Requires: php-cli, perl
+Requires: php-cli, perl, mksh
# Way too many rpmlint errors in this one
# Any volunteer?
-----------------------------------------------------------------------
Summary of changes:
src/debian/plugins | 2 +-
.../library/scmgit/hooks/postreceiveemail/LICENCE | 2 +-
.../library/scmgit/hooks/postreceiveemail/README | 7 ++-
.../hooks/postreceiveemail/post-receive-email | 68 ++++++++++++++--------
.../library/scmgit/postReceiveEmail.class.php | 2 +-
src/rpm/plugins | 2 +-
6 files changed, 52 insertions(+), 31 deletions(-)
hooks/post-receive
--
FusionForge
More information about the Fusionforge-commits
mailing list