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

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

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

2011年4月13日 星期三

使用 Ubuntu 套件的原始碼版本管理庫

以 language-selector 為例,並且參考先前的介紹來建立 Shared repository

$ bzr init-repo language-selector
$ cd language-selector
一般來說,想要拿到 Ubuntu 上面的最新開發中的版本,可以使用:
$ bzr branch lp:ubuntu/language-selector trunk
如果想要拿到 Ubuntu maverick 上面的開發版本就應該使用:
$ bzr branch lp:ubuntu/maverick/language-selector maverick
如果想要知道目前 Ubuntu 上面有哪些官方的開發版本的話可以使用 devscripts 套件中的 rmadison 來查詢
$ rmadison language-selector
language-selector |     0.1.20 |        dapper | source, all                    
language-selector |   0.1.20.1 | dapper-updates | source, all                   
language-selector |      0.3.4 |         hardy | source, all                    
language-selector |     0.4.18 |        karmic | source, all                    
language-selector |      0.5.7 |         lucid | source, all                    
language-selector |      0.5.8 | lucid-updates | source, all                    
language-selector | 0.5.8+langfixes~lucid1 | lucid-backports | source, all      
language-selector |      0.6.6 |      maverick | source, all                    
language-selector | 0.6.6+langfixes~maverick1 | maverick-backports | source, all
language-selector |       0.31 |         natty | source, all                    
假設想要使用 maverick-backports 當中的版本就可以使用:
$ bzr branch lp:ubuntu/maverick-backports/language-selector maverick-backports

另外,除了可以使用 `bzr branch` 之外,還可以使用 `bzr checkout` 來取得原始碼。
使用 `bzr branch` 在 `bzr commit` 後,還要再使用 `bzr push` 來將變動的部份提交到遠端的 Bazaar Repository 上面;
而使用 `bzr checkout` 的話,在 `bzr commit` 的同時就會自動提交到遠端的 Bazaar Repository 上。
無論是使用 `bzr branch` 還是 `bzr checkout` 都會將完整的變動歷史資料下載到本地端,如果想要像 Subversion 那樣只會取得最新的一筆資料可以使用 `bzr checkout --lightweight` 來取得原始碼。

想要知道目前處於哪一種模式 (branch/checkout/lightweight-checkout) 可以在該目錄下面執行

$ bzr info
如果是 lightwieght checkout 的話,應該會看到 `light checkout root`
如果是 checkout 的話,應該會看到 `repository checkout root`
如果上面兩個都沒有看到的話應該就是 branch 了

最後,如果想要在 branch 與 checkout 之間切換的話,就要使用 `bzr bind/unbind`

參考資料:
http://wiki.inkscape.org/wiki/index.php/Working_with_Bazaar
https://wiki.ubuntu.com/DistributedDevelopment/Documentation/GettingTheSource

2010年11月24日 星期三

Bazaar 的分支使用方式

Bazaar 的分支使用方式與 Mercurial 跟 Git 都不太一樣
它比較類似 Subversion 的使用方式以下是簡單的示範

首先要建立一個 shared repository
~$ bzr init-repository hello

然後在 hello 這個目錄底下再建立個別的 branch 目錄
~/hello$ bzr init trunk

或是直接從遠端拉變更資料回來
~/hello$ bzr branch lp:ubuntu/hello trunk

如果是要做本地端分支的話,要再建立另一個新的目錄 (這邊有點類似使用 svn copy 的分支方式)
~/hello$ bzr branch trunk my-branch

如果是要建立遠端的分支的話,則是利用 Launchpad 提供的服務
~/hello/my-branch$ bzr push lp:~fourdollars/hello/my-branch

所以 Bazaar 的缺點是不像 Mercurial 跟 Git 那樣在一次的 clone 之後就可以將所有的分支都抓下來了,但是另外的好處就是由 Launchpad 提供的整合介面,讓 Patch Provider 也可以透過 Launchpad 來提 Merge Request,而 Reviewer 只要在 Launchpad 上面點一下 Accept 就可以自動 merge 了,這樣反而省下了許多指令的使用,至於是好是壞則是見仁見智囉。

參考資料:http://wiki.inkscape.org/wiki/index.php/Working_with_Bazaar

2010年6月14日 星期一

Debian Package (4) - 製作一個簡單但是有點用處的 Debian Package (續)

前一篇文章只能完成了 Debian Package 的打包但是並沒有上傳至 Debian 官方的套件庫
如果想要上傳到 Debian 官方的套件庫就必需尋求 Debian Developer (以下簡稱 DD) 的協助了
另外就是還要準備一把已經被 DD 簽過的金鑰才行 (可能要數個 DD 簽過才行)
如果沒有熟識的 DD 幫忙,其實還可以到 http://lists.debian.org/debian-mentors 上面尋求 DD 的協助
不過建議先看過 The debian-mentors FAQ 這份文件後再去尋求 DD 的協助

另外一種方式是自己維護 Debian Packages Archives 不過這真的很麻煩~ ^^b
如果是在 Ubuntu 上面的話可以考慮使用 Launchpad 上的 PPA 服務
以下將以 Launchpad PPA 為例

首先要建立自己的 Launchpad PPA 才行
會有一些申請的動作要自己去完成
可以參考 https://help.launchpad.net/Packaging/PPA 上面的說明

以下會假設已經完成 Launchpad PPA 的設定並且也準備好 SSH 金鑰跟 GPG 金鑰,只剩下要上傳 Debian Source Package 的動作要做。

因為 Launchpad PPA 只支援 Debian Source Package 的上傳,Launchpad 會再從 Debian Source Package 把 Debian Binary Package 給編譯產生出來,而之前的指令 dpkg-buildpackage -rfakeroot -uc -us -tc 其實會同時把 Debian Binary/Source Package 給產生出來,不過因為 -uc -us 這兩個參數就是指定不要使用 GPG 簽章,所以產生出來的 Debian Package 應該也無法上傳到 PPA 上使用。

如果要建立有簽章的 Debian Source Package 就要使用下面的指令
$ export DEBFULLNAME="First-Name Family-Name (Nickname)"
$ export DEBEMAIL="username@foo.bar"
$ dpkg-buildpackage -rfakeroot -S
這樣就可以在目錄上層建立牽過的 Debian Source Package 由以下三個檔案組成
taiwan-radio-tuner_0.1.dsc
taiwan-radio-tuner_0.1_source.changes
taiwan-radio-tuner_0.1.tar.gz
不過目前這樣的 Debian Source Package 就算上傳到 PPA 也會是失敗收場。

因為 Ubuntu 有一些規則要依循才行,首先修改 debian/changelog
taiwan-radio-tuner (0.1) lucid; urgency=low                                            

  * Initial release.

 -- First-Name Family-Name (Nickname) <username@foo.bar>  Mon, 14 Jun 2010 12:47:29 +0800
原本的 experimental 要改成 lucid 因為要給 Ubuntu 10.04 使用

另外就是如果要嚴格一點通過 lintian - Debian package checker 的測試,這是上傳到 Debian 官方套件庫必定要通過的測試,雖然在 Launchpad PPA 並沒有要求要通過 lintian 的測試,執行 debuild -S 後會發現有一些錯誤跟警告訊息出現。
W: taiwan-radio-tuner source: debhelper-but-no-misc-depends taiwan-radio-tuner
E: taiwan-radio-tuner source: package-uses-debhelper-but-lacks-build-depends
W: taiwan-radio-tuner source: package-lacks-versioned-build-depends-on-debhelper 7
W: taiwan-radio-tuner source: missing-debian-source-format
這些訊息其實只要 Google 一下就可以輕易地找到解決方法。
  • 首先是 debhelper-but-no-misc-depends 只要在 Depends 這個欄位多加上 ${misc:Depends} 就可以解決
  • 再來是 package-uses-debhelper-but-lacks-build-depends 跟 package-lacks-versioned-build-depends-on-debhelper 要多加上一個欄位 Build-Depends: debhelper (>= 7)
  • 剩下的 missing-debian-source-format 要多一個檔案在 debian/source/format 內容為 3.0 (native),因為這是一個原生的 Debian Package,如果是從上游的 tarball 而來的話就應該要使用 3.0 (quilt) 才行。
修改過後的 debian/control 如下:
Source: taiwan-radio-tuner
Maintainer: First-Name Family-Name (nickname) <username@foo.bar>
Section: contrib/web
Priority: extra
Build-Depends: debhelper (>= 7)
Standards-Version: 3.8.4
Homepage: https://chrome.google.com/extensions/detail/hacebidkncpkfenhpapdbkcefalehepa

Package: taiwan-radio-tuner
Architecture: all
Depends: ${misc:Depends}, google-chrome, alltray, gstreamer0.10-plugins-bad, gstreamer0.10-plugins-ugly, gstreamer0.10-ffmpeg
Description: Listen to the radio of Taiwan.
 The easiest way to listen to Internet Radio of Taiwan.
修改成這樣再去執行 debuild -S 應該就不會再有任何的錯誤訊息或是警告訊息的出現了。

最後就可以用 dput 上傳到 PPA 裡面啦~ :)
$ dput ppa:username/lucid taiwan-radio-tuner_0.1_source.changes
現在在 https://launchpad.net/~fourdollars/+archive/lucid
上面應該可以看到已經上傳到 Launchpad PPA 上的 Debian Package 了~
如果想要使用的朋友可以在 Ubuntu 10.04 上面執行 sudo add-apt-repository ppa:fourdollars/lucid
然後再執行 sudo apt-get update && sudo apt-get install taiwan-radio-tuner 應該就可以安裝好了~ :)

2009年7月31日 星期五

製作 deb package for Ubuntu Linux 並且上傳至 Launchpad PPA

這篇是練習過程的筆記, betaradio 現在還是處於 broken 的狀態

準備好原始碼
$ wget http://betaradio.googlecode.com/files/betaradio-0.1.2.tar.bz2
$ tar xf betaradio-0.1.2.tar.bz2 && cd betaradio-0.1.2
初始化動作
$ export DEBFULLNAME="Shih-yuan Lee (FourDollars)"
$ export DEBEMAIL="fourdollars@gmail.com"
$ dh_make -s -c gpl -f ../betaradio-0.1.2.tar.bz2
然後編輯 debian/control
Source: betaradio
Section: net
Priority: extra
Maintainer: Shih-yuan Lee (FourDollars) <fourdollars@gmail.com>
Build-Depends: debhelper (>= 7), autotools-dev, libgstreamer0.10-dev, libcurl-dev, libgtk2.0-dev
Standards-Version: 3.8.0
Homepage: http://code.google.com/p/betaradio/

Package: betaradio
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}, gstreamer0.10-plugins-base, gstreamer0.10-plugins-bad, gstreamer0.10-plugins-ugly, gstreamer0.10-ffmpeg, gstreamer0.10-alsa
Description: hiChannel electric radio client
 With this client you can listen to the hiChannel electric radio (http://hichannel.hinet.net/radio/index.jsp) without opening a browser.
 It displays a icon on system tray that you can click and select the channel you want to listen to.
編輯 debian/changelog
$ debchange
修改內容
betaradio (0.1.2-1ubuntu1) karmic; urgency=low

  * Initial release.

 -- Shih-yuan Lee (FourDollars) <fourdollars@gmail.com>  Fri, 31 Jul 2009 00:03:22 +0800
產生 deb source package
$ debuild -S
上傳 deb package 至 Launchpad PPA
$ dput ppa:fourdollars/ppa betaradio_0.1.2-1ubuntu1_source.changes
上傳的動作需要先註冊 Launchpad 帳號並且設定好 SSH public key 跟 GPG public key 還有產生 PPA 設定之後才能夠正常上傳