FreeBSD Tinderbox 筆記

安裝

步驟:

# cd /usr/ports/ports-mgmt/tinderbox; make install distclean
(考慮把 /usr/local/tinderbox 複製到別的地方,如 /srv)

設定

執行:

# cd /usr/local/tinderbox/scripts
# ./tc Setup
# ./tc init

webui 設定

apache:

Alias /tb/logs/ "/usr/local/tinderbox/logs/"
Alias /tb/packages/ "/usr/local/tinderbox/packages/"
Alias /tb/errors/ "/usr/local/tinderbox/errors/"
Alias /tb/ "/usr/local/tinderbox/scripts/webui/"

<Directory "/usr/local/tinderbox/">
    Order allow,deny
    Allow from all
</Directory>

PHP

執行:

# cd /usr/local/tinderbox/scripts/webui
# cp inc_ds.php.dist inc_ds.php
# cp inc_tinderbox.php.dist inc_tinderbox.php

調整 inc_ds.php 以及 inc_tinderbox.php

開始使用 Tinderbox

以下預設目錄,請切換到 /usr/local/tinderbox/scripts

請務必查看目錄下的 README,你就知道以下在做些什麼。或是查看 http://tinderbox.marcuscom.com/README.html

  1. 建立 Jail:

    # ./tc createJail -j 8.1 -d "FreeBSD 8.1-RELEASE" -t 8.1-RELEASE -u LFTP -H ftp.tw.freebsd.org
    
  2. 建 Ports Tree:

    # ./tc createPortsTree -p FreeBSD -d "FreeBSD ports tree" -H cvsup.tw.freebsd.org
    
  3. 建立 FreeBSD builds:

    # ./tc createBuild -b 8.1-FreeBSD -j 8.1 -p FreeBSD -d "8.1-RELEASE with FreeBSD ports tree"
    
  4. 開始丟一個要測試的 ports 進去 build:

    # ./tc addPort -b 8.1-FreeBSD -d www/node
    # ./tc tinderbuild -nullfs -b 8.1-FreeBSD www/node
    
  5. 重 build:

    # ./tc tinderbuild -b 8.1-FreeBSD -cleanpackages  # 清 package,以免直接用上次 build 的 package 而不重 build
    # ./tc tinderbuild -nullfs -b 8.1-FreeBSD www/node
    

還 tinderbox 一個乾淨的環境

亦即所有 build 過的 package、log 都清理乾淨,不影響 Jail:

# ./tc tbcleanup

查看 tc 指令

執行:

# ./tc help
(以下是 tinderbox 3.3.3 的輸出結果)
usage:  tc <command>
Where <command> is one of:

Setup
        Set up a new Tinderbox
Upgrade
        Upgrade an existing Tinderbox
addBuild
        Add a build to the datastore
addBuildPortsQueueEntry
        Adds a Port to the Ports to Build Queue
addBuildUser
        Add a user to a given build's interest list
addJail
        Add a jail to the datastore (do NOT call this directly; use
        createJail instead)
addPort
        Add a port to the datastore
addPortFailPattern
        Add a port failure pattern to the datastore
addPortFailReason
        Add a port failure reason to the datastore
addPortToOneBuild
        INTERNAL function only
addPortsTree
        Add a portstree to the datastore
addUser
        Add a user to the datastore
configCcache
        Configure Tinderbox ccache parameters
configDistfile
        Configure Tinderbox distfile parameters
configGet
        Print current Tinderbox configuration
configHost
        Configure Tinderbox Host parameters
configLog
        Configure Tinderbox logging parameters
configOptions
        Configure Tinderbox port OPTIONS parameters
configPackage
        Configure Tinderbox package parameters
configTinderd
        Configure Tinderbox tinder daemon (tinderd) parameters
copyBuild
        Copy the environment and ports from one build to another
copyBuildPorts
        Copy the ports from one build to another
createBuild
        Create a new build
createJail
        Create a new jail
createPortsTree
        Create a new portstree
dsversion
        Print the datastore version
dumpObject
        Dump the contents of a TinderObject
getDependenciesForPort
        Get stored dependencies for a given port and build
getHookCmd
        Get the command for a given hook
getJailArch
        Get the architecture for a give jail
getJailForBuild
        Get the jail name associated with a given build
getPackageSuffix
        Get the package suffix for a given jail
getPortLastBuiltStatus
        Get the last built status for the specified port and build
getPortLastBuiltVersion
        Get the last built version for the specified port and build
getPortTotalSize
        Get the total size (in KB) required for the specified port and
        build
getPortsForBuild
        Get all the ports associated with a given build
getPortsMount
        Get the ports mount source for the given portstree
getPortsTreeForBuild
        Get the portstree name assoicated with a given build
getSrcMount
        Get the src mount source for the given jail
getTagForJail
        Get the tag for a given jail
getUpdateCmd
        Get the update command for the given object
init
        Initialize a tinderbox environment
isLogCurrent
        Determine if a logfile is still relevant
listBuildPortsQueue
        Lists the Ports to Build Queue
listBuildUsers
        List all users in the interest list for a build
listBuilds
        List all builds in the datastore
listHooks
        List all hooks, their commands, and their descriptions
listJails
        List all jails in the datastore
listPortFailPatterns
        List all port failure patterns, their reasons, and regular
        expressions
listPortFailReasons
        List all port failure reasons and their descriptions
listPorts
        List all ports in the datastore
listPortsTrees
        List all portstrees in the datastore
listUsers
        List all users in the datastore
makeBuild
        Populate a build prior to tinderbuild
makeJail
        Update and build an existing jail
processLog
        Analyze a logfile to find the failure reason
reorgBuildPortsQueue
        Reorganizes the Ports to Build Queue
rescanPorts
        Update properties for all ports in the datastore
resetBuild
        Cleanup and reset a Build environment
rmBuild
        Remove a build from the datastore
rmBuildPortsQueue
        Removes all Ports from the Ports to Build Queue
rmBuildPortsQueueEntry
        Removes a Port from the Ports to Build Queue
rmJail
        Remove a jail from the datastore
rmPort
        Remove a port from the datastore, and optionally its package
        and logs from the file system
rmPortFailPattern
        Remove a port failure pattern from the datastore
rmPortFailReason
        Remove a port failure reason from the datastore
rmPortsTree
        Remove a portstree from the datastore
rmUser
        Remove a user from the datastore
sendBuildCompletionMail
        Send email to the build interest list when a build completes
sendBuildErrorMail
        Send email to the build interest list when a port fails to
        build
setPortsMount
        Set the ports mount source for the given portstree
setSrcMount
        Set the src mount source for the given jail
setWwwAdmin
        Defines which user is the www admin
tbcleanup
        Cleanup old build logs, and prune old database entries for
        which no package exists
tbkill
        Kill a tinderbuild
tbversion
        Display Tinderbox version
tinderbuild
        Generate packages from an installed Build
updateBuildCurrentPort
        Update the port currently being built for the specify build
updateBuildPortsQueueEntryCompletionDate
        Update the specified Build Ports Queue Entry completion time
updateBuildPortsQueueEntryStatus
        Update the current status for the specific queue entry
updateBuildRemakeCount
        Update the count of number of ports needing a rebuild
updateBuildStatus
        Update the current status for the specific build
updateBuildUser
        Update email preferences for the given user for the given build
updateHookCmd
        Update the command for the given hook
updateJailLastBuilt
        Update the specified jail's last built time
updatePortFailReason
        Update the type or description of a port failure reason
updatePortStatus
        Update build information about a port
updatePortsTree
        Update an existing ports tree
updatePortsTreeLastBuilt
        Update the specified portstree's last built time
updateUser
        Update user preferences

查看網頁、build log

webui:

http://your.site/tb/

server log:

# cd /usr/local/tinderbox/logs/8.1-FreeBSD/
(查看底下的 log,如 node-0.2.3.log)