You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Tom Browder <to...@gmail.com> on 2018/06/19 23:39:09 UTC

Hook script common environment variables

The docs mention one can use a common hook environment for multiple repos
but so far I can’t find an example of that or any more details. I have
looked at the example hook.env file but I don’t see any reference to global
env vars.

I know I can have each hook script, say as a bash script, source a global
file but surely there is a more elegant way to set global variables used by
hook scripts.

Thanks for any help.

Best regards,

-Tom

Re: Hook script common environment variables

Posted by Bo Berglund <bo...@gmail.com>.
On Tue, 19 Jun 2018 18:39:09 -0500, Tom Browder
<to...@gmail.com> wrote:

>The docs mention one can use a common hook environment for multiple repos
>but so far I can’t find an example of that or any more details. I have
>looked at the example hook.env file but I don’t see any reference to global
>env vars.

http://svnbook.red-bean.com/en/1.8/svn.reposadmin.create.html#svn.reposadmin.hooks.configuration.ex-1

and maybe:
http://svnbook.red-bean.com/en/1.8/svn.advanced.confarea.html


-- 
Bo Berglund
Developer in Sweden


Re: Hook script common environment variables

Posted by Tom Browder <to...@gmail.com>.
On Wed, Jun 20, 2018 at 03:02 Stefan Sperling <st...@elego.de> wrote:
>
> On Tue, Jun 19, 2018 at 06:39:09PM -0500, Tom Browder wrote:
>
> > The docs mention one can use a common hook environment for multiple repos
> > but so far I can’t find an example of that or any more details. I have
> > looked at the example hook.env file but I don’t see any reference to global
> > env vars.
>
> It is unclear which type of server are you using.
> Apache HTTPD with mod_dav_svn, or svnserve?
>
> For svnserve, you can specify a path in svnserve's config file:
>   [general]
>   hooks-env = /path/to/a/global/hooks-env/file

Okay, that’s part of what I was looking for. I am using svnserve. However,
according to "man svnserve" I am using it not as a daemon but with svn+ssh
so I have to specify the global file explicitly somehow.

But I can add that common path in each repo’s hook-env, that’s clear.

> The environment specified in the referenced file will then apply

I think that only applies to the daemon as I read the docs.

> to all repositories. The referenced file's syntax is shown in the
> hook.env example you've already found.

That referenced example is for an individual repo.

But if it is true for svn+ssh, does one just drop a svnserv.conf file in
directory /etc/subversion.?

> Could you please point us at the docs you were reading which were
> unclear? Maybe they need to be adjusted or updated.  Thanks.

I’ll send doc suggestions after I get a working solution (PRs accepted?).

Thanks, Stefan.

Best regards,

-Tom

Re: Hook script common environment variables

Posted by Stefan Sperling <st...@elego.de>.
On Tue, Jun 19, 2018 at 06:39:09PM -0500, Tom Browder wrote:
> The docs mention one can use a common hook environment for multiple repos
> but so far I can’t find an example of that or any more details. I have
> looked at the example hook.env file but I don’t see any reference to global
> env vars.

It is unclear which type of server are you using.
Apache HTTPD with mod_dav_svn, or svnserve?

For svnserve, you can specify a path in svnserve's config file:
  [general]
  hooks-env = /path/to/a/global/hooks-env/file

The environment specified in the referenced file will then apply
to all repositories. The referenced file's syntax is shown in the
hook.env example you've alreay found.

For mod_dav_svn there is a similar configuration directive called
SVNHooksEnv which also points to a file.

Could you please point us at the docs you were reading which were
unclear? Maybe they need to be adjusted or updated.  Thanks.