聚會時間公告: 因應COSCUP 2011, Kalug 8月份休會一次

一月 27, 2012
» 用 Ubuntu 10.10 Live CD 重新安裝 GRUB 2 到 Bootloader

logo-Ubuntu

今天起床打開電腦,Ubuntu 跳出 Warning 訊息,boot 磁區剩下 84MB,所以我手殘進去 /boot/ 目錄,把舊的 Kernel 清除,不小心砍掉 initrd.img-2.6.35-32-generic Linux Image 開機所需要的檔案,結果之後開機出現

You need to load the kernel first

大家好像都是升級 Kernel 之後才會出現上述狀況,網路上找到的解答都不符合我的需求,所以我又往 GRUB2 開機 Boot 去瞭解,新的 GRUB 2 跟原先的 GRUB 的解法已經完全不同了,沒有 /boot/grub/menu.list,而被 /boot/grub/grub.cfg 取代,所以不應該在手動編輯此檔案。grub.cfg 會在有更新 Kernel 版本時,手動執行 update-grub 的時候被修改覆寫。這次發生的原因是在我把舊版 Kernel 刪除,而忘記執行 update-grub,這時候的最佳解法就是透過 Live CD 來救援。

Ubnutu Live CD 救援

先把 Ubuntu Live CD 放入,直接先選 Try Ubuntu,接著就會進入桌面,將 Terminal 打開 (Applications -> Accessories -> Terminal),之後只要按照底下步驟就可以成功還原 boot loader。

1. 首先確定系統的根目錄以及 boot 磁區代號,大致上都是 sda1, sda5 等等,可以透過 fdisk -l 來瞭解這些資訊。

$ fdisk -l

輸出底下結果

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13       96256   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13       38914   312471553    5  Extended
/dev/sda5              13         499     3905536   82  Linux swap / Solaris
/dev/sda6             499        5362    39061504   83  Linux
/dev/sda7            5362       38914   269502464   83  Linux

2. 將 / 跟 /boot mount 到任意目錄

$ sudo mkdir /mnt/root
$ sudo mount -t ext4 /dev/sda6 /mnt/root
$ sudo mount /dev/sda1 /mnt/root/boot

建立 /mnt/root 目錄,用來掛載自己的 Linux 系統,/dev/sda6 是原先 / 磁區,而 /dev/sda1 則是 /boot 區域

3. 掛載 critical virtual filesystems,請執行底下 command

$ for i in /dev /dev/pts /proc /sys; do sudo mount -B $i /mnt/root$i; done

4. 用 chroot 指令切換到 system device

$ chroot /mnt/root /bin/bash

5. 重新將 Kernel 安裝

$ sudo apt-cache search linux-image

找到您要的版本後重新安裝

$ sudo apt-get install linux-image-x.x.x-xx

6. 更新 /boot/grub/grub.cfg

$ update-grub

7. 重新安裝 GRUB 2

$ grub-install /dev/sda

8. 重新確認是否安裝成功

$ grub-install --recheck /dev/sda

9. 按 CTRL-D 離開 chroot

10. 卸載全部虛擬系統

$ for i in /sys /proc /dev/pts /dev; do sudo umount /mnt/root$1; done

卸載 boot 及 / 系統

$ sudo umount /mnt/root/boot
$ sudo umount /mnt/root

11. 重新開機

$ sudo reboot

結論

因為不小心砍一個系統開機檔案,所以花了一些時間找資料,以及瞭解 GURB2,這樣也是不錯啦 XD,底下是參考的一些資料

Reference:
[SOLVED] Can’t start ubuntu (WUBI) : You need to load the kernel first
Clean up your grub menu and the kernels you do not use
Ubuntu Wiki Grub2
How to Restore Grub 2 As The Main Bootloader
How to create edit/extract initrd in Ubuntu/Debian and Redhat/Fedora Linux ?
Howto: Upgrade Linux Kernel
Clean Up the New Ubuntu Grub2 Boot Menu

Related View

一月 25, 2012
» [筆記] 在 Ubuntu mount DVD ISO 檔案

logo-Ubuntu

在網路上常常下載 ISO 檔案Windows 底下可以透過虛擬光碟看到檔案內容,可是到了 Ubuntu 系統該如何知道 ISO 裡面放了哪些檔案呢?其實很簡單,可以透過 mount 指令就可以做到了喔,參考 Ubuntu 台灣論壇: 如何mount iso檔? [論壇 - Ubuntu基本設定]

$ mount /iso/ubuntu.iso /home/appleboy/ISO/ -t iso9660 -o loop

執行完上述指令,可以發現桌面會多出 DVD 光碟圖示,直接點選就可以了

Related View

» GSDL Koha - 系統正體中文化

   GSDL Koha 是個基於 Lubuntu 的圖書管理發行版本,並事先建置好 Greenstone, Koha, dbWIZ, WordPress, Drupal 以及 phpMyAdmin 環境,但也因為是尼泊爾的夥伴在 support 的關係,其預設的中文支援度也就相對的差了點。

   在與 Emily Hsieh 的接觸下知道毛老師有在推這個 distribution,索性就花了點時間整理一下,最後還要感謝 Ubuntu-tw 論壇上的各位前輩,要不是有大家無私的分享凍仁可是不知道又要繞到哪才解的完這一題呢。


GSDL Koha 中文化幻燈片教學。


1. 安裝 GSDL Koha 作業系統

1.1. 至 GSDL Koha 官方下載 ISO。
1.2. 燒製光碟或製作 Live USB。
1.3. 安裝步驟請參考上方的簡報。

2. 安裝中文輸入法 - gcin

2.1. 安裝 gcin
jonny@oneiric:~$ sudo apt-get install gcin [Enter]

2.2. 切換輸入法為 gcin 並取代 ibus
jonny@oneiric:~$ im-switch -s gcin [Enter]

3. 安裝正體中文語系

3.1. 安裝正體中文語系套件 - language-pack-zh-hant
jonny@oneiric:~$ sudo apt-get install language-pack-zh-hant [Enter]

4. 安裝中文字型

4.1. 安裝文泉驛正黑體 - ttf-way-zenhei
jonny@oneiric:~$ sudo apt-get install ttf-way-zenhei [Enter]

# 偏愛文泉驛微米體者請改用 ttf-way-microhei 套件。

   若中文字型是手動下載並放置到 $HOME/.fonts/ 底下,則必須手動修改 /etc/fonts/ 底下的設定檔,否則 LXDMSynaptic 會在整個系統切換至正體中文時,因沒有對應的中文字型設定反而顯示亂碼。

4.2. 更改 Firefox 字型設定。
   不少軟體套件都有內建修改字型的選項,以 Firefox 為例,若想確保各個網頁的字型都套用到該字型,就得同時修改 Simplified Chinese, Traditional Chinese (Hong Kong), Traditional Chinese (Taiwan), Westem, Other Languages 五種語系才會都套用到,其中文的翻譯依序為簡體中文正體中文(繁體,香港)正體中文(繁體,台灣)英文/西歐語言其他語言

5. 將整個系統切換至正體中文語系

   此步驟請於第三、第四步驟完成後再動作,確定字型與語系包都裝好就可以登出,並於登錄畫面(GSDL Koha 預設使用 LxDM)更換語系。

Language 一欄會多出 zh_TW 可以切換。

6. 修改中文字型設定 bug

由於 Ubuntu 11.10 在中文字型的設定上有問題,故得手動執行以下指令。
jonny@oneiric:~$ sudo fontconfig-voodoo -a [Enter]

結束這一單元 :P

站內連結:
Monaco + LiHei 字型優化 on Ubuntu 10.04
切換登入畫面語系 on Ubuntu 11.10

延伸閱讀:
Koha 中文 WIKI 文件區

資料來源:
無中文介面、畫面及輸入法 [論壇 - Ubuntu安裝問題] | Ubuntu 正體中文站

相關連結:
GSDL Koha Digital Library | Making everything available for everyone
Koha Translation Project: 漢語 (臺灣)
如何製作 Ubuntu Live USB « 高登工作室

一月 24, 2012
» AptURL on Ubuntu 11.10

一年又要過了,算一算凍仁已經認識 Ubuntu 1,442 天,也就是再過 18 天就滿 4 年,然後這個 Blog 也就四歲了,也挺佩服 2008 年的自己寫了 200 多篇文章,這邊就讓凍仁多凹一篇了,以下是凍仁在 Oneiric Ocelot (有夢的虎貓) 除預載的套以外另行安裝的部份,互相交流囉 :-)

1. 附屬應用程式

7zip - 7z and 7za file archivers with high compression ratio.
Figaro's Password Manager 2 - 密碼管理員,除使用 AES-256 加密外,也可使用金鑰雙認證機制。 (more)
Guake Terminal - 是個能在 Gnome 快速由上而下彈跳出來的終端機,有著類似 KDE 的 yakuake 效果。 (more)
GVim Test Editor - Vi 純文字編輯器的強化版。
MySQL Client - MySQL 資料庫終端。
QuickSynergy - 簡單的 Synergy 圖形設定介面。 (more)
Screen Message - 在全螢幕顯示大大的文字。
Shutter - 擷取、編輯及分享螢幕截圖。
Terminator - 在單一視窗使用多個終端機。
Wallch - 自動更換桌布,也就是讓桌布有幻燈片的功能模式。
Xournal - 使用手寫筆記。
Zim - 使用 Python 撰寫的私有筆記,並支援 windows 平台。

2. 美工繪圖

GIMP - GNU 授權的影像處理程式。
Gcolor2 - 簡單的 GTK2 顏色擷取程式。

3. 網際網路

Chromium Browser
Dropbox (third-party) - Dropbox integration for Nautilus. (more)
Filezilla - 圖形化的 FTP Client,並同時支援 Windows 及 Mac OS X。
Googlizer - utility to search Google via your GNOME menu/panel.
Google Chrome (third-party) - Google 瀏覽器。 (more)
JDownloader (third-party) - 跨平台的免費空間下載套件。 (more)
Mutt - 文字模式的收信套件,並支援 MIME, GPG, PGP 及穿梭。
Opera (third-party)
Skype (third-party)
Thunderbird
Wireshark - 網路封包分析套件。

4. 影音

Audacious - 音樂播放器。
EasyTAG - viewing, editing and writing ID3 tags.
Google Music Frame (third-party) - 將 Google Music 整合至狀態列的小工具。 (more)
MOC - 基於 ncurses 的純文字音樂播放器。 (more)
SMplayer - 完整的 MPlayer 前端套件。
VLC media player - VLC 影音播放器。

5. 佈景主題與系統調校

CCSM - Compiz 進階設定工具。
Compiz Extra Plugins - Compiz 的額外/擴充套件。
ClassicMenu Indicator (third-party) - 於狀態列使用傳統選單,強烈推薦給還用不慣 Unity 的伙伴。 (more)
MyUnity (third-party) - Unity 設定工具。 (more)
Gnome Tweak Tool - Gnome Shell 的進階設定工具,可調整佈景主題、滑鼠指標以及字型等等。 (more)
Gufw - 圖形化的 ufw 防火牆設定工具。
Indicator CPUfreq - CPU frequency scaling indicator. (more)
Indicator for Keys Lock (third-party) - An appindicator for showing the status of the keyboard lock keys. (more)
Indicator Virtualbox (more)
Ubuntu Tweak (third-party) - 專門為 Ubuntu 製作的調校工具,素有 Ubuntu 優化大師之稱。 (more)

6. 辦公

Adobe Reader - 檢視 PDF 的閱讀器。
Dia - 流程圖繪製套件。

7. 開發者工具

Bluefish - C, CSS, HTML, PHP, SQL.. 多種程式語言 的 IDE。
Eclipse - Extensible Tool Platform and Java IDE.
Meld - diff 及 merge 的圖形化套件。

8. 未分類

Aptitude - 文字模式的套件管理員。
AptURL - install packages using the apt protocol - GTK+ frontend.
Cmatrix - 在終端機秀出「駭客任務」中很酷的動畫。
dstat - 萬能的資源統計工具。
Gnome Classic - 傳統 Gnome 模式。
Gnome Shell
GParted Partition Editor - GNOME 分割區編輯套件。
Hime (third-party) - 中文輸入法,為 Gcin 的衍生版本。 (more)
Hime Chewing (third-party) - 移植至 Hime 上的新酷音輸入法。
Htop - 互動式的行程檢視器。
libnotify-bin - 可送自訂訊息到訊息服務。
Nautilus Scripts Manager - 在檔案管理程式(Nautilus)增加自訂 Script 選單。
Openssh Client - SSH 終端機。
rcconf - Debian Runlevel configuration tool, like Redhat`s chkconfig.
tasksel - Debian 有內建但 Ubuntu 沒有的套件管理軟體,可依照其需求(任務)安裝套件,例如 Lubuntu, Kubuntu, LAMP..
Unity 2D
Virtualbox - 虛擬機器。
w3m - 文字模式的瀏覽器。

全選/取消


2011-12-14

凍仁用了 jQuery 及 Javascript 的技術做了個 一次安裝的按鈕,在此要感謝能讓凍仁現學現賣的 星夜如雨、以及一同討論的 雨蒼BlueT 前輩們 :-)

站內連結:
AptURL

相關連結:
Luna's Debian Archiver

延伸閱讀:
Google Libraries API - Google Code

» 私有筆記(Private Note)之旅

在這個資訊爆炸的時代,身在資訊界的凍仁每天都有吸收不完的知識,之前都是透過 Facebook Links 及 Google Reader 紀錄並做為私有知識庫,但隨著 Google Reader 的改版這個組合早已失效!原本還有個很棒的 Google 筆記本 也將停止服務,凍仁從此踏上尋找私有筆記(Private Note)之旅。

Item  Linux   Maemo   Office Edit   Office Read   Sync   Windows 
RST
 TiddlyWiki 
CCTiddly
Vimwiki
EverNote
✓ 支援,✕ 不支援,▲ 需符合特定條件。


凍仁使用過的私有筆記依序為:
  1. reStructured Text - 只需撰寫一次就可匯出多種格式的功能,並可搭配 VST 使用,較適合拿來寫書。
  2. TiddlyWiki - 具可攜性,文章皆儲存在同一個 HTML,需使用支援 JavaScript 的瀏覽器(browser),建議使用 Firefox,但內容過多會有載入緩慢之情形。若想在 NOKIA N900 上使用,需透過內建的 MicroB,其 Opera Mobile 不支援。
  3. CcTiddly - TiddlyWiki 的網路版,需 LAMP 環境,同樣得使用支援 JavaScript 瀏覽器,也就是說不支援 w3m
  4. Vimwiki - Vim 外掛之一,主要以純文字的方式儲存,需手刻同步(Sync)的 Shell Script。
  5. EverNote - 支援多種平台的雲端筆記服務,簡單易用;有空間限制,免費版每月有 60M,少傳大檔及圖片都夠用,若想離線使用需搭配專用的應用程式。

其私有筆記凍仁最後是以 Vimwiki 為主 EverNote 為輔,並且在 ThinkPad T410 以及 NOKIA N900 上使用,一般人建議直接使用 EverNote

相關連結:
VST - Vim reStructured Text : vim online
Download WinRST 0.0.1 Free

一月 21, 2012

Yuren's Info Area
yurinfore
Yuren's Info Area is about »

tag cloud

» Fedora 16 下換 GNOME3 Theme

一時無聊看到 ICS GNOME3 的 Theme 覺得很有趣想換一下,沒想到還有點麻煩。主要在於 Fedora 上面的 GNOME3 Theme Selector extension 有相容性問題沒辦法安裝。

解決的方法是只安裝 GNOME3 User Theme extension,然後再用 command line 修改 theme。

  1. 下載 GNOME3 的 Theme,並且放到 .themes 裡面,如果沒這個目錄就創建一個
  2. 安裝 user theme extension:
    # yum install gnome-shell-extension-user-theme.noarch
  3. 重開 gnome-shell,按下 alt + F2 輸入 r 按 enter
  4. 使用指令指定要使用的 theme:
    $ gsettings set org.gnome.shell.extensions.user-theme name "Ice Cream Sandwich"

這樣就可以切換到所指定的 theme 了。


這樣跟我的手機剛好搭成一套 :)

一月 20, 2012
» bash 時間戳記 with $PS1

大約兩年前,凍仁從 KaLUG 的前輩口中得知 bash 的 $PS1 除了可以自訂顏色以外還可以加入時間,就有如即時通訊軟體的時間戳記一般,兩年後的現在凍仁終於掌握到訣竅了

[ jonny@oneiric ~ ] - 01:21
$ echo $PS1 [Enter]
\[\033[0m\][ \[\033[1;33m\]\u\[\033[1;31m\]@\h\[\033[1;31m\] \[\033[1;35m\]\w\[\033[1;35m\]\[\033[0m\] ] - \A\n\[\033[1;37m\]$ \[\033[0m\]

這不是什麼新聞了,連好男人(man page)都有說明,凍仁偏愛二十四小時的 \A
jonny@oneiric:~$ man bash [Enter]

  \t     the current time in 24-hour HH:MM:SS format
  \T     the current time in 12-hour HH:MM:SS format
  \@     the current time in 12-hour am/pm format
  \A     the current time in 24-hour HH:MM format

跟 Ubuntu 預設的樣式比比看就知道改了不少東西。
jonny@oneiric:~$ echo $PS1 [Enter]
\u@\h:\w\$

註:Windows 上的 Cygwin bash 則得把 \A 改成 $(date +%R) 才行。

站內連結:
多彩的 Bash 提示字元($PS1) on Debian 5

資料來源:
How to: Change / Setup bash custom prompt (PS1)

相關連結:
Bash prompt basics @ 尼卡.Nica :: PIXNET ::

一月 18, 2012
» meeting room name

台北辦公室擴建完畢後, 內部在詢問會議室的命名意見,命名規則很簡單。要有台灣特色且容易翻譯。 於是想當然爾眾人的提案不外乎高山、景點、小吃之類的。

因會議室剛好有午間,有同事提議用台灣五院來命名,而且這樣以後辦公室會有下列有趣的對話….

同事A: 等下在哪開會

同事B: 立法院

當然這個提案,不是很被多數人認可,因為英文名字有點太長…

而我自己的提案是台灣高山湖, 這些湖的共同點就是交通不便,需要親力親為上山後方能領略美景。 至於象徵意含嘛… 我沒想這麼多。

五個會議室名稱分別如下

  1. 嘉明湖 - 海拔3310/11公尺, 素有天使的眼淚之稱 七彩湖 - 海拔2980公尺

  2. 松蘿湖 - 海拔1300公尺, 素有「十七歲之湖」及「夢幻之湖」之稱

  3. 七彩湖 - 海拔2980公尺

  4. 白石池 - 海拔2770公尺

  5. 翠池 - 海拔3520公尺 , 台灣最高的高山湖泊

註:我還有另一個提案是用台灣36秘境中的5個來命名, 不過目前比較偏好用高山湖泊命名

» 【Scripts】正體中文的 man page

大家都知道在 Linux 的世界裡有個 man (好男人),但偏偏就是沒有 woman (女人),恰巧有需要觀看英文及正體中文兩個語系的 man (說明文件),凍仁索性就自己創造個 woman.sh 來用。

在 Ubuntu 中文化漸漸完整的現在,連命令列(Command line)的訊息都中文化了,這是件多麼讓人高興的事情啊,但這反而對凍仁不友善

圖 1:中文語系的 woman。

1. 基於個人習慣凍仁都手動將 Command line 的語系改回英文。
jonny@oneiric:~$ vi $HOME/.bashrc [Enter]
tty=`tty`
t=`echo $tty|awk -F "/" '{print $3}'`
if [ "$(tty)" = "/dev/tty1" ] || [ $t = pts ]; then
export LANGUAGE="en_US.UTF-8"
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
fi

圖 2:英文語系的 man。

2. 有了純英文的 man 又不想放棄中文的說明手冊?那就建立個 woman 來用用!
jonny@oneiric:~$ vi woman.sh [Enter]
 1 #!/bin/bash
2
3 tty=`tty`
4 t=`echo $tty|awk -F "/" '{print $3}'`
5 if [ "$(tty)" = "/dev/tty1" ] || [ $t = pts ]; then
6 export LANGUAGE="zh_TW.UTF-8"
7 export LANG="zh_TW.UTF-8"
8 export LC_ALL="zh_TW.UTF-8"
9 fi
10
11 man $1

3. 新增執行權限。
jonny@oneiric:~$ chmod +x woman.sh [Enter]

4. 加入環境變數。
jonny@oneiric:~$ sudo ln -s $HOME/woman.sh /usr/local/bin/woman [Enter]

5. 測試,結果應與圖 1 相同。
jonny@oneiric:~$ woman man [Enter]

相關連結:
Ubuntu 10.10里安装中文man_Page2

一月 17, 2012
» Vim - w 指標跳動緩慢

在 Vim 的世界裡若想在一般模式(Normal mode)左右移動指標,除了使用方向鍵以外還可使用 hl,但隨著字數的增長,就會顯得有些不足,這時就是開始學習使用 wW 的好時機。

    w   移動指標至下一個單字字首。
    W   移動指標至上一個單字字首。

習慣 w 的單字跳躍是件好事,但前些日子凍仁的這位 w 先生便開始動作緩慢,其實這是因為之前自訂 Vimwiki 快捷鍵時衝到的緣故。

jonny@oneiric:~$ vi $HOME/.vimrc [Enter]
nmap wj   :VimwikiDiaryNextDay <CR>

解決方法就是別使用 w 為開頭的快捷鍵就行了!
jonny@oneiric:~$ vi $HOME/.vimrc [Enter]
nmap <leader>wj   :VimwikiDiaryNextDay <CR>

延伸閱讀:
Vi文件編輯器/基本入門 - 維基教科書

資料來源:
vim的w“移动到下一个单词”命令很慢 - 新手园地 - ChinaUnix.net

» Blogger 動態檢視範本

近來看到 Allen Own 前輩開張了 我的密碼沒加密 這個部落格,就覺得挺炫的,看了一下其實是 Blogger 最新的動態檢視(Dynamic View)範本,也就是說接下來凍仁也可以讓自家的 Blog 變得這麼炫!

左上角這裡有個大大的玄機呢!

進入管理頁面後,選範本就可以看到動態檢視的範本了。

套用後還是有些落差,很明顯的看出來沒有收合的感覺。

啟用「網頁」模式。

完成!

只要在網址後補上 view 就可套用在公開的 Blogger 了,Enjoy it!

例:http://jonny.ubuntu-tw.net/view/

資料來源:
啟用動態檢視 - Blogger 說明
Chrome Web Store - Blogger Dynamic Views (by Google)
Blogger Dynamic Views feedback

相關連結:
Official Gmail Blog - Classic style.
M Loves M - Flipcard style.
ADVANCED STYLE - Magazine style.
The Crosby Kitchen - Mosaic style.
Blogger Buzz - Sidebar style.
The Bleary-Eyed Father - Timeslide style.
Blogger Dynamic Views 自由切換閱讀電腦玩物的五種動態版型 | 電腦玩物

一月 16, 2012
» AptURL

一直以來凍仁在推薦各個 Ubunt 套件時都是用指令的方式來介紹,雖然這是最不容易出錯的方式,其實 Ubuntu 還有個小程式更能勝任這個任務,它就是「AptURL」。

我們可以透過點擊連結來安裝套件,不過得符合幾個條件:
1. 安裝 apturl 套件,Ubuntu 7.10 以上版本都會預載。
2. 只支援 Firefox, Pidgin 這兩套件的連結。
3. 只適用於套件庫有的套件,也就是說其他的套件得在手動加入套件來源後才適用,例如 Google Chrome。


資料來源:OpenFoundry


AptURL 語法如下:

HTML
# 安裝單一套件。
<a href="apt://套件">文字</a>

# 安裝多個套件。
<a href="apt://套件1,套件2,套件3">文字</a>

# 先更新套件來源再安裝。
<a href="apt://套件?refresh=yep">文字</a>

BBCode
[URL="apt://套件"]文字[/URL]

Shell 指令
apturl apt:套件 Enter

站內連結:
AptURL on Ubuntu 11.10

相關連結:
Appnr - Get Ubuntu Applications!

資料來源:
Apturl – 安裝 Ubuntu 程式就像瀏覽網站一樣簡單 - OpenFoundry
AptUrl - Ubuntu Wiki
一鍵安裝 Ubuntu 軟體 - Ubuntu 正體中文 Wiki

一月 8, 2012
» lp-cli - just another command line tool of Launchpad

The web interface of Launchpad is awesome, but it does not provide a function that you can save your search result, or even create a custom bug display list, I believe managers would like this function, especially they want to track each team member status.

I am just a engineer but also have almost the same requirement, here are 3 questions I need to answer in the end of weekend.

  • Which bugs I worked this week?
  • Which bugs I need to work next week?
  • Which bugs are waiting me to fix?

It is better to have a way to always show bugs I am interesting for different purpose, so I start to write a script by using python-launchpadlib.

by the way, another needs is to find bugs and modify attribute(s) of each bug.

python-launchpad

Launchpad has a very friendly python library, I will not talk this too much, if you want to know the details of it, please check these websites.

lp-cli

lp-cli include several tools which is very small and has only one trivial purpose, that is users can use Unix pipeline to combine small tools to archive a complex task.

All work of process data of Launchpad can be simplified as the following

  1. get data from Launchpad
  2. get sub set of data by some conditions
  3. do something on each entry one or multiple times
  4. do something on the final result such as save as a file or print to console

Use Case 1

Create a text file contains bugs I worked is modified this week.

1
2
3
4
$ lp-searchbugs people ossug-hychen  | \
  lp-view modified_thisweek | \
  lp-print buglist |  \
  lp-save bugs_modified_thisweek.txt
  • lp-searchbugs people ossug-hychen – find related bugtask of a user that login name is ossug-hychen
  • lp-view modified_thisweek – get bugs worked by ossug-hychen before and modified this week
  • lp-print buglist – then print the result in buglist style
  • lp-save bugs_worked_this_week.txt – then save the result as a file

the view modified_thisweek means the bug worked by anyone since 7 days before as defined here

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
---
data_getters:
...
        modified_thisweek:
                status: [Fix Committed,
                         Fix Released,
                         In Progress,
                         Incomplete (with response),
                         Incomplete (without response),
                         Triaged,
                         Invalid,
                         Won't Fix,
                         Confirmed]
                modified_since: $date_before_now
...

so if you want to know which bugs is really worked by yourself, we need another tool to limit the scope of result which is not done yet.

Use Case 2

reassign bugs I fixed in project ABC to another people, some time is QA

1
2
$ lp-searchbugs project ABC --status 'Fix Committed' --assignee ossug-hychen  | \
  lp-edit --assignee QA
  • first command is to get bugs fixed by me in project ABC
  • second command is to reassign each bugs to a QA guy

Available Commands

  • lp-searchbugs - type:Fetcher, generate a task of searching bugs in launchpad
  • lp-view - type:View, add extra args to received task (like lp-searchbugs)
  • lp-print - type:Task Action, execute received task and print the result
  • lp-save - type:Action, save STDIN to a file
  • lp-mybugs - shortcut of lp-searchbugs people $your-lp-login-id

because accessing Launchpad takes a lot of time, so the real data fetching work is only executed in Task Action command in my design.

[update]

Tim Chen told me a cool idea I never think about that you can save STDOUT of lp-searchbugs , lp-mybugs or lp-view to a text file

1
$ lp-mybugs | lp-view plan_nextweek > bugs_I_need_to_work_next_week.view

next time when you want to get the result, just type

1
$ lp-print buglist <  bugs_I_need_to_work_next_week.view

this behavior is similar what lp-view does, so now you can create any view you want!

Installation

1
2
3
$ add-apt-repository ppa:ossug-hychen/ppa
$ apt-get update
$ apt-get install lp-cli

Thanks

The idea of lp-cli is inspired by my friend Thinker Li’s image downloading tool

一月 7, 2012