I'm trying to implement svnperms into a repository, but am having difficulty with a few things:
pre-commit has the execute permissions:
-rwxrwxr-x 1 svnadm svn 3018 May 27 10:11 pre-commit
This is my call to svnperms within pre-commit:
# Check that the author of this commit has the rights to perform
# the commit on the files and directories being modified.
SVNPERMS=/usr/local/svn/scripts/svnperms.py
$SVNPERMS -r $REPOS -t $TXN || exit 1
I've got svnperms.py installed in the location specified:
# ls -l /usr/local/svn/scripts
total 24
-rwxrwxr-x 1 svnadm svn 11840 May 25 07:48 svnperms.py
svnperms.py is in UNIX format - no ^M line endings.
TortoiseSVN comes back with:
Command: Commit
Modified: C:\projects\Sandbox\Trunk\Test.txt
Sending content: C:\projects\Sandbox\Trunk\Test.txt
Error: Commit failed (details follow):
Error: 'pre-commit' hook failed with error output:
Error: No such file or directory: python
Calling svnperms with no paramters shows:
/usr/local/svn/scripts/svnperms.py
missing required option(s): repository, either transaction or a revision
Usage: svnperms.py OPTIONS
Options:
-r PATH Use repository at PATH to check transactions
-t TXN Query transaction TXN for commit information
-f PATH Use PATH as configuration file (default is repository
path + /conf/svnperms.conf)
-s NAME Use section NAME as permission section (default is
repository name, extracted from repository path)
-R REV Query revision REV for commit information (for tests)
-A AUTHOR Check commit as if AUTHOR had commited it (for tests)
-h Show this message
The UNIX admin has recently installed python, but wasn't sure if all the dependencies are there. If that's the issue, I'm not sure how to determine that, since python seems to be working based on the output above.
What am I missing?
My guess is that the location of the python
binary is not in $PATH
for the svn server. The shabang line of svnperms.py
reads:
#!/usr/bin/env python
But that assumes that the executable lies in the $PATH
of the caller. If you don't have permissions to modify the runtime environment of your subversion server, try replacing python
in the shabang line with the path given by which python
when you run it interactively.
来源:https://stackoverflow.com/questions/916758/set-up-svnperms-pre-commit-hook