轉貼 HOWTO: smooth CVS to SVN migration (and back again)

This page explains how I migrated the VideoLAN CVS repositories to Subversion while still allowing anonymous CVS access for users who did not want to move to Subversion. If you are a CVS user and have not yet fallen in love with Subversion, I suggest you have a look at this excellent project. In fact, I recommend to be familiar with Subversion before reading this document, because I may have missed important things.

The idea is to migrate the CVS repository to a Subversion repository using cvs2svn, disable CVS accounts (except read-only accounts such as anonymous) and set up post-commit hooks to replicate SVN commits back to the CVS repository.

First step: cvs2svn

Here are the preparatory steps to migrate a CVS module wooyay from the CVS root /cvs/stuff to a new SVN repository /svn/wooyay:

$ svnadmin create /svn/wooyay
$ cvs2svn -s /svn/wooyay /cvs/stuff/wooyay
$ svn ls file:///svn/wooyay
branches/
tags/
trunk/
$

That’s all! Your SVN repository is created. The default layout is a bit special but quite handy: tags are in tags/, branches are in branches/, and HEAD is trunk.

Don’t forget to backup your old CVS tree! It might be useful if something ever gets wrong.

Repository cleaning

Now that your repository is created, you can use Subversion’s magical powers to do whatever you want to the repository, such as removing and renaming branches or tags. These steps are not mandatory but you might find them convenient.

CVS branch names cannot start with a digit or contain periods, and you end up with branches called v1_2_3 instead of 1.2.3. And I don’t like that. Here is an example of what I would do:

$ svn ls file:///svn/wooyay/branches
test/
v1_0/
v2_0/
$ svn rm file:///svn/wooyay/branches/test -m "removed branch"
$ svn mv file:///svn/wooyay/branches/v1_0 file:///svn/wooyay/branches/1.0 -m "renamed branch"
$ svn mv file:///svn/wooyay/branches/v2_0 file:///svn/wooyay/branches/2.0 -m "renamed branch"
$ svn ls file:///svn/wooyay/branches
1.0/
2.0/
$

I also like to import .cvsignore files to Subversion properties and set the "Id" keyword properties for files containing the "$Id:" special string. If your repository is big, you might want to do this change only for trunk/ and the still active branches.

$ svn checkout file:///svn/wooyay/trunk workingdir
$ cd workingdir/
$ find -name .cvsignore | while read file; do
    svn propset svn:ignore "`cat "$file"`" "`echo "$file" | sed 's,/[^/]*$,,'`"
  done

$ find . -type f -a '(' -path '*/.*' -prune -o -print ')' | while read file; do
    if grep -q '\$Id:' "$file" && ! svn propget svn:keywords "$file" | grep -q '^Id$'; then svn propset svn:keywords Id "$file"; fi
  done

$ svn commit -m "imported svn:ignore and svn:keywords properties"
$

The post-commit hook

This is the important part. My svn_cvsinject script can be used to reinject SVN commits into the old CVS directory. Use option -r to specify the revision to reinject, and -a to do branch aliases. In our example, this would be the contents of the /svn/wooyay/hooks/post-commit file:

#!/bin/sh
REPOS="$1"
REV="$2"
svn_maillog "$REPOS" "$REV" "svn@localhost" "sam@localhost"
svn_cvsinject -r "$REV" "$REPOS" "/cvs/stuff/wooyay" \
    -a "1.0/v1_0" -a "2.0/v2_0" &
exit 0

It is advisable to run svn_cvsinject in the background because it can take a long time to finish. Also, make sure that all users with commit rights (including the user svnserve might run as) have write permissions on the CVS repository.

Here are the current svn_cvsinject features:

  • support for file creation and removal
  • support for directory creation and removal
  • support for simultaneous commits in different branches
  • support for branch aliases

However, it also has the following current limitations:

  • no support for new branches
  • no user mapping when run from svnserve (but the user is mentioned in the commit log)
  • concurrent calls may break things (use locks)
  • poor error handling

Conclusion

It works for me (tm), but I’d be happy to learn of other successful installations. And please tell me of failures as well, so that I can fix bugs!

If your CVS repository ever gets corrupted, you can reinject every SVN commit by restoring your backuped CVS tree and calling svn_cvsinject again for every revision since you used cvs2svn


docbook 配合 自訂的 css 輸出

以 ubuntu 為例:

修改

/usr/share/sgml/docbook/stylesheet/dsssl/modular/html/docbook.dsl

...
(define all-element-number
(external-procedure "UNREGISTERED::James Clark//Procedure::all-element-number"))
; 從這開始
(define %stylesheet%
"docbook.css")

(define %stylesheet-type%
"text/css")
; 到這結束
(root
(make sequence ...
...

撰寫 docbook.css ,放在目標文件下

參考文件 :

http://www.powermag.com.tw/docbook/book1.htm


unable to load php_ldap.dll on php5.x

php_ldap.dll needs the following dlls:

ssleay32.dll
libeay32.dll

Copy them to the system32 directory.


20 pro tips

Tips and tricks you should be using to give your work that all-important professional edge.

http://www.netmag.co.uk/zine/design-tutorials/20-pro-tips


lifetype 使用者註冊問題

lifetype 對使用者的帳號採取較嚴格的限制,僅允許 A-Z a-z 0-9 的字元做為帳號,如要增加字元範圍可修改:
class/data/validator/usernamevalidator.class.php
define( "ONLY_ALPHANUMERIC_REGEXP","^([A-Za-z0-9]*)$" );


OPENLDAP 備份與還原

backup_ldap.sh 將每日 ldap 備份出來

#!/bin/bash

the_date=`date '+%m-%d-%y'`

the_dc='dc=tcc'

the_name=/var/ldap_backup/ldap_backup_$the_date.bz2

/usr/sbin/slapcat -f /etc/openldap/slapd.conf -b "$the_dc" | bzip2 -9 > $the_name

還原:

bzip2 -d /var/ldap_backup/ldap_backup_11-07-05.bz2

slapadd -c -l /var/ldap_backup/ldap_backup_11-07-05


利用 Web Editor 寫網誌

利用 Web Editor 寫網誌,參考網址

 http://plog.yejh.tc.edu.tw/index.php?op=ViewArticle&articleId=426&blogId=1  


FortiGate-400研習教材

bubble's weblog 的 FortiGate-400研習教材


PostgreSQL Performance Tips

取自:

http://chery.axonpro.sk/pgsql/chapters/performance/index.html

 (閱讀全文)


postgresql FAQ

http://sraapowergres.com/en/newsletter/issue_01/faq.inc.html (閱讀全文)


修改 pLog 認證方式記事

pLog 是個優秀的軟體,採用 MVC 設計理念,讓網頁展現的部份可以獨立出來,符合了 BLog 個人化的特性,plugin 的功能使得 BLog 附加的功能具彈性容易擴展。

但如要對特定 user 申請限制時,目前並沒有可用的方式,因此我自已修改了 pLog 認證的程式,可以讓申請者和台中縣網既有的 LDAP 帳號做整合。

 (閱讀全文)


PHP 上傳檔案, 利用 httpd.conf 限制執行 php script 設定方式

限制 user 傳上的檔案具有執行功能,可以在 httpd.conf 中加入設定,例:

<directory>
php_flag engine off
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
</directory>


Virtual Host 最簡單的做法 (含 DNS,讓你建目錄等於建虛擬主機)

from : http://www.sinsen.com.tw/callboard/schoolboard.php3?do=read_msg&board=school_board&msg_id=237&order=desc&cur_page=1

以下有部份取自原來我貼在 VBird 的文章
Apache 的 VH 其實設法相當多種,
相信大多數都是這種設法

 (閱讀全文)


CVS Server Installation on Linux

from : http://www.uta.edu/oit/how-to/docs/cvs.php

CVS 架設參考資料

 (閱讀全文)


批次轉碼工具 convmv

在 Linux 下,將所有的檔案名稱批次轉碼工具
http://j3e.de/linux/convmv/

用法
convmv -f big5 -t utf-8 -r --notest /home/user1

說明 將 /home/user1 下所有的檔案名稱由 big5 編碼轉為 utf-8