Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 25 Jan 2014 15:37:16 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-svnadmin@freebsd.org
Subject:   svn commit: r341044 - in svnadmin/hooks: . scripts
Message-ID:  <201401251537.s0PFbGgR069885@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Sat Jan 25 15:37:15 2014
New Revision: 341044
URL: http://svnweb.freebsd.org/changeset/ports/341044
QAT: https://qat.redports.org/buildarchive/r341044/

Log:
  Add a hook to forbid committing to vulk.xml and other files at the same time.
  
  With hat:	portmgr
  Sponsored by:	Absolight

Added:
  svnadmin/hooks/scripts/vulnxml-unique.sh   (contents, props changed)
Modified:
  svnadmin/hooks/pre-commit

Modified: svnadmin/hooks/pre-commit
==============================================================================
--- svnadmin/hooks/pre-commit	Sat Jan 25 15:35:43 2014	(r341043)
+++ svnadmin/hooks/pre-commit	Sat Jan 25 15:37:15 2014	(r341044)
@@ -95,6 +95,9 @@ mergeinfo.sh "$REPO" "$TXN" || exit 1
 # check NO_STAGE in commits
 stage-only.sh "$REPO" "$TXN" || exit 1
 
+# check commits to vulk.xml don't have other files
+vulnxml_unique.sh "$REPO" "$TXN" || exit 1
+
 # check for merge debris
 detect-merge-conflicts.sh "$REPO" "$TXN" || exit 1
 

Added: svnadmin/hooks/scripts/vulnxml-unique.sh
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ svnadmin/hooks/scripts/vulnxml-unique.sh	Sat Jan 25 15:37:15 2014	(r341044)
@@ -0,0 +1,44 @@
+#!/bin/sh
+# $FreeBSD$
+
+# Check that security/vuxml/vuln.xml is not committed together with other files
+
+REPO=$1
+TXN=$2
+
+# check arguments
+if [ -z "$REPO" -o -z "$TXN" ] ; then
+  echo "Syntax: $0 path_to_repos txn_id" >&2
+  exit 1
+fi
+
+# no commit to vuln.xml or other files yet
+VULN_XML=0
+OTHER=0
+
+# see what has changed
+OIFS=${IFS}
+IFS=$'\n'
+for line in $(svnlook changed -t $TXN $REPO) ; do
+	IFS=${OIFS}
+	set -- $line
+	type=$1
+	fpath=$2
+	case $fpath in
+		*/security/vuxml/vuln.xml)
+			VULN_XML=1
+			;;
+		*)
+			OTHER=1
+			;;
+	esac
+done
+
+# yell
+if [ $VULN_XML -gt 0 -a $OTHER -gt 0 ] ; then
+	echo "Commit to security/vuxml/vuln.xml first, and then other files"
+	exit 1
+fi
+
+# ok
+exit 0



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401251537.s0PFbGgR069885>