[Mageia-sysadm] [650] add pre-commit script to prevent commit of some binary files

root at mageia.org root at mageia.org
Tue Dec 21 20:20:24 CET 2010


Revision: 650
Author:   boklm
Date:     2010-12-21 20:20:24 +0100 (Tue, 21 Dec 2010)
Log Message:
-----------
add pre-commit script to prevent commit of some binary files

Modified Paths:
--------------
    puppet/modules/subversion/manifests/init.pp

Added Paths:
-----------
    puppet/modules/subversion/templates/no_binary

Modified: puppet/modules/subversion/manifests/init.pp
===================================================================
--- puppet/modules/subversion/manifests/init.pp	2010-12-20 20:17:28 UTC (rev 649)
+++ puppet/modules/subversion/manifests/init.pp	2010-12-21 19:20:24 UTC (rev 650)
@@ -31,6 +31,14 @@
              content => template('subversion/create_svn_repo.sh') 
 	} 
 
+        file { "$local_dir/pre-commit.d/no_binary":
+            ensure => present,
+            owner => root,
+            group => root,
+            mode => 755,
+            content => template('subversion/no_binary') 
+        }
+
         file { "$local_dir/pre-commit.d/no_root_commit":
             ensure => present,
             owner => root,

Added: puppet/modules/subversion/templates/no_binary
===================================================================
--- puppet/modules/subversion/templates/no_binary	                        (rev 0)
+++ puppet/modules/subversion/templates/no_binary	2010-12-21 19:20:24 UTC (rev 650)
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+REP="$1"
+TXN="$2"
+
+# Filter some binary files based on common filename extentions.
+# 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'
+    exit 1
+fi
+
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/mageia-sysadm/attachments/20101221/3b68e1b1/attachment.html>


More information about the Mageia-sysadm mailing list