aboutsummaryrefslogtreecommitdiffstats
path: root/modules/subversion/templates
diff options
context:
space:
mode:
Diffstat (limited to 'modules/subversion/templates')
-rw-r--r--modules/subversion/templates/converted_to_git16
-rw-r--r--modules/subversion/templates/create_svn_mirror.sh13
-rw-r--r--modules/subversion/templates/hook_commit.sh18
-rw-r--r--modules/subversion/templates/hook_irker4
-rw-r--r--modules/subversion/templates/hook_sendmail.pl21
-rw-r--r--modules/subversion/templates/irker.conf7
-rw-r--r--modules/subversion/templates/no_binary14
-rw-r--r--modules/subversion/templates/pre-revprop-change15
-rw-r--r--modules/subversion/templates/restricted_to_user12
-rw-r--r--modules/subversion/templates/single_word_commit12
-rw-r--r--modules/subversion/templates/syntax_check.sh3
-rw-r--r--modules/subversion/templates/xinetd14
12 files changed, 145 insertions, 4 deletions
diff --git a/modules/subversion/templates/converted_to_git b/modules/subversion/templates/converted_to_git
new file mode 100644
index 00000000..8f137506
--- /dev/null
+++ b/modules/subversion/templates/converted_to_git
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+REPOS="$1"
+TXN="$2"
+
+if [ ! -f "$REPOS/conf/git.conf" ]; then
+ exit 0
+fi
+
+REGEX=$(cat "$REPOS/conf/git.conf" | grep -v "^#" | grep -v "^ *$" | xargs | sed 's/ /|/g')
+
+if (svnlook dirs-changed -t $TXN "$REPOS" | grep -qE "^($REGEX)"); then
+ echo "The subversion path you have attempted to commit to has been converted to git." >&2
+ echo "Please see: https://wiki.mageia.org/en/Git_Migration" >&2
+ exit 1
+fi
diff --git a/modules/subversion/templates/create_svn_mirror.sh b/modules/subversion/templates/create_svn_mirror.sh
new file mode 100644
index 00000000..ab0ada1b
--- /dev/null
+++ b/modules/subversion/templates/create_svn_mirror.sh
@@ -0,0 +1,13 @@
+#!/bin/bash
+umask 0002
+LOCAL_REPOS=$1
+REMOTE_REPOS=$2
+svnadmin create $LOCAL_REPOS
+# needed, as svnsync complain otherwise :
+# svnsync: Repository has not been enabled to accept revision propchanges;
+# ask the administrator to create a pre-revprop-change hook
+ln -s /bin/true $LOCAL_REPOS/hooks/pre-revprop-change
+svnsync init file://$1 $2
+# do not sync now,
+# let cron do it or puppet will complain ( especially for long sync )
+#svnsync synchronize file://$1
diff --git a/modules/subversion/templates/hook_commit.sh b/modules/subversion/templates/hook_commit.sh
index 0fdfc3e5..2b1b6ff3 100644
--- a/modules/subversion/templates/hook_commit.sh
+++ b/modules/subversion/templates/hook_commit.sh
@@ -1,5 +1,20 @@
#!/bin/sh
-for script in $0.d/*; do
+
+REP="$1"
+TXN="$2"
+
+author=$(svnlook author -t "$TXN" "$REP")
+
+# This is here only the time we use hook_sendmail.pl
+# We will be able to remove it when updating to a better send mail hook
+
+if [ "$author" = 'schedbot' ]; then
+ LIST=`ls -1 $0.d/* | grep -v send_mail`
+else
+ LIST=`ls -1 $0.d/*`
+fi
+
+for script in $LIST; do
if [ ! -x "$script" ]; then
continue
fi
@@ -10,4 +25,3 @@ for script in $0.d/*; do
$script $@ || exit 1
done
-
diff --git a/modules/subversion/templates/hook_irker b/modules/subversion/templates/hook_irker
new file mode 100644
index 00000000..8fd7a874
--- /dev/null
+++ b/modules/subversion/templates/hook_irker
@@ -0,0 +1,4 @@
+#!/bin/sh
+REPO=$1
+REV=$2
+<%= irkerhook_path %> --repository=$REPO $REV
diff --git a/modules/subversion/templates/hook_sendmail.pl b/modules/subversion/templates/hook_sendmail.pl
index 1fdc381f..cf3be6a4 100644
--- a/modules/subversion/templates/hook_sendmail.pl
+++ b/modules/subversion/templates/hook_sendmail.pl
@@ -6,8 +6,27 @@
handler: Alternative
alternative: HTML::ColorDiff
with-diff: 1
+ max_diff_length: 20000
+ ticket_map:
+ '(\bmga#(\d+)\b)': 'https://bugs.mageia.org/show_bug.cgi?id=%s'
+ revision-url: "https://svnweb.mageia.org/packages/?revision=%s&view=revision"
+ subject_cx: 1
+ from: subversion_noreply@ml.<%= @domain %>
to:
<%- commit_mail.each do |mail| -%>
- <%= mail %>
<%- end -%>
- from: root@<%= domain %>
+<%- if i18n_mail != '' -%>
+'.*\.pot$':
+ PATH: "/usr/bin:/usr/local/bin"
+ handler: Alternative
+ alternative: HTML::ColorDiff
+ with-diff: 1
+ max_diff_length: 20000
+ ticket_map:
+ '(\bmga#(\d+)\b)': 'https://bugs.mageia.org/show_bug.cgi?id=%s'
+ revision-url: "https://svnweb.mageia.org/packages/?revision=%s&view=revision"
+ subject_cx: 1
+ from: subversion_noreply@ml.<%= @domain %>
+ to: <%= i18n_mail %>
+<%- end -%>
diff --git a/modules/subversion/templates/irker.conf b/modules/subversion/templates/irker.conf
new file mode 100644
index 00000000..d037a120
--- /dev/null
+++ b/modules/subversion/templates/irker.conf
@@ -0,0 +1,7 @@
+<%-
+ content = ''
+ @irker_conf.keys.sort.each {|key|
+ content += key + ' = ' + @irker_conf[key] + "\n"
+ }
+-%>
+<%= content %>
diff --git a/modules/subversion/templates/no_binary b/modules/subversion/templates/no_binary
new file mode 100644
index 00000000..284642e5
--- /dev/null
+++ b/modules/subversion/templates/no_binary
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+REP="$1"
+TXN="$2"
+
+# Filter some binary files based on common filename extensions.
+# It does not fully prevent commit of binary files, this script is only
+# here to avoid simple mistakes
+if svnlook changed -t "$TXN" "$REP" | grep -qi '\.\(gz\|bz2\|xz\|lzma\|Z\|7z\|tar\|tgz\|zip\|jpg\|gif\|png\|ogg\|mp3\|wav\|rar\|pdf\)$'
+then
+ echo 'no binary files allowed on this repository' >&2
+ exit 1
+fi
+
diff --git a/modules/subversion/templates/pre-revprop-change b/modules/subversion/templates/pre-revprop-change
new file mode 100644
index 00000000..e9b18150
--- /dev/null
+++ b/modules/subversion/templates/pre-revprop-change
@@ -0,0 +1,15 @@
+#!/bin/sh
+
+# script taken from svn example hooks
+
+REPOS="$1"
+REV="$2"
+USER="$3"
+PROPNAME="$4"
+ACTION="$5"
+
+if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
+
+echo "Changing revision properties other than svn:log is prohibited" >&2
+exit 1
+
diff --git a/modules/subversion/templates/restricted_to_user b/modules/subversion/templates/restricted_to_user
new file mode 100644
index 00000000..98297627
--- /dev/null
+++ b/modules/subversion/templates/restricted_to_user
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+REP="$1"
+TXN="$2"
+
+author=$(svnlook author -t "$TXN" "$REP")
+
+if [ "$author" != '<%= restricted_to_user %>' ]; then
+ echo "this repository is restricted to user <%= restricted_to_user %>" >&2
+ exit 1
+fi
+
diff --git a/modules/subversion/templates/single_word_commit b/modules/subversion/templates/single_word_commit
new file mode 100644
index 00000000..1b0ff8a5
--- /dev/null
+++ b/modules/subversion/templates/single_word_commit
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+REP="$1"
+TXN="$2"
+
+LOG=$(svnlook log -t "$TXN" "$REP")
+
+if ! echo "$LOG" | grep -qvP '^\s*\b\S+\b\s*$'; then
+ echo "one word commit message not allowed" >&2
+ exit 1
+fi
+
diff --git a/modules/subversion/templates/syntax_check.sh b/modules/subversion/templates/syntax_check.sh
index 74d7bf4a..3960cdab 100644
--- a/modules/subversion/templates/syntax_check.sh
+++ b/modules/subversion/templates/syntax_check.sh
@@ -2,6 +2,7 @@
REPOS="$1"
TXN="$2"
+export PATH="/bin/:/sbin/:/usr/bin/:/usr/sbin/:/usr/local/bin:/usr/local/sbin/"
changed=`svnlook changed -t "$TXN" "$REPOS"`
files=`echo $changed | awk '{print $2}'`
@@ -11,7 +12,7 @@ then
if [ $? -ne 0 ]
then
echo "Syntax error in $files." 1>&2
- echo "Check it with <%= check_cmd %>"
+ echo "Check it with <%= check_cmd %>" 1>&2
exit 1
fi
fi
diff --git a/modules/subversion/templates/xinetd b/modules/subversion/templates/xinetd
new file mode 100644
index 00000000..0919ae60
--- /dev/null
+++ b/modules/subversion/templates/xinetd
@@ -0,0 +1,14 @@
+# default: off
+# description: svnserve is the server part of Subversion.
+service svnserve
+{
+ disable = no
+ port = 3690
+ socket_type = stream
+ protocol = tcp
+ wait = no
+ user = svn
+ server = /usr/bin/svnserve
+ server_args = -i -r <%= svn_base_path %>
+ flags = IPv6
+}