2012年11月2日 星期五

淺談 Launchpad 上面的 Bazaar 分支架構

Bazaar 是由維護及贊助 Ubuntu 開發的 Canonical 公司所贊助開發的,它的使用方式比較接近 Subversion,因此在本地端的 Bazaar 分支,就只會有一個分支,如果要管理多個分支則要使用

$ bzr init-repo LOCATION
來建立一個 shared repository 的目錄,然後在底下使用
$ bzr branch FROM_LOCATION [TO_LOCATION]
來建立本地分支。

舉例來說,如果今天要對 betaradio 這個軟體專案進行 Ubuntu 上面的開發工作,一般來說,可以在 lp:betaradio 找到最上游 (也就是這個軟體本身的開發) 上面最新開發中的程式碼。

$ mkdir -p ~/projects/betaradio
$ bzr init-repo ~/projects/betaradio
$ cd ~/projects/betaradio
$ bzr branch lp:betaradio trunk

而 Debian 上面的最新版本則可以在 lp:debian/betaradio 找到,而 Ubuntu 上面的最新版本則可以在 lp:ubuntu/betaradio 找到。

$ bzr branch lp:debian/betaradio debian
$ bzr branch lp:ubuntu/betaradio ubuntu

通常,如果軟體本身不是一開始就是只有讓 Debian/Ubuntu 本身可以使用的話,lp:betaradio 與 lp:debian/betaradio 及 lp:ubuntu/betaradio 的差異就會是為了製作 Debian package 以及針對 Debian/Ubuntu 所做的一些修補。

另外就是 Debian 有分 unstable/testing/stable/old-stable 也就是 codename 為 sid/wheezy/squeeze/lenny 的不同版本,因為 betaradio 沒有進到 stable 及 old-stable,所以目前只會有 lp:debian/wheezy/betaradio 以及對應到 sid 的 lp:debian/betaradio 這兩個分支。

$ bzr branch lp:debian/betaradio sid
$ bzr branch lp:debian/wheezy/betaradio wheezy

而 Ubuntu 目前有在維護及開發的版本是 10.04/11.04/11.10/12.04/12.10/13.04 也就是 codename 為 lucid/natty/oneiric/precise/quantal/raring,因為 betaradio 只有在 oneiric 之後才進去,所以有 lp:ubuntu/quantal/betaradio lp:ubuntu/precise/betaradio lp:ubuntu/oneiric/betaradio 以及對應到開發中 raring 的 lp:ubuntu/betaradio 這四個分支。

$ bzr branch lp:ubuntu/betaradio raring
$ bzr branch lp:ubuntu/quantal/betaradio quantal
$ bzr branch lp:ubuntu/precise/betaradio precise
$ bzr branch lp:ubuntu/oneiric/betaradio oneiric

如果在 Ubuntu 釋出之後的修改,以 precise 為例,則會出現在 lp:ubuntu/precise-updates/betaradio lp:ubuntu/precise-security/betaradio lp:ubuntu/precise-proposed/betaradio lp:ubuntu/precise-backports/betaradio 這幾個分支上面,要看實際上使用到才會產生出來。

只不過 betaradio 目前沒有特別去修正 precise 上面的版本,所以就沒有上面提到的這些分支了,假設今天在有 precise 的更新又跟 security 無關,那麼則會產生出 lp:ubuntu/precise-updates/betaradio 以及 lp:ubuntu/precise-proposed/betaradio 來使用。

$ bzr branch lp:ubuntu/precise-updates/betaradio precise-updates
$ bzr branch lp:ubuntu/precise-proposed/betaradio precise-proposed

常常會有開發者搞不清楚到底應該使用哪一個分支,所以寫了這一篇文章來解釋一下。

沒有留言: