kvm 0.0.1.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +3 -0
- data/.rvmrc +1 -0
- data/AGPL-3.0 +661 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +32 -0
- data/LICENSE +23 -0
- data/README.md +73 -0
- data/Rakefile +48 -0
- data/bin/kvm +6 -0
- data/kvm.gemspec +28 -0
- data/lib/kvm.rb +286 -0
- data/lib/kvm/archive.rb +56 -0
- data/lib/kvm/artifact.rb +28 -0
- data/lib/kvm/db/jdbc_adapter.rb +71 -0
- data/lib/kvm/db/oracle.rb +23 -0
- data/lib/kvm/db/types.rb +11 -0
- data/lib/kvm/impex.rb +109 -0
- data/lib/kvm/log.rb +7 -0
- data/lib/kvm/resource.rb +72 -0
- data/lib/kvm/rice_release.rb +79 -0
- data/lib/kvm/rice_release_generated_dataset.rb +68 -0
- data/lib/kvm/source.rb +33 -0
- data/lib/kvm/subversion.rb +52 -0
- data/lib/kvm/version.rb +3 -0
- data/lib/kvm/wallet.rb +64 -0
- data/support/ant/INSTALL +2 -0
- data/support/ant/KEYS +1398 -0
- data/support/ant/LICENSE +272 -0
- data/support/ant/NOTICE +6 -0
- data/support/ant/README +97 -0
- data/support/ant/WHATSNEW +5467 -0
- data/support/ant/bin/ant +335 -0
- data/support/ant/bin/ant.bat +218 -0
- data/support/ant/bin/ant.cmd +93 -0
- data/support/ant/bin/antRun +24 -0
- data/support/ant/bin/antRun.bat +50 -0
- data/support/ant/bin/antRun.pl +66 -0
- data/support/ant/bin/antenv.cmd +98 -0
- data/support/ant/bin/complete-ant-cmd.pl +114 -0
- data/support/ant/bin/envset.cmd +131 -0
- data/support/ant/bin/lcp.bat +31 -0
- data/support/ant/bin/runant.pl +153 -0
- data/support/ant/bin/runant.py +102 -0
- data/support/ant/bin/runrc.cmd +60 -0
- data/support/ant/etc/ant-bootstrap.jar +0 -0
- data/support/ant/etc/changelog.xsl +148 -0
- data/support/ant/etc/checkstyle/checkstyle-frames.xsl +299 -0
- data/support/ant/etc/checkstyle/checkstyle-text.xsl +34 -0
- data/support/ant/etc/checkstyle/checkstyle-xdoc.xsl +130 -0
- data/support/ant/etc/coverage-frames.xsl +489 -0
- data/support/ant/etc/jdepend-frames.xsl +487 -0
- data/support/ant/etc/jdepend.xsl +276 -0
- data/support/ant/etc/junit-frames-xalan1.xsl +733 -0
- data/support/ant/etc/junit-frames.xsl +902 -0
- data/support/ant/etc/junit-noframes.xsl +478 -0
- data/support/ant/etc/log.xsl +203 -0
- data/support/ant/etc/maudit-frames.xsl +503 -0
- data/support/ant/etc/mmetrics-frames.xsl +1026 -0
- data/support/ant/etc/tagdiff.xsl +179 -0
- data/support/ant/fetch.xml +343 -0
- data/support/ant/get-m2.xml +121 -0
- data/support/ant/lib/README +3 -0
- data/support/ant/lib/ant-antlr.jar +0 -0
- data/support/ant/lib/ant-antlr.pom +76 -0
- data/support/ant/lib/ant-apache-bcel.jar +0 -0
- data/support/ant/lib/ant-apache-bcel.pom +72 -0
- data/support/ant/lib/ant-apache-bsf.jar +0 -0
- data/support/ant/lib/ant-apache-bsf.pom +75 -0
- data/support/ant/lib/ant-apache-log4j.jar +0 -0
- data/support/ant/lib/ant-apache-log4j.pom +70 -0
- data/support/ant/lib/ant-apache-oro.jar +0 -0
- data/support/ant/lib/ant-apache-oro.pom +75 -0
- data/support/ant/lib/ant-apache-regexp.jar +0 -0
- data/support/ant/lib/ant-apache-regexp.pom +71 -0
- data/support/ant/lib/ant-apache-resolver.jar +0 -0
- data/support/ant/lib/ant-apache-resolver.pom +70 -0
- data/support/ant/lib/ant-apache-xalan2.jar +0 -0
- data/support/ant/lib/ant-apache-xalan2.pom +95 -0
- data/support/ant/lib/ant-commons-logging.jar +0 -0
- data/support/ant/lib/ant-commons-logging.pom +71 -0
- data/support/ant/lib/ant-commons-net.jar +0 -0
- data/support/ant/lib/ant-commons-net.pom +76 -0
- data/support/ant/lib/ant-jai.jar +0 -0
- data/support/ant/lib/ant-jai.pom +85 -0
- data/support/ant/lib/ant-javamail.jar +0 -0
- data/support/ant/lib/ant-javamail.pom +79 -0
- data/support/ant/lib/ant-jdepend.jar +0 -0
- data/support/ant/lib/ant-jdepend.pom +73 -0
- data/support/ant/lib/ant-jmf.jar +0 -0
- data/support/ant/lib/ant-jmf.pom +66 -0
- data/support/ant/lib/ant-jsch.jar +0 -0
- data/support/ant/lib/ant-jsch.pom +75 -0
- data/support/ant/lib/ant-junit.jar +0 -0
- data/support/ant/lib/ant-junit.pom +101 -0
- data/support/ant/lib/ant-junit4.jar +0 -0
- data/support/ant/lib/ant-junit4.pom +71 -0
- data/support/ant/lib/ant-launcher.jar +0 -0
- data/support/ant/lib/ant-launcher.pom +58 -0
- data/support/ant/lib/ant-netrexx.jar +0 -0
- data/support/ant/lib/ant-netrexx.pom +99 -0
- data/support/ant/lib/ant-parent.pom +120 -0
- data/support/ant/lib/ant-swing.jar +0 -0
- data/support/ant/lib/ant-swing.pom +67 -0
- data/support/ant/lib/ant-testutil.jar +0 -0
- data/support/ant/lib/ant-testutil.pom +75 -0
- data/support/ant/lib/ant.jar +0 -0
- data/support/ant/lib/ant.pom +222 -0
- data/support/ant/lib/libraries.properties +65 -0
- data/test/data/files/rice-0.0.0.0-bin.tar.gz +0 -0
- data/test/data/svn/README.txt +5 -0
- data/test/data/svn/conf/authz +32 -0
- data/test/data/svn/conf/passwd +8 -0
- data/test/data/svn/conf/svnserve.conf +47 -0
- data/test/data/svn/db/current +1 -0
- data/test/data/svn/db/format +2 -0
- data/test/data/svn/db/fs-type +1 -0
- data/test/data/svn/db/fsfs.conf +37 -0
- data/test/data/svn/db/min-unpacked-rev +1 -0
- data/test/data/svn/db/rep-cache.db +0 -0
- data/test/data/svn/db/revprops/0/0 +5 -0
- data/test/data/svn/db/revprops/0/1 +13 -0
- data/test/data/svn/db/revs/0/0 +11 -0
- data/test/data/svn/db/revs/0/1 +0 -0
- data/test/data/svn/db/txn-current +1 -0
- data/test/data/svn/db/txn-current-lock +0 -0
- data/test/data/svn/db/uuid +1 -0
- data/test/data/svn/db/write-lock +0 -0
- data/test/data/svn/format +1 -0
- data/test/data/svn/hooks/post-commit.tmpl +50 -0
- data/test/data/svn/hooks/post-lock.tmpl +44 -0
- data/test/data/svn/hooks/post-revprop-change.tmpl +56 -0
- data/test/data/svn/hooks/post-unlock.tmpl +42 -0
- data/test/data/svn/hooks/pre-commit.tmpl +81 -0
- data/test/data/svn/hooks/pre-lock.tmpl +71 -0
- data/test/data/svn/hooks/pre-revprop-change.tmpl +66 -0
- data/test/data/svn/hooks/pre-unlock.tmpl +63 -0
- data/test/data/svn/hooks/start-commit.tmpl +65 -0
- data/test/data/svn/locks/db-logs.lock +3 -0
- data/test/data/svn/locks/db.lock +3 -0
- data/test/helper.rb +146 -0
- data/test/int_test_generate_sql.rb +58 -0
- data/test/test_archive.rb +35 -0
- data/test/test_generate_sql.rb +0 -0
- data/test/test_rice_release.rb +61 -0
- data/test/test_rice_release_generated_dataset.rb +12 -0
- data/test/test_source.rb +31 -0
- data/test/test_subversion.rb +20 -0
- metadata +298 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# PRE-COMMIT HOOK
|
|
4
|
+
#
|
|
5
|
+
# The pre-commit hook is invoked before a Subversion txn is
|
|
6
|
+
# committed. Subversion runs this hook by invoking a program
|
|
7
|
+
# (script, executable, binary, etc.) named 'pre-commit' (for which
|
|
8
|
+
# this file is a template), with the following ordered arguments:
|
|
9
|
+
#
|
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
|
11
|
+
# [2] TXN-NAME (the name of the txn about to be committed)
|
|
12
|
+
#
|
|
13
|
+
# [STDIN] LOCK-TOKENS ** the lock tokens are passed via STDIN.
|
|
14
|
+
#
|
|
15
|
+
# If STDIN contains the line "LOCK-TOKENS:\n" (the "\n" denotes a
|
|
16
|
+
# single newline), the lines following it are the lock tokens for
|
|
17
|
+
# this commit. The end of the list is marked by a line containing
|
|
18
|
+
# only a newline character.
|
|
19
|
+
#
|
|
20
|
+
# Each lock token line consists of a URI-escaped path, followed
|
|
21
|
+
# by the separator character '|', followed by the lock token string,
|
|
22
|
+
# followed by a newline.
|
|
23
|
+
#
|
|
24
|
+
# The default working directory for the invocation is undefined, so
|
|
25
|
+
# the program should set one explicitly if it cares.
|
|
26
|
+
#
|
|
27
|
+
# If the hook program exits with success, the txn is committed; but
|
|
28
|
+
# if it exits with failure (non-zero), the txn is aborted, no commit
|
|
29
|
+
# takes place, and STDERR is returned to the client. The hook
|
|
30
|
+
# program can use the 'svnlook' utility to help it examine the txn.
|
|
31
|
+
#
|
|
32
|
+
# On a Unix system, the normal procedure is to have 'pre-commit'
|
|
33
|
+
# invoke other programs to do the real work, though it may do the
|
|
34
|
+
# work itself too.
|
|
35
|
+
#
|
|
36
|
+
# *** NOTE: THE HOOK PROGRAM MUST NOT MODIFY THE TXN, EXCEPT ***
|
|
37
|
+
# *** FOR REVISION PROPERTIES (like svn:log or svn:author). ***
|
|
38
|
+
#
|
|
39
|
+
# This is why we recommend using the read-only 'svnlook' utility.
|
|
40
|
+
# In the future, Subversion may enforce the rule that pre-commit
|
|
41
|
+
# hooks should not modify the versioned data in txns, or else come
|
|
42
|
+
# up with a mechanism to make it safe to do so (by informing the
|
|
43
|
+
# committing client of the changes). However, right now neither
|
|
44
|
+
# mechanism is implemented, so hook writers just have to be careful.
|
|
45
|
+
#
|
|
46
|
+
# Note that 'pre-commit' must be executable by the user(s) who will
|
|
47
|
+
# invoke it (typically the user httpd runs as), and that user must
|
|
48
|
+
# have filesystem-level permission to access the repository.
|
|
49
|
+
#
|
|
50
|
+
# On a Windows system, you should name the hook program
|
|
51
|
+
# 'pre-commit.bat' or 'pre-commit.exe',
|
|
52
|
+
# but the basic idea is the same.
|
|
53
|
+
#
|
|
54
|
+
# The hook program typically does not inherit the environment of
|
|
55
|
+
# its parent process. For example, a common problem is for the
|
|
56
|
+
# PATH environment variable to not be set to its usual value, so
|
|
57
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
|
58
|
+
# If you're having unexpected problems with a hook program, the
|
|
59
|
+
# culprit may be unusual (or missing) environment variables.
|
|
60
|
+
#
|
|
61
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
|
62
|
+
# For more examples and pre-written hooks, see those in
|
|
63
|
+
# the Subversion repository at
|
|
64
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
|
|
65
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
REPOS="$1"
|
|
69
|
+
TXN="$2"
|
|
70
|
+
|
|
71
|
+
# Make sure that the log message contains some text.
|
|
72
|
+
SVNLOOK=/usr/bin/svnlook
|
|
73
|
+
$SVNLOOK log -t "$TXN" "$REPOS" | \
|
|
74
|
+
grep "[a-zA-Z0-9]" > /dev/null || exit 1
|
|
75
|
+
|
|
76
|
+
# Check that the author of this commit has the rights to perform
|
|
77
|
+
# the commit on the files and directories being modified.
|
|
78
|
+
commit-access-control.pl "$REPOS" "$TXN" commit-access-control.cfg || exit 1
|
|
79
|
+
|
|
80
|
+
# All checks passed, so allow the commit.
|
|
81
|
+
exit 0
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# PRE-LOCK HOOK
|
|
4
|
+
#
|
|
5
|
+
# The pre-lock hook is invoked before an exclusive lock is
|
|
6
|
+
# created. Subversion runs this hook by invoking a program
|
|
7
|
+
# (script, executable, binary, etc.) named 'pre-lock' (for which
|
|
8
|
+
# this file is a template), with the following ordered arguments:
|
|
9
|
+
#
|
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
|
11
|
+
# [2] PATH (the path in the repository about to be locked)
|
|
12
|
+
# [3] USER (the user creating the lock)
|
|
13
|
+
# [4] COMMENT (the comment of the lock)
|
|
14
|
+
# [5] STEAL-LOCK (1 if the user is trying to steal the lock, else 0)
|
|
15
|
+
#
|
|
16
|
+
# If the hook program outputs anything on stdout, the output string will
|
|
17
|
+
# be used as the lock token for this lock operation. If you choose to use
|
|
18
|
+
# this feature, you must guarantee the tokens generated are unique across
|
|
19
|
+
# the repository each time.
|
|
20
|
+
#
|
|
21
|
+
# The default working directory for the invocation is undefined, so
|
|
22
|
+
# the program should set one explicitly if it cares.
|
|
23
|
+
#
|
|
24
|
+
# If the hook program exits with success, the lock is created; but
|
|
25
|
+
# if it exits with failure (non-zero), the lock action is aborted
|
|
26
|
+
# and STDERR is returned to the client.
|
|
27
|
+
|
|
28
|
+
# On a Unix system, the normal procedure is to have 'pre-lock'
|
|
29
|
+
# invoke other programs to do the real work, though it may do the
|
|
30
|
+
# work itself too.
|
|
31
|
+
#
|
|
32
|
+
# Note that 'pre-lock' must be executable by the user(s) who will
|
|
33
|
+
# invoke it (typically the user httpd runs as), and that user must
|
|
34
|
+
# have filesystem-level permission to access the repository.
|
|
35
|
+
#
|
|
36
|
+
# On a Windows system, you should name the hook program
|
|
37
|
+
# 'pre-lock.bat' or 'pre-lock.exe',
|
|
38
|
+
# but the basic idea is the same.
|
|
39
|
+
#
|
|
40
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
|
41
|
+
|
|
42
|
+
REPOS="$1"
|
|
43
|
+
PATH="$2"
|
|
44
|
+
USER="$3"
|
|
45
|
+
|
|
46
|
+
# If a lock exists and is owned by a different person, don't allow it
|
|
47
|
+
# to be stolen (e.g., with 'svn lock --force ...').
|
|
48
|
+
|
|
49
|
+
# (Maybe this script could send email to the lock owner?)
|
|
50
|
+
SVNLOOK=/usr/bin/svnlook
|
|
51
|
+
GREP=/bin/grep
|
|
52
|
+
SED=/bin/sed
|
|
53
|
+
|
|
54
|
+
LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
|
|
55
|
+
$GREP '^Owner: ' | $SED 's/Owner: //'`
|
|
56
|
+
|
|
57
|
+
# If we get no result from svnlook, there's no lock, allow the lock to
|
|
58
|
+
# happen:
|
|
59
|
+
if [ "$LOCK_OWNER" = "" ]; then
|
|
60
|
+
exit 0
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# If the person locking matches the lock's owner, allow the lock to
|
|
64
|
+
# happen:
|
|
65
|
+
if [ "$LOCK_OWNER" = "$USER" ]; then
|
|
66
|
+
exit 0
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Otherwise, we've got an owner mismatch, so return failure:
|
|
70
|
+
echo "Error: $PATH already locked by ${LOCK_OWNER}." 1>&2
|
|
71
|
+
exit 1
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# PRE-REVPROP-CHANGE HOOK
|
|
4
|
+
#
|
|
5
|
+
# The pre-revprop-change hook is invoked before a revision property
|
|
6
|
+
# is added, modified or deleted. Subversion runs this hook by invoking
|
|
7
|
+
# a program (script, executable, binary, etc.) named 'pre-revprop-change'
|
|
8
|
+
# (for which this file is a template), with the following ordered
|
|
9
|
+
# arguments:
|
|
10
|
+
#
|
|
11
|
+
# [1] REPOS-PATH (the path to this repository)
|
|
12
|
+
# [2] REVISION (the revision being tweaked)
|
|
13
|
+
# [3] USER (the username of the person tweaking the property)
|
|
14
|
+
# [4] PROPNAME (the property being set on the revision)
|
|
15
|
+
# [5] ACTION (the property is being 'A'dded, 'M'odified, or 'D'eleted)
|
|
16
|
+
#
|
|
17
|
+
# [STDIN] PROPVAL ** the new property value is passed via STDIN.
|
|
18
|
+
#
|
|
19
|
+
# If the hook program exits with success, the propchange happens; but
|
|
20
|
+
# if it exits with failure (non-zero), the propchange doesn't happen.
|
|
21
|
+
# The hook program can use the 'svnlook' utility to examine the
|
|
22
|
+
# existing value of the revision property.
|
|
23
|
+
#
|
|
24
|
+
# WARNING: unlike other hooks, this hook MUST exist for revision
|
|
25
|
+
# properties to be changed. If the hook does not exist, Subversion
|
|
26
|
+
# will behave as if the hook were present, but failed. The reason
|
|
27
|
+
# for this is that revision properties are UNVERSIONED, meaning that
|
|
28
|
+
# a successful propchange is destructive; the old value is gone
|
|
29
|
+
# forever. We recommend the hook back up the old value somewhere.
|
|
30
|
+
#
|
|
31
|
+
# On a Unix system, the normal procedure is to have 'pre-revprop-change'
|
|
32
|
+
# invoke other programs to do the real work, though it may do the
|
|
33
|
+
# work itself too.
|
|
34
|
+
#
|
|
35
|
+
# Note that 'pre-revprop-change' must be executable by the user(s) who will
|
|
36
|
+
# invoke it (typically the user httpd runs as), and that user must
|
|
37
|
+
# have filesystem-level permission to access the repository.
|
|
38
|
+
#
|
|
39
|
+
# On a Windows system, you should name the hook program
|
|
40
|
+
# 'pre-revprop-change.bat' or 'pre-revprop-change.exe',
|
|
41
|
+
# but the basic idea is the same.
|
|
42
|
+
#
|
|
43
|
+
# The hook program typically does not inherit the environment of
|
|
44
|
+
# its parent process. For example, a common problem is for the
|
|
45
|
+
# PATH environment variable to not be set to its usual value, so
|
|
46
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
|
47
|
+
# If you're having unexpected problems with a hook program, the
|
|
48
|
+
# culprit may be unusual (or missing) environment variables.
|
|
49
|
+
#
|
|
50
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
|
51
|
+
# For more examples and pre-written hooks, see those in
|
|
52
|
+
# the Subversion repository at
|
|
53
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
|
|
54
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
REPOS="$1"
|
|
58
|
+
REV="$2"
|
|
59
|
+
USER="$3"
|
|
60
|
+
PROPNAME="$4"
|
|
61
|
+
ACTION="$5"
|
|
62
|
+
|
|
63
|
+
if [ "$ACTION" = "M" -a "$PROPNAME" = "svn:log" ]; then exit 0; fi
|
|
64
|
+
|
|
65
|
+
echo "Changing revision properties other than svn:log is prohibited" >&2
|
|
66
|
+
exit 1
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# PRE-UNLOCK HOOK
|
|
4
|
+
#
|
|
5
|
+
# The pre-unlock hook is invoked before an exclusive lock is
|
|
6
|
+
# destroyed. Subversion runs this hook by invoking a program
|
|
7
|
+
# (script, executable, binary, etc.) named 'pre-unlock' (for which
|
|
8
|
+
# this file is a template), with the following ordered arguments:
|
|
9
|
+
#
|
|
10
|
+
# [1] REPOS-PATH (the path to this repository)
|
|
11
|
+
# [2] PATH (the path in the repository about to be unlocked)
|
|
12
|
+
# [3] USER (the user destroying the lock)
|
|
13
|
+
# [4] TOKEN (the lock token to be destroyed)
|
|
14
|
+
# [5] BREAK-UNLOCK (1 if the user is breaking the lock, else 0)
|
|
15
|
+
#
|
|
16
|
+
# The default working directory for the invocation is undefined, so
|
|
17
|
+
# the program should set one explicitly if it cares.
|
|
18
|
+
#
|
|
19
|
+
# If the hook program exits with success, the lock is destroyed; but
|
|
20
|
+
# if it exits with failure (non-zero), the unlock action is aborted
|
|
21
|
+
# and STDERR is returned to the client.
|
|
22
|
+
|
|
23
|
+
# On a Unix system, the normal procedure is to have 'pre-unlock'
|
|
24
|
+
# invoke other programs to do the real work, though it may do the
|
|
25
|
+
# work itself too.
|
|
26
|
+
#
|
|
27
|
+
# Note that 'pre-unlock' must be executable by the user(s) who will
|
|
28
|
+
# invoke it (typically the user httpd runs as), and that user must
|
|
29
|
+
# have filesystem-level permission to access the repository.
|
|
30
|
+
#
|
|
31
|
+
# On a Windows system, you should name the hook program
|
|
32
|
+
# 'pre-unlock.bat' or 'pre-unlock.exe',
|
|
33
|
+
# but the basic idea is the same.
|
|
34
|
+
#
|
|
35
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter:
|
|
36
|
+
|
|
37
|
+
REPOS="$1"
|
|
38
|
+
PATH="$2"
|
|
39
|
+
USER="$3"
|
|
40
|
+
|
|
41
|
+
# If a lock is owned by a different person, don't allow it be broken.
|
|
42
|
+
# (Maybe this script could send email to the lock owner?)
|
|
43
|
+
|
|
44
|
+
SVNLOOK=/usr/bin/svnlook
|
|
45
|
+
GREP=/bin/grep
|
|
46
|
+
SED=/bin/sed
|
|
47
|
+
|
|
48
|
+
LOCK_OWNER=`$SVNLOOK lock "$REPOS" "$PATH" | \
|
|
49
|
+
$GREP '^Owner: ' | $SED 's/Owner: //'`
|
|
50
|
+
|
|
51
|
+
# If we get no result from svnlook, there's no lock, return success:
|
|
52
|
+
if [ "$LOCK_OWNER" = "" ]; then
|
|
53
|
+
exit 0
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
# If the person unlocking matches the lock's owner, return success:
|
|
57
|
+
if [ "$LOCK_OWNER" = "$USER" ]; then
|
|
58
|
+
exit 0
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
# Otherwise, we've got an owner mismatch, so return failure:
|
|
62
|
+
echo "Error: $PATH locked by ${LOCK_OWNER}." 1>&2
|
|
63
|
+
exit 1
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# START-COMMIT HOOK
|
|
4
|
+
#
|
|
5
|
+
# The start-commit hook is invoked before a Subversion txn is created
|
|
6
|
+
# in the process of doing a commit. Subversion runs this hook
|
|
7
|
+
# by invoking a program (script, executable, binary, etc.) named
|
|
8
|
+
# 'start-commit' (for which this file is a template)
|
|
9
|
+
# with the following ordered arguments:
|
|
10
|
+
#
|
|
11
|
+
# [1] REPOS-PATH (the path to this repository)
|
|
12
|
+
# [2] USER (the authenticated user attempting to commit)
|
|
13
|
+
# [3] CAPABILITIES (a colon-separated list of capabilities reported
|
|
14
|
+
# by the client; see note below)
|
|
15
|
+
#
|
|
16
|
+
# Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5
|
|
17
|
+
# clients will typically report at least the "mergeinfo" capability.
|
|
18
|
+
# If there are other capabilities, then the list is colon-separated,
|
|
19
|
+
# e.g.: "mergeinfo:some-other-capability" (the order is undefined).
|
|
20
|
+
#
|
|
21
|
+
# The list is self-reported by the client. Therefore, you should not
|
|
22
|
+
# make security assumptions based on the capabilities list, nor should
|
|
23
|
+
# you assume that clients reliably report every capability they have.
|
|
24
|
+
#
|
|
25
|
+
# The working directory for this hook program's invocation is undefined,
|
|
26
|
+
# so the program should set one explicitly if it cares.
|
|
27
|
+
#
|
|
28
|
+
# If the hook program exits with success, the commit continues; but
|
|
29
|
+
# if it exits with failure (non-zero), the commit is stopped before
|
|
30
|
+
# a Subversion txn is created, and STDERR is returned to the client.
|
|
31
|
+
#
|
|
32
|
+
# On a Unix system, the normal procedure is to have 'start-commit'
|
|
33
|
+
# invoke other programs to do the real work, though it may do the
|
|
34
|
+
# work itself too.
|
|
35
|
+
#
|
|
36
|
+
# Note that 'start-commit' must be executable by the user(s) who will
|
|
37
|
+
# invoke it (typically the user httpd runs as), and that user must
|
|
38
|
+
# have filesystem-level permission to access the repository.
|
|
39
|
+
#
|
|
40
|
+
# On a Windows system, you should name the hook program
|
|
41
|
+
# 'start-commit.bat' or 'start-commit.exe',
|
|
42
|
+
# but the basic idea is the same.
|
|
43
|
+
#
|
|
44
|
+
# The hook program typically does not inherit the environment of
|
|
45
|
+
# its parent process. For example, a common problem is for the
|
|
46
|
+
# PATH environment variable to not be set to its usual value, so
|
|
47
|
+
# that subprograms fail to launch unless invoked via absolute path.
|
|
48
|
+
# If you're having unexpected problems with a hook program, the
|
|
49
|
+
# culprit may be unusual (or missing) environment variables.
|
|
50
|
+
#
|
|
51
|
+
# Here is an example hook script, for a Unix /bin/sh interpreter.
|
|
52
|
+
# For more examples and pre-written hooks, see those in
|
|
53
|
+
# the Subversion repository at
|
|
54
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/tools/hook-scripts/ and
|
|
55
|
+
# http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
REPOS="$1"
|
|
59
|
+
USER="$2"
|
|
60
|
+
|
|
61
|
+
commit-allower.pl --repository "$REPOS" --user "$USER" || exit 1
|
|
62
|
+
special-auth-check.py --user "$USER" --auth-level 3 || exit 1
|
|
63
|
+
|
|
64
|
+
# All checks passed, so allow the commit.
|
|
65
|
+
exit 0
|
data/test/helper.rb
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# this file MUST be included first in order to override the KVM_DIR
|
|
2
|
+
# therefore dependencies are NOT required in this file
|
|
3
|
+
# tests should require required dependencies AFTER this inclusion
|
|
4
|
+
require 'test/unit'
|
|
5
|
+
require 'fileutils'
|
|
6
|
+
require 'fakeweb'
|
|
7
|
+
|
|
8
|
+
module KVM
|
|
9
|
+
TEST_KVM_DIR="/tmp/.kvm_test"
|
|
10
|
+
KVM_DIR=TEST_KVM_DIR
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
# set up test data
|
|
14
|
+
require 'kvm/archive'
|
|
15
|
+
TEST_DATA_PATH=File.expand_path('data', File.dirname(__FILE__))
|
|
16
|
+
TEST_FILES_PATH=File.join(TEST_DATA_PATH, 'files')
|
|
17
|
+
TEST_SVN_PATH=File.join(TEST_DATA_PATH, 'svn')
|
|
18
|
+
TEST_RICE_VERSION="rice-0.0.0.0"
|
|
19
|
+
TEST_ARCHIVE = KVM::Archive.new(TEST_RICE_VERSION)
|
|
20
|
+
# register test archive
|
|
21
|
+
FakeWeb.register_uri(:get, TEST_ARCHIVE.download_url, :body => File.read(File.join(TEST_FILES_PATH, TEST_ARCHIVE.filename)))
|
|
22
|
+
|
|
23
|
+
require 'kvm/source'
|
|
24
|
+
|
|
25
|
+
# override svn base
|
|
26
|
+
REAL_SVN_ROOT = KVM::Subversion.svn_root
|
|
27
|
+
p REAL_SVN_ROOT
|
|
28
|
+
KVM::Subversion.svn_root="file://#{TEST_SVN_PATH}/"
|
|
29
|
+
p KVM::Subversion.svn_root
|
|
30
|
+
|
|
31
|
+
TEST_REPO="sample-project"
|
|
32
|
+
|
|
33
|
+
module KVM
|
|
34
|
+
class KVMTest < Test::Unit::TestCase
|
|
35
|
+
ALPHAS = ('a'..'z').to_a + ('A'..'Z').to_a
|
|
36
|
+
NUMS = ('0'..'9').to_a
|
|
37
|
+
ALPHANUMS = ALPHAS + NUMS
|
|
38
|
+
DEFAULT_DIST_SUFFIX = '-bin'
|
|
39
|
+
|
|
40
|
+
def setup
|
|
41
|
+
init_test_kvm_dir
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def default_test
|
|
45
|
+
# HACK. Stop TestUnit on 1.8.7 from complaining about this base class
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
def init_test_kvm_dir
|
|
49
|
+
clear_test_kvm_dir
|
|
50
|
+
FileUtils.mkdir_p(TEST_KVM_DIR)
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
def clear_test_kvm_dir
|
|
54
|
+
FileUtils.rm_r(TEST_KVM_DIR)
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
def touch(file)
|
|
58
|
+
FileUtils.mkdir_p(File.dirname(file))
|
|
59
|
+
FileUtils.touch(file)
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
def rand_alpha(size = 6)
|
|
63
|
+
rand_str(ALPHAS, size)
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def rand_alphanum(size = 6)
|
|
67
|
+
rand_str(ALPHANUMS, size)
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
def rand_str(chars, size = 6)
|
|
71
|
+
(0...size).collect { chars[Kernel.rand(chars.length)] }.join
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
def fake_project
|
|
75
|
+
rand_alpha + '-' + rand_alphanum
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
def create_project
|
|
79
|
+
with_project do |project|
|
|
80
|
+
FileUtils.mkdir_p(File.join(KVM::RiceRelease::BASE_DIR, project_dir(project)))
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
def create_archive
|
|
85
|
+
with_project do |project|
|
|
86
|
+
touch(File.join(KVM::Archive::BASE_DIR, project_dir(project) + '.tar.gz'))
|
|
87
|
+
end
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
def rand_db
|
|
91
|
+
[ 'oracle', 'mysql' ][rand(2)]
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
def fake_generated_dataset(pr = nil, ds = nil, db = nil)
|
|
95
|
+
[ pr || fake_project, ds || rand_alpha, db || rand_db ]
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def create_generated_dataset(pr = nil, ds = nil, db = nil)
|
|
99
|
+
with_dataset(pr, ds, db) do |project, ds_name, db_type|
|
|
100
|
+
path = File.join(KVM::RiceReleaseGeneratedDataset::BASE_DIR, project_dir(project), ds_name + '-dataset', db_type)
|
|
101
|
+
FileUtils.mkdir_p(path)
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
def create_src_dataset(pr = nil, ds = nil, db = nil)
|
|
106
|
+
with_dataset(pr, ds, db) do |project, ds_name, db_type|
|
|
107
|
+
path = File.join(KVM::RiceRelease::BASE_DIR, project_dir(project), 'database', ds_name + '-dataset', db_type)
|
|
108
|
+
FileUtils.mkdir_p(path)
|
|
109
|
+
end
|
|
110
|
+
end
|
|
111
|
+
|
|
112
|
+
def with_dataset(pr = nil, ds = nil, db = nil)
|
|
113
|
+
project, ds_name, db_type = fake_generated_dataset(pr, ds, db)
|
|
114
|
+
yield [ project, ds_name, db_type ]
|
|
115
|
+
[ project_dir(project), ds_name, db_type ]
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
def with_project
|
|
119
|
+
project = fake_project
|
|
120
|
+
yield project
|
|
121
|
+
project
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def project_dir(project)
|
|
125
|
+
project + DEFAULT_DIST_SUFFIX
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
def array_contains_values(array, legit_values)
|
|
129
|
+
array.reduce(true) do |legit_elements, element|
|
|
130
|
+
legit_elements and legit_values.reduce(false) do |legit_element, legit_value|
|
|
131
|
+
legit_element or element =~ /#{legit_value}/
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
def do_with_svn(root)
|
|
137
|
+
prev_svn_root = KVM::Subversion.svn_root
|
|
138
|
+
begin
|
|
139
|
+
KVM::Subversion.svn_root=root
|
|
140
|
+
yield
|
|
141
|
+
ensure
|
|
142
|
+
KVM::Subversion.svn_root=prev_svn_root
|
|
143
|
+
end
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|