.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "SVN::Hooks::UpdateConfFile 3pm" .TH SVN::Hooks::UpdateConfFile 3pm "2017-06-24" "perl v5.24.1" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" SVN::Hooks::UpdateConfFile \- Maintain the repository configuration versioned. .SH "VERSION" .IX Header "VERSION" version 1.34 .SH "SYNOPSIS" .IX Header "SYNOPSIS" This SVN::Hooks plugin allows you to maintain the repository configuration files under version control. .PP The repository configuration is usually kept in the directory \f(CW\*(C`conf\*(C'\fR under the directory where the repository was created. In a brand new repository you see there the files \f(CW\*(C`authz\*(C'\fR, \f(CW\*(C`passwd\*(C'\fR, and \&\f(CW\*(C`svnserve.conf\*(C'\fR. It's too bad that these important files are usually kept out of any version control system. This plugin tries to solve this problem allowing you to keep these files versioned under the same repository where they are used. .PP It's active in the \f(CW\*(C`pre\-commit\*(C'\fR and the \f(CW\*(C`post\-commit\*(C'\fR hooks. .PP It's configured by the following directive. .ie n .SS "\s-1UPDATE_CONF_FILE\s0(\s-1FROM, TO,\s0 @ARGS)" .el .SS "\s-1UPDATE_CONF_FILE\s0(\s-1FROM, TO,\s0 \f(CW@ARGS\fP)" .IX Subsection "UPDATE_CONF_FILE(FROM, TO, @ARGS)" This directive makes that after a successful commit in which the file \&\s-1FROM,\s0 under version control, have been added or modified, its newest version is copied to \s-1TO.\s0 .PP \&\s-1FROM\s0 can be a string or a qr/Regexp/ specifying the file path relative to the repository's root (e.g. \*(L"trunk/src/version.c\*(R" or \&\*(L"qr:^conf/(\ew+).conf$:\*(R"). .PP \&\s-1TO\s0 must be a relative path indicating where the original file must be copied to below the \f(CW\*(C`/repo/conf\*(C'\fR directory in the server. It can be an explicit file name or a directory, in which case the basename of \s-1FROM\s0 is used as the name of the destination file. Non-existing directory components of \s-1TO\s0 are automatically created. .PP Note that if the path doesn't exist the hook assumes that it should be a file. To make sure it's understood as a directory you may end it with a forward slash (/). .PP If \s-1FROM\s0 is a qr/Regexp/, \s-1TO\s0 is evaluated as a string in order to allow for the interpolation of capture buffers from the regular expression. This is useful to map the copy operation to a different directory structure. For example, this configuration \&\*(L"qr:^conf/(\ew+).conf$: => '$1.conf'\*(R" updates any .conf file in the repository conf directory. .PP The optional \f(CW@ARGS\fR must be a sequence of pairs like these: .IP "validator => \s-1ARRAY\s0 or \s-1CODE\s0" 4 .IX Item "validator => ARRAY or CODE" A validator is a function or a command (specified by an array of strings that will be passed to the shell) that will check the contents of \s-1FROM\s0 in the pre-commit hook to see if it's valid. If there is no validator, the contents are considered valid. .Sp The function receives three arguments: .RS 4 .IP "A string with the contents of \s-1FROM\s0" 4 .IX Item "A string with the contents of FROM" .PD 0 .IP "A string with the relative path to \s-1FROM\s0 in the repository" 4 .IX Item "A string with the relative path to FROM in the repository" .IP "An SVN::Look object representing the commit transaction" 4 .IX Item "An SVN::Look object representing the commit transaction" .RE .RS 4 .PD .Sp The command is called with three arguments: .IP "The path to a temporary copy of \s-1FROM\s0" 4 .IX Item "The path to a temporary copy of FROM" .PD 0 .IP "The relative path to \s-1FROM\s0 in the repository" 4 .IX Item "The relative path to FROM in the repository" .IP "The path to the root of the repository in the server" 4 .IX Item "The path to the root of the repository in the server" .RE .RS 4 .RE .IP "generator => \s-1ARRAY\s0 or \s-1CODE\s0" 4 .IX Item "generator => ARRAY or CODE" .PD A generator is a function or a command (specified by an array of strings that will be passed to the shell) that will transform the contents of \s-1FROM\s0 in the post-commit hook before copying it to \s-1TO.\s0 If there is no generator, the contents are copied as is. .Sp The function receives the same three arguments as the validator's function above. .Sp The command is called with the same three arguments as the validator's command above. .IP "actuator => \s-1ARRAY\s0 or \s-1CODE\s0" 4 .IX Item "actuator => ARRAY or CODE" An actuator is a function or a command (specified by an array of strings that will be passed to the shell) that will be invoked after a successful commit of \s-1FROM\s0 in the post-commit hook. .Sp The function receives the same three arguments as the validator's function above. .Sp The command is called with the same three arguments as the validator's command above. .IP "rotate => \s-1NUMBER\s0" 4 .IX Item "rotate => NUMBER" By default, after each successful commit the \s-1TO\s0 file is overwritten by the new contents of \s-1FROM.\s0 With this option, the last \s-1NUMBER\s0 versions of \s-1TO\s0 are kept on disk with numeric suffixes ranging from \f(CW.0\fR to \&\f(CW\*(C`.NUMBER\-1\*(C'\fR. This can be useful, for instance, in case you manage to commit a wrong authz file that denies any subsequent commit. .IP "remove => \s-1BOOL\s0" 4 .IX Item "remove => BOOL" By default, if \s-1FROM\s0 is \fBdeleted\fR in the commit, nothing happens to \&\s-1TO.\s0 If you want to have the file \s-1TO\s0 removed from the repository when \&\s-1FROM\s0 is deleted, set this option to a true value such as '1'. .PP .Vb 7 \& UPDATE_CONF_FILE( \& \*(Aqconf/authz\*(Aq => \*(Aqauthz\*(Aq, \& validator => [\*(Aq/usr/local/bin/svnauthcheck\*(Aq], \& generator => [\*(Aq/usr/local/bin/authz\-expand\-includes\*(Aq], \& actuator => [\*(Aq/usr/local/bin/notify\-auth\-change\*(Aq], \& rotate => 2, \& ); \& \& UPDATE_CONF_FILE( \& \*(Aqconf/svn\-hooks.conf\*(Aq => \*(Aqsvn\-hooks.conf\*(Aq, \& validator => [qw(/usr/bin/perl \-c)], \& actuator => sub { \& my ($contents, $file) = @_; \& die "Can\*(Aqt use Gustavo here." if $contents =~ /gustavo/; \& }, \& rotate => 2, \& ); \& \& UPDATE_CONF_FILE( \& qr:/file(\en+)$:\*(Aq => \*(Aqsubdir/$1/file\*(Aq, \& rotate => 2, \& remove => 1, \& ); .Ve .SH "AUTHOR" .IX Header "AUTHOR" Gustavo L. de M. Chaves .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2016 by CPqD . .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.