每一個專案的 trac.ini 有很多相同的地方,所以把相同的地方寫在一個檔案,再利用 inherit file 方式加到 trac.ini,就不用每次寫一堆了。新增一個檔案 /var/trac/trac.ini,寫入下列資料。

[components] # Subversion tracopt.versioncontrol.svn.* = enabled tracopt.ticket.commit_updater.* = enabled # TracWiki WYSIWYG Editor Plugin tracwysiwyg.* = enabled # Trac Ticket Template Plugin tickettemplate.* = enabled # CC selector plugin cc_selector.* = enabled # Account Manager Plugin acct_mgr.admin.* = enabled acct_mgr.api.* = enabled acct_mgr.htfile.htpasswdstore = enabled acct_mgr.notification.* = enabled acct_mgr.pwhash.* = enabled acct_mgr.web_ui.* = enabled acct_mgr.web_ui.resetpwstore = disabled trac.web.auth.loginmodule = disabled [cc_selector] show_fullname = true username_blacklist = [tickettemplate] field_list = summary, description, reporter, owner, priority, cc, milestone, component, version, type enable_custom = true [account-manager] htpasswd_file = /var/svn/account htpasswd_hash_type = md5 password_store = HtPasswdStore register_check =
  • su
    登入 root 帳號
  • svnadmin create /var/svn/proj-test
    建立 proj-test 專案
  • chown -R www-data.www-data /var/svn
    重新設定 svn repository 目錄擁有者為 www-data,這樣才可以用 http 讀寫。
  • cp /var/svn/proj-test/hooks/post-commit.tmpl /var/svn/proj-test/hooks/post-commit
  • vi /var/svn/proj-test/hooks/post-commit
    修改 post-commit,在檔案尾加入下列文字。 export PYTHON_EGG_CACHE="/tmp/.python-eggs" trac-admin /var/trac/proj-test changeset added "$REPOS" "$REV"
  • cp /var/svn/proj-test/hooks/post-revprop-change.tmpl /var/svn/proj-test/hooks/post-revprop-change
  • vi /var/svn/proj-test/hooks/post-revprop-change
    修改 post-revprop-change,在檔案尾加入下列文字。 export PYTHON_EGG_CACHE="/tmp/.python-eggs" trac-admin /var/trac/proj-test changeset modified "$REPOS" "$REV"
  • trac-admin /var/trac/proj-test initenv
    建立 proj-test 專案
  • vi /var/trac/proj-test/conf/trac.ini
    修改 trac.ini,加入 [repositories] 區段,並在 [inherit] 加入一行指令。[inherit] file = /var/trac/trac.ini [repositories] .dir = /var/svn/proj-test .description = Project Test .type = svn .url = http://192.168.0.105/svn/proj-test .sync_per_request = false
  • chown -R www-data.www-data /var/trac
    重新設定 trac 專案目錄擁有者為 www-data,這樣才可以用 http 讀取。
  • trac-admin /var/trac/proj-test upgrade
    更新 proj-test 專案
  • trac-admin /var/trac/proj-test repository resync "*"
    重新同步 svn 資料,.sync_per_request 設定為 false,svn 資料並不會同步到 trac,所以必須手動做一次 resync,trac 才會抓到最新資料。
  • trac-admin /var/trac/proj-test permission add admin TRAC_ADMIN
    在 proj-test 專案新增一個使用者 admin 權限為管理者
  • trac-admin /var/trac/proj-test permission remove anonymous '*'
    在 proj-test 專案移除匿名使用者的所有權限

問題排除

  • proj-test: Error (Error reading '/var/trac/proj-test/conf/trac.ini', make sure it is readable.)
    少做了一步 chown -R www-data.www-data /var/trac
  • proj-test: Error (The Trac Environment needs to be upgraded. Run "trac-admin /var/trac/proj-test upgrade")
    少做了一步 trac-admin /var/trac/proj-test upgrade
  • # svn commit -m "add first file" Authentication realm: <http://127.0.0.1:80> SVN Repository Password for 'admin': ****** svn: E000013: Commit failed (details follow): svn: E000013: Can't open file '/var/svn/proj-test/db/txn-current-lock': Permission denied
    少做了一步 trac-admin /var/trac/proj-test upgrade

台南小新 發表在 痞客邦 PIXNET 留言(0) 人氣()