SVNNotify Where is it? how do I find it?

7,450

Solution 1

/usr/local is a traditional Linux/Unix location for "stuff you've installed on your own". If you compile stuff from source and install it, /usr/local is typically used as the main installation directory -- executables go in /usr/local/bin, libraries in /usr/local/lib, etc.

If you're installing stuff from your distribution's package repositories, those files will be placed somewhere else. /usr is the typical system installation directory, so if your package manager has or can get the right package, it will install to /usr/bin, /usr/lib, etc.

Since you don't give a link to the tutorial, I don't know what all you've tried, or how this may conflict with the tutorial directions. But you're looking for the program svnnotify. If you're sure it's already installed, try this:

  1. Run which to see if your system knows the command already, and where it finds it:

    $ which svnnotify
    /usr/bin/svnnotify
    

    If that doesn't find it, there's no command called svnnotify on your PATH, but maybe there's one on the system somewhere that isn't on the PATH.

  2. Check with locate svnnotify.

    $ locate svnnotify
    /usr/example/bin/svnnotify
    /usr/bin/svnnotify
    /usr/share/svnnotify/foo
    ...
    

    If you've installed svnnotify from scratch, your package manager may not know where it is; locate should help. You'll have to take note of nonstandard file locations and tweak the tutorial steps appropriately.

    If you've installed it very recently, run sudo updatedb so locate knows about recent additions to the filesystem.

If those steps don't find the file, make sure you have the package installed, or install it from your favorite package manager (Synaptic, apt-get, aptitude, etc). On Ubuntu 10.04, svnnotify is installed to /usr/bin/svnnotify by the package libsvn-notify-perl. If you're using the Ubuntu svnnotify you'll need to modify the tutorial steps appropriately.


The tutorial shows how to create a post-commit script. You need to modify the script to point to the correct svnnotify. If your system has svnnotify at /usr/bin/svnnotify instead of /usr/local/bin/svnnotify, change the script like so:

#!/bin/sh

REPOS="$1"
REV="$2"

/usr/bin/svnnotify                          \
    --repos-path    "$REPOS"                \
    --revision      "$REV"                  \
    --subject-cx                            \
    --with-diff                             \
    --handler       HTML::ColorDiff         \
    --to            <your e-mail address>   \
    --from          <from e-mail address>

Solution 2

On Ubuntu, svnnotify comes in the libsvn-notify-perl package.

In a terminal, type sudo apt-get install libsvn-notify-perl, which will install svnnotify, and try your script again.

Solution 3

I run it like so:

myuser@linux-server:/usr/local/svn/svn_repo/hooks$ post-commit /usr/local/svn/svn_repo 9

I get this as output:

post-commit: command not found

On Linux and other Unix systems the shell doesn't look for programs in the current working directory by default (for security reasons), so you must run that script like this:

myuser@linux-server:/usr/local/svn/svn_repo/hooks$ ./post-commit /usr/local/svn/svn_repo 9
Share:
7,450
user3746803
Author by

user3746803

Updated on September 17, 2022

Comments

  • user3746803
    user3746803 over 1 year

    I am on ubuntu.

    ok first of all I am running a post-commit script. I need the path to svnnotify to run it. The path the turotial I am reading has it as /usr/local/bin/svnnotify but nothing is in that location on my computer. I tried it anyways and I get something like:

    Warning post-commit hook failed: not found
    

    so I think I need to replace /usr/local/bin/svnnotify with the correct path to svnnotify. Well I do a search (Places>Search for Files) for svnnotify and nothing comes up.

    I know svnnotify is installed becuase if I open a command line and run svnnotify it tells me I am missing the required path argument.

    So how can it be installed if its not in the file system anywhere?

    I don't really know how linux works, its very new to me, so I am confused.

    Is there something I am missing?

    update

    I have updated the file to look like:

    #!/bin/bash
    
    REPOS="$1"
    REV="$2"
    
    /usr/bin/svnnotify --repos-path "$REPOS" --revision "$REV" --subject-cx --with-diff --handler HTML::ColorDiff --to [email protected] --from [email protected]
    

    I made it executable.

    I run it like so:

    myuser@linux-server:/usr/local/svn/svn_repo/hooks$ post-commit /usr/local/svn/svn_repo 9

    I get this as output:

    post-commit: command not found

  • user3746803
    user3746803 almost 14 years
    Thank you. I am on ububtu 10.04 and after running which svnnotify it output /usr/bin/svnnotify. I replaced the path in the tutorial with this path but I still get an error. But I guess that might be better for a new quesiton. By the way FYI here is the tutorial: mikewest.org/2006/06/subversion-post-commit-hooks-101
  • quack quixote
    quack quixote almost 14 years
    @john: no, please update this question with more information instead of posting a new one.
  • quack quixote
    quack quixote almost 14 years
    @john: the tutorial links to svnbook.red-bean.com/nightly/en/… for more info on SVN hooks; seems you need a post-commit.tmpl file to provide this particular hook. apt-file shows a file by that name included in the docbookwiki package, but nothing in the subversion-tools package (where most system-wide SVN hooks are installed from).
  • user3746803
    user3746803 almost 14 years
    I did change that path like in your example. I also tried changing the #!/bin/sh to #!/bin/bash since I am using ubuntu 10.04 and I believe bash is the default shell. But no luck. I also tried manually running the script from a command line and it just says: command not found. My script is just called post-commit with no file extension and its in the hooks folder in the repository where the template hooks are.
  • quack quixote
    quack quixote almost 14 years
    @john: "/bin/sh" is the old bourne shell; all Unixes will have one for script compatibility and such. have you made your script executable? chmod +x scriptname.foo ...
  • user3746803
    user3746803 almost 14 years
    @quack I just tried that. same thing, I also tried double-clicking the file and running it that way which didn't do anything. Could this be because the file is apparently expecting 2 parameters? if so, how do I pass them? Thanks.
  • quack quixote
    quack quixote almost 14 years
    @john: if you're running this script on the commandline, you'd run scriptname arg1 arg2 ... sorry, but svnnotify itself is beyond my area of expertise. you should edit your post to include this new info (that you've corrected the path, script is executable, etc). this script is really just a "wrapper" around the svnnotify command; do you get any errors if you run the same command on the commandline? don't forget all the arguments (just put them all on the same line and skip the backslashes ... that's just to make the script readable).