Poudriere 是一個使用 BSD 授權條款用來建立與測試 FreeBSD 套件的工具。它使用 FreeBSD Jail 來建置獨立的編譯環境,這些 Jail 可以用來編譯與目前所在系統不同 FreeBSD 版本的套件,也同樣可以在主機為 amd64 的系統上編譯供 i386 使用的套件。套件編譯完成後的目錄配置會與官方鏡像站完全相同。這些套件可由 pkg(8) 及其他套件管理工具使用。
Poudriere 可使用 ports-mgmt/poudriere 套件或 Port 安裝。安裝完成後會有一個範例的設定檔 /usr/local/etc/poudriere.conf.sample
。複製此檔案到 /usr/local/etc/poudriere.conf
,編輯複製的檔案來配合本地的設定。
雖然在系統上執行 poudriere 並不一定要使用 ZFS,但使用了是有幫助的。當使用了 ZFS,則必須在 /usr/local/etc/poudriere.conf
指定 ZPOOL
以及 FREEBSD_HOST
應設定到一個最近的鏡像站。定義 CCACHE_DIR
可開啟使用 devel/ccache 快取的功能來快取編譯結果並減少那些需時常編譯的程式碼的編譯次數。將 poudriere 資料集放到一個獨立的目錄並掛載到 /poudriere
可能會比較方便,其他設定項目採用預設值便足夠。
偵測到的處理器數量可用來定義要同時執行多少個編譯。並給予足夠的虛擬記憶體,不論是 RAM 或交換空間,若虛擬記憶體不足,編譯 Jail 的動作將會停止並被清除,會造成奇怪的錯誤訊息。
在設定之後,初始化 poudriere 來安裝 Jail 及其所需的 FreeBSD 樹與 Port 樹。使用 -j
來指定 Jail 的名稱以及 -v
來指定 FreeBSD 的版本。在執行 FreeBSD/amd64 的系統上可使用 -a
來設定要使用的架構為 i386
或 amd64
,預設會採用使用 uname
所顯示的架構。
#
poudriere jail -c -j 10amd64
-v 10.0-RELEASE
====>> Creating 10amd64 fs... done
====>> Fetching base.txz for FreeBSD 10.0-RELEASE amd64
/poudriere/jails/10amd64/fromftp/base.txz 100% of 59 MB 1470 kBps 00m42s
====>> Extracting base.txz... done
====>> Fetching src.txz for FreeBSD 10.0-RELEASE amd64
/poudriere/jails/10amd64/fromftp/src.txz 100% of 107 MB 1476 kBps 01m14s
====>> Extracting src.txz... done
====>> Fetching games.txz for FreeBSD 10.0-RELEASE amd64
/poudriere/jails/10amd64/fromftp/games.txz 100% of 865 kB 734 kBps 00m01s
====>> Extracting games.txz... done
====>> Fetching lib32.txz for FreeBSD 10.0-RELEASE amd64
/poudriere/jails/10amd64/fromftp/lib32.txz 100% of 14 MB 1316 kBps 00m12s
====>> Extracting lib32.txz... done
====>> Cleaning up... done
====>> Jail 10amd64 10.0-RELEASE amd64 is ready to be used
#
poudriere ports -c -p local
====>> Creating local fs... done
====>> Extracting portstree "local"...
Looking up portsnap.FreeBSD.org mirrors... 7 mirrors found.
Fetching public key from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Tue Feb 11 01:07:15 CET 2014:
94a3431f0ce567f6452ffde4fd3d7d3c6e1da143efec76100% of 69 MB 1246 kBps 00m57s
Extracting snapshot... done.
Verifying snapshot integrity... done.
Fetching snapshot tag from ec2-eu-west-1.portsnap.freebsd.org... done.
Fetching snapshot metadata... done.
Updating from Tue Feb 11 01:07:15 CET 2014 to Tue Feb 11 16:05:20 CET 2014.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 48 patches.
(48/48) 100.00% done.
done.
Applying patches...
done.
Fetching 1 new ports or files... done.
/poudriere/ports/tester/CHANGES
/poudriere/ports/tester/COPYRIGHT
[...]
Building new INDEX files... done.
在一台電腦,poudriere 可使用多組設定在多個 Jail 編譯來自不同 Port 樹的 Port。用來定義這些組合的自訂設定稱作 sets,可在安裝 ports-mgmt/poudriere 或 ports-mgmt/poudriere-devel 後參考 poudriere(8) 中的 CUSTOMIZATION 章節來取得詳細的資訊。
在此處示範的基本設定放了單一個 jail-, port- 以及 set- 特定的 make.conf
在 /usr/local/etc/poudriere.d
。在此範例使用的檔案名稱由 Jail 名稱、Port 名稱以及 set 名稱所組成:
。系統 10amd64-local-workstation
-make.confmake.conf
與這個新的檔案在編譯時期會被合併為編譯 Jail 要使用的 make.conf
。
要編譯的套件會輸入到
:10amd64-local-workstation
-pkglist
editors/emacs
devel/git
ports-mgmt/pkg
...
可使用以下方式設定選項及相依:
#
poudriere options -j 10amd64
-p local
-z workstation
-f 10amd64-local-workstation-pkglist
最後,編譯套件並建立套件檔案庫:
#
poudriere bulk -j 10amd64
-p local
-z workstation
-f 10amd64-local-workstation-pkglist
在執行時,按下 Ctrl+t 可以顯示目前編譯的狀態,Poudriere 也會編譯在 /poudriere/logs/bulk/
中的檔案,可用在網頁伺服器來顯示編譯資訊。jailname
完成之後,新套件現在可以從 poudriere 檔案庫來安裝。
要取得更多使用 poudriere 的資訊,請參考 poudriere(8) 及主網站 https://github.com/freebsd/poudriere/wiki。
雖然可以同時使用自訂的檔案庫與官方檔案庫,但有時關閉官方檔案庫會有幫助。這可以透過建立一個設定檔覆蓋並關閉官方的設定檔來完成。建立 /usr/local/etc/pkg/repos/FreeBSD.conf
包含以下內容:
FreeBSD: {
enabled: no
}
通常最簡單要提供 poudriere 檔案庫給客戶端的方式是透過 HTTP。安裝一個網頁伺服器來提供套件目錄,通常會像:/usr/local/poudriere/data/packages/
,其中 10amd64
10amd64
是編譯的名稱。
若要連往套件檔案庫的 URL 是:http://pkg.example.com/10amd64
,則在 /usr/local/etc/pkg/repos/custom.conf
的檔案庫設定檔為:
custom: {
url: "http://pkg.example.com/10amd64
",
enabled: yes,
}
本文及其他文件,可由此下載: ftp://ftp.FreeBSD.org/pub/FreeBSD/doc/。
若有 FreeBSD 方面疑問,請先閱讀
FreeBSD 相關文件,如不能解決的話,再洽詢
<questions@FreeBSD.org>。
關於本文件的問題,請洽詢
<doc@FreeBSD.org>。