顯示具有 SVN 標籤的文章。 顯示所有文章
顯示具有 SVN 標籤的文章。 顯示所有文章

2015年12月22日 星期二

Mantis mail sending log for debug

Reference:
Not send email

modify config_defaults_inc.php or add these to config_inc.php.
$g_log_level = LOG_EMAIL;
$g_log_destination = 'file:c:/temp/maillog.txt';


2015年7月29日 星期三

SVN (Subversion) install on Windows 2012 R2

Reference:
[研究] Win32Svn 1.8.0-1 架設(Windows 2008 R2)
How to Install Apache 2.4 MySQL and PHP on Windows Server 2012 R2

因為 svn for Windows 有好幾個版本,我採用 Win32Svn 因為它比較不像商業版,但它只有 32bit 版本。所以 Apache 也必須用 32bit 版本。

1. download Apache 2.4 Win32. 它需要事先安裝 Visual C++ Redistributable (也是用 x86 版本)
2. download Win32Svn 1.8
3. 解壓縮 Apache 2.4,用 Apache24\bin\httpd.exe -k install 安裝 service。
4. 修改 Apache24\conf\httpd.conf

  • Listen 8080    # 因為 port 80 被 IIS 用掉了
  • 將以下這兩行最前面的 # 刪除
    • LoadModule dav_module modules/mod_dav.so 
    • LoadModule dav_fs_module modules/mod_dav_fs.so
  • 加入以下兩行(放在 mod_dav.so 之後) (檔案路徑請依 Subversion 實際安裝位置調整)
    • LoadModule dav_svn_module "C:\Program Files (x86)\Subversion\bin\mod_dav_svn.so" 
    • LoadModule authz_svn_module "C:\Program Files (x86)\Subversion\bin\mod_authz_svn.so"
  • 在檔案最後面加入

2014年5月7日 星期三

SVN commit fail

狀況:
SVN server installed on Windows.
SVN client commit fail.

原因:
Apache 會認大小寫,checkout 時不會檢查,但 commit 會檢查大小寫。

解法:
SVN client 用正確的英文大小寫路徑重新 checkout 到另一個目錄,再做 commit 即可。

2014年1月29日 星期三

svn repository rename

我的 SVN 是透過 Apache 存取,所以只更換目錄名稱和 svn 設定檔即可。

1. mv /snv/old_name /svn/new_name
2. Edit svn-authz-file. Replace old_name with new_name.

就這樣而已。

2013年6月5日 星期三

SVN command line

reference:
http://www.tigris.org/scdocs/ddUsingSVN_command-line

Create a new directory on repository by command:
svn mkdir URL -m "create directory" --username USER --password PASSWORD

2012年12月25日 星期二

Apache httpd configuration for Subversion (SVN)


  • Enable httpd by vi /etc/httpd/conf/httpd.conf
    • ServerAdmin my_e_mail@domain.com
    • ServerName my_host:80
  • config subversion by vi /etc/httpd/conf.d/subversion.conf
    • <Location /my_svn>
    •    DAV svn
    •    SVNParentPath /data/svn
    •       AuthType Basic
    •       AuthName "Authorization repository"
    •       AuthUserFile /data/svn/svn-passwd-file
    •       AuthzSVNAccessFile /data/svn/svn-authz-file
    •       Require valid-user
    • </Location>
  • service https restart

剛安裝好的 Apache,裡面的 ssl 憑證有效期只有一年,請參考這一篇製作更長的有效憑證。
http://linux.vbird.org/linux_server/0360apache.php#www_ssl

2012年8月23日 星期四

SVN log message modification

SVN commit 後預設是不能修改 log message。
修改 log message 會出現錯誤訊息:

DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent
At least one property change failed; repository is unchanged

解法:
For Windows:
在 hooks目錄下新增 pre-revprop-change.bat,檔案內容如下。

rem Only allow log messages to be changed.
if "%4" == "svn:log" exit 0
echo Property '%4' cannot be changed >&2
exit 1


For Linux:
在 hooks目錄下新增 pre-revprop-change 並 chmod 755,檔案內容如下。

REPOS="$1"
REV="$2"
USER="$3"
PROPNAME="$4"

if [ "$PROPNAME" = "svn:log" ]; then exit 0; fi
exit 1


參考:
http://wmhuang.pixnet.net/blog/post/18657530-subversion-%E4%B8%8D%E8%83%BD%E4%BF%AE%E6%94%B9%E7%B4%80%E9%8C%84%E8%A8%8A%E6%81%AF

2012年8月21日 星期二

CentOS 4.8 yum update fail and solution

Reference:
http://www.linuxquestions.org/questions/linux-software-2/help-centos-here-4-8-final-946734/

CentOS 4.8 yum update subversion error message:

not using ftp, http[s], or file for repos, skipping - 4 is not a valid release or hasnt been released yet
Cannot find a valid baseurl for repo: update
Error: Cannot find a valid baseurl for repo: update

Solution:
1. edit /etc/yum.repos.d/CentOS-Base.repo
2. add baseurl=http://vault.centos.org/4.9/updates/$basearch/

結果:
subversion 可以更新,但是... 只更新到 subversion-1.1.4-4.el4_8。因為 CentOS 4.8 已經不維護了,這樣的更新就沒意義了。
還是自己抓 subversion for CentOS 4.x RPM回來安裝吧。

2012年2月23日 星期四

SUBVERSION (SVN) NOTIFY FOR WINDOWS simple configuration

Home page: http://subversionnotify.com/default.aspx
Download Link: http://sourceforge.net/projects/svn-notify/
Manual: http://subversionnotify.com/Documents/SubversionNotify_Manual.htm

Install:
  1. Download the latest version of Subversion Notify from SourceForge.net
  2. Unzip the package into the directory of your choice
  3. Copy the included pre-commit.bat, post-commit.bat and pre-revprop-change.bat to the hooks folder of your repository
  4. Edit the batch files to correctly reflect the installation location of the SubversionNotify.exe file you just extracted.

Configure the SubversionNotify.cfg file. Copy the following to  SubversionNotify.cfg. Then modify the blue part.

<?xml version="1.0" standalone="yes"?>
<subversionNotifyConfig xmlns="http://www.mckechney.com/SubversionNotifyConfig.xsd" LoggingLevel="INFO" MaximumEMailSizeInMb="5" MaximumEmailSubjectChars="255">
    <!-- Basic configuration of where to locate the SVN executables -->
    <SVNConfig ExePath="C:\Program Files\Subversion\bin\svnlook.exe" />
     
    <!-- Configure your mail server. Needed for e-mail notifications -->
    <MailServer Name="smtp.mydomain.com" Username="" Password="" ADGlobalCatalog="mydomain.com" FromAddress="fromaddress@mydomain.com"/>
     
    <!-- An example 2-types of e-mail: to a specific user and to a distribution group. Also demonstrates custom e-mail formats.-->
    <RepoPathConfig ControlledPaths="/">
       <MailTo EMailGroupName="Managers"  EMailType="HTML" />
   </RepoPathConfig>


    <EMailGroup Name="Managers">
        <EMail Address="email3@mydomain.com" />
        <EMail Address="email4@mydomain.com" />
    </EMailGroup>


</subversionNotifyConfig>

2012/08/17 update:
SVN 發 mail 的觸發點是靠 Repository 裡面的 hooks。
如果是 commit 後的動作,必須修改 post-commit.bat。
在 batch file 可以指定用某一個路徑的 SubversionNotify.exe,如果有多份 SubversionNotify.exe 就必須各自修改 SubversionNotify.cfg。

2012年2月17日 星期五

Apache + SVN (Subversion) + AD (ActiveDirectory) authentication

Reference: http://blog.csdn.net/bamboo_ding/article/details/4283259

Install Apache, SVN first. Please read this page.

Edit Apache httpd.conf

  • Enable these modules (delete #)
    • LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
    • LoadModule ldap_module modules/mod_ldap.so
    • LoadModule authz_user_module modules/mod_authz_user.so
  • Add Location to the bottom of  httpd.conf as following
<Location /> 
  DAV svn 
  SVNParentPath "D:\SVNProj" 
  # how to authenticate a user 
  AuthBasicProvider ldap
  AuthzLDAPAuthoritative on
  AuthType Basic 
  AuthName "Subversion repository" 
  AuthLDAPURL "ldap://myhost.example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)" NONE
  AuthLDAPBindDN "LDAPadmin@example.com"
  AuthLDAPBindPassword "my-passwd"
  # only authenticated users may access the repository 
  Require valid-user 
  # our access control policy 
  AuthzSVNAccessFile "D:\SVNProj\authz.ini" 
</Location>

Create an new account LDAPadmin in AD.

2015/7/23 update
configure multiple LDAP server
Reference:
Redundant LDAP servers in Apache
Apache Module mod_authn_core

<AuthnProviderAlias ldap ldap1>
 AuthLDAPURL "ldap://myhost1.example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)" NONE
  AuthLDAPBindDN "LDAPadmin@example.com"
  AuthLDAPBindPassword "my-passwd"
</AuthnProviderAlias>
<AuthnProviderAlias ldap ldap2>
 AuthLDAPURL "ldap://myhost2.example.com:389/DC=example,DC=com?sAMAccountName?sub?(objectClass=*)" NONE
  AuthLDAPBindDN "LDAPadmin@example.com"
  AuthLDAPBindPassword "my-passwd"
</AuthnProviderAlias>

<Location />
  DAV svn

  SVNParentPath "D:\SVNProj"

  # how to authenticate a user
  AuthType Basic
  AuthName "Subversion repository"

  AuthBasicProvider ldap1 ldap2
  LDAPReferrals Off

  # only authenticated users may access the repository
  Require valid-user

  # our access control policy
  AuthzSVNAccessFile "D:\SVNProj\authz.ini"
</Location>

SVN (Subversion) install on Windows

Reference:
http://www.dotblogs.com.tw/walter/archive/2009/10/07/install-subversion-with-apache-in-windows.aspx
http://blog.liangkuo.org/2007/03/svn-subversion-tortoisesvn.html

Step1. Download Apache 2.2.x (no ssl)
http://httpd.apache.org/download.cgi

Step2.Download Subversion 1.6.x binary
http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=91
http://subversion.apache.org/packages.html
也可以download source code自己做成binary
http://subversion.apache.org/download/

Step3. Download SVN client TortoiseSVN
http://tortoisesvn.net/downloads

Step 4. install Apache
安裝就一直下一步就裝好了。

Step5. config Apache
開啟C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf
  • 如果要改port,請修改這一行Listen 80
  • 將以下這兩行最前面的 # 刪除
    • LoadModule dav_module modules/mod_dav.so 
    • LoadModule dav_fs_module modules/mod_dav_fs.so
  • 加入以下兩行(放在 mod_dav.so 之後) (檔案路徑請依 Subversion 實際安裝位置調整)
    • LoadModule dav_svn_module "C:/Program Files/Subversion/bin/mod_dav_svn.so" 
    • LoadModule authz_svn_module "C:/Program Files/Subversion/bin/mod_authz_svn.so"
  • 在檔案最後面加入
<Location />
  DAV svn

  #控管檔的存放位置根資料夾
  SVNParentPath "D:\SVNProj"

  # how to authenticate a user
  AuthType Basic
  AuthName "Subversion repository"

  #進行帳號驗證時的帳號、密碼資料
  AuthUserFile "D:\SVNProj\passwd.ini"

  # only authenticated users may access the repository
  #操作時要進行帳號驗證,拿掉此行就不會進行驗證
  Require valid-user

  # our access control policy
  # authz.ini 是設定帳號對各 Project 可讀/寫權限的設定檔
  AuthzSVNAccessFile "D:\SVNProj\authz.ini"
</Location>

Step 6. install SVN
將svn-win32-1.6.x解壓縮到C:\Program Files\Subversion

Step 7. config SVN
修改環境變數PATH,加入C:\Program Files\Subversion\bin;C:\Program Files\Apache Software Foundation\Apache2.2\bin
新增環境變數APR_ICONV_PATH,內容為C:\Program Files\Subversion\iconv,以支援非英語地區

Step 8. Create project
開啟命令提示字元(Command Prompt),切換到D:\SVNProj
svnadmin create Project1

Step 9. Create account, password
htpasswd -c passwd.ini [帳號]

Step 10. 設定權限
新增D:\SVNProj\authz.ini,內容如下

# 先定義群組
[groups]
developer = user1,user2,user3
art = user4
everyone = *
# 預設拒絕所有人進入瀏覽
[/]
* =
# 設定儲存庫訪問權限,語法:[儲存庫:專案路徑]
[Project1:/]
# developer可讀寫
@developer=rw
# art僅可讀取
@art=r

Step 11. 測試SVN (先restart Apache)
用IE開啟http://localhost/Project1會出現帳號密碼驗證。
如果出現錯誤訊息,可以查看C:\Program Files\Apache Software Foundation\Apache2.2\logs\error.log。

2011年7月15日 星期五

Subversion SVN commit log 自動寄信通知

參考
  1. cd /svn/[your project]/hooks
  2. cp post-commit.tmpl post-commit
  3. chmod 755 post-commit
  4. 編輯post-commit設定寄信工具
  5. 如果要顯示中文要在post-commit裡面加上 export LANG="en_US.UTF-8"
post-commit的寄信工具
  1. commit-email.pl
    • /[path of svn tools]/commit-email.pl "$REPOS" "$REV" receiver@yourdomain
    • path of svn tools可以用 rpm -ql subversion-tools | grep commit-email.pl 查到
  2. mailer.py
    • /[path of svn tools]/mailer.py "$REPOS" "$REV"
    • path of svn tools可以用 rpm -ql subversion-tools | grep mailer.py 查到
    • 設定mailer.py的config檔
      • cd /[path of svn tools]
      • cp mailer.conf.example mailer.conf
    • 修改mailer.conf
如果要做到符合條件的commit才寄mail,請參考以下的mailer.conf。
[Project_1]
for_repos = (?P<Project_1>)    # Project_1 是 repository name
for_paths = ^data($|/.*)             # 最上層是 data 的目錄
to_addr = aaa@example.com, bbb@example.com

[Project_2]
for_repos = (?P<Project_2>)
for_paths = ^bin($|/.*)
to_addr = ccc@example.com, ddd@example


2011年5月24日 星期二

CentOS 5.6 rapidsvn install 補充

參考 http://fendertech.blogspot.com/2010/07/how-to-install-rapidsvn-on-centos.html 安裝rapidsvn。
步驟:
1. yum install subversion
2. rpm -ivh wxGTK-2.8.9-1.el5.rf.i386.rpm
3. rpm -ivh rapidsvn-0.9.6-2.el5.rf.i386.rpm

安裝沒問題,但是 "checkout new working copy" 會出現 segmentation fault。

問題點在於 subversion 版本,用 yum 會安裝最新版 1.6,但是這個版本和 rapidsvn 不合。
參考 http://www.mail-archive.com/users@lists.rpmforge.net/msg02217.html。
將 subversion 改為 1.46 就可以了。