从Subversion存储库实现强大的自动化。

svnpublish的Python项目详细描述


欢迎使用svnpublish,这是一个启用自动发布(和 任何其他要执行的任意命令)。 Subversion版本控制存储库。

发布配置绑定到整个存储库或 仅限于子目录,在中称为publishing point 发表演说。

tl;dr

安装:

$ pip install svnpublish
$ mkdir -p /etc/svnpublish
$ svnpublish --init-options > /etc/svnpublish/myrepos.yaml

# edit the self-documenting configuration file:
$ vi /etc/svnpublish/myrepos.yaml

放入REPOSITORY/hooks/post-commit

#!/bin/sh
svnpublish --options /etc/svnpublish/myrepos.yaml "$@"

如果以异步模式运行(推荐):

$ apt-get install daemontools-run

# create the service directory with the user:group that runs svnpublish
$ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data

# review the output and adjust the service configuration:
$ vi /etc/service/svnpublishd/run /etc/service/svnpublishd/log/run

# grant the user running svnpublish access to HUP the service
# (this assumes that "#includedir /etc/sudoers.d" is in "/etc/sudoers.d",
#  that the user is www-data, and that svc is located in /usr/bin)
$ echo"www-data ALL = NOPASSWD: /usr/bin/svc -h /etc/service/svnpublishd" > /etc/sudoers.d/svnpublishd
$ chmod 440 /etc/sudoers.d/svnpublishd

# start the service
$ rm -f /etc/service/svnpublishd/down
$ svc -u /etc/service/svnpublishd

然后将“–async”选项添加到svnpublish(确保 servicedir选项在svnpublish“options.yaml”中设置正确 文件)。扩展上面的例子,新的post commit钩子应该 看起来像:

#!/bin/sh
svnpublish --options /etc/svnpublish/myrepos.yaml --async "$@"

注意:建议将日志目录移动到 系统适当的位置-请参阅 /etc/service/svnpublishd/log/run

概述

TOdo:添加文档

全局配置

设置初始svnpublish选项的最佳方法是使用 --init-options标志,它输出所有可用选项的列表 随附文件。建议的方法是 /etc/svnpublish/中的每个存储库配置可以是 操作如下:

$ sudo mkdir -p /etc/svnpublish
$ svnpublish --init-options | sudo tee /etc/svnpublish/REPOSITORY.yaml > /dev/null
$ sudo vi /etc/svnpublish/REPOSITORY.yaml

然后根据需要修改所有选项。至少, 应设置以下选项:

  • 管理员
  • 标签
  • 姓名
  • 回复
  • genemail.default.headers.from

发布点配置

TOdo:添加文档

publish:ENGINE:ATTRIBUTE:VALUE

示例:

publish:# send an email notification-engine:emailmailfrom:noreply@example.comrecipients:-user1@example.com-user2@example.com# update an RSS (atom) feed-engine:rsswindow:50label:Repository Feedoutput:/var/www/rss/output.xmlfeedUrl:https://svn.example.com/rss/output.xml# export the repository to the file system-engine:exportpath:/var/www/example.comfixate:-{ engine:fingerprint}-{ engine:fingerprint, path:htdocs/fingerprint}# export the repository to a remote host-engine:exportremote:svnpublish@example.comkeychain:/home/svnpublish/.keychainpath:/var/www/example.comfixate:-{ engine:fingerprint}-{ engine:fingerprint, path:htdocs/fingerprint}

加密电子邮件

svnpublish可以配置为发送pgp加密的电子邮件,其中 保护电子邮件内容不被意外读取 收件人。按照中的说明操作 https://pypi.python.org/pypi/genemail要设置gpg主目录, 然后调整svnpublish“options.yaml”文件以包含 PGP修改器。例如:

# ... other configurations ...genemail:modifier:class:'genemail.PgpModifier'sign:'noreply@example.com'gpg_options:gnupghome:'/path/to/gpghome'

异步操作

svnpublish可以在异步模式下运行(推荐的方法)。 这意味着提交发生得很快,并且是一个异步进程 然后负责执行发布。这个异步的 进程svnpublishd已调整为由DJB运行 daemontools。基于debian的 系统、Daemontools可以轻松安装:

$ apt-get install daemontools-run

svnpublishd服务目录可以由 调用svnpublishd --init-service OPTIONS,这将创建 目录、“运行”脚本和所需的默认日志记录选项 要运行svnpublishd,请为指定用户定制:组 svnpublish运行方式。确保此用户:组设置很重要 是正确的,否则svnpublish和svnpublishd不能 沟通。svnpublish通常运行的user:group Subversion存储库的所有者。例如,如果您的svnpublish 作为www data:www data运行,则类似这样的操作应该可以:

$ svnpublishd --init-service --service-dir /etc/service/svnpublishd --user www-data:www-data

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在Spring工具套件中找到Spring版本?   是否有API将vSphere JSON结果映射到适当的Java对象?   java在spring WebSocket中有请求作用域吗?(websocket scop==会话范围)   java我想从list1中删除list2元素并返回list1   java使用JPA/Hibernate为单个集合使用多个@Where   JSF2.0中混合Ajax和完整请求的java   java变量miles可能尚未初始化   java使用文件路径StringArray构建父子数组   java数据源在struts中不起作用   java从另一个类访问txtField值   具有相同主键和外键双向关系的java Hibernate实体OneToOne   java Android广播接收器:上下文问题   java我可以将实体指定为数据存储属性以实现类似joinlike的功能吗?   java如何排除hadoop核心依赖项   java是否可以确定用户是否实时单击了任何通知(不仅仅是来自我的应用程序)?   java在单独的类中访问私有变量?   java如何使用Spring@Value注入映射