The portshaker.d/
directory contains shell scripts used
to maintain
portshaker(8)
target ports trees. Each script correspond to a
source ports tree, and provide the required functions
required by
portshaker(8)
to merge to target ports trees.
In order to ease development,
portshaker(8)
provides the portshaker.subr scripts that contains all
the logic for managing source ports trees. In order to
configure a source ports tree, you have to source that
file, specify how the ports tree has to be fetched (see bellow), and run the
run_portshaker_command() function as detailed in the
EXAMPLES section.
The script is in charge of consuming any argument up to (and
including) the first --. These arguments are separated by a column in
portshaker.conf(5)
(e.g. github:account:project).
The following variable are available to configure how the
source ports tree has to be fetched:
- method
- (str) Update method. Should be one of
csup, cvs,
portsnap, git,
hg (mercurial), rsync,
svn, or svn+subtrees.
- csup_supfile
- (str) supfile to provide to
csup(1)
when
“method
=
csup”.
- cvs_root
- (str) CVSROOT string to use for checking-out the
ports tree when
“method
=
cvs”.
- cvs_module
- (str) cvs module to checkout when
“method
=
cvs”.
- git_clone_uri
- (str) git URI to clone when
“method
=
git”.
- git_branch
- (str) branch to track when
“method
=
git”.
- git_submodules
- (str) fetch submodules when
“method
=
git”.
- git_submodules_branch
- (str) submodule branch to track when
“method
=
git”.
- hg_clone_uri
- (str) mercurial URI to clone when
“method
=
hg”.
- rsync_source_path
- (str) path to copy data from when
“method
=
rsync”.
- rsync_extra_args
- (str) extra arguments to pass to
rsync(1)
when
“method
=
rsync”.
- svn_checkout_path
- (str) URI to checkout the ports tree from when
“method
=
svn”
or
“method=
svn+subtrees”.
- svn_checkout_subtrees
- (str) Whitespace separated list of subdirectories
path[@rev] beneath the
svn_checkout_path which will be checked out when
“method
=
svn+subtrees”.
Special consideration when
“method=
csup”
When updating a source ports tree using the
csup method, the source ports tree
name has to be ports because the remote collection is
named likely.
portshaker(8)
will ensure this condition is met before attempting to perform any update.
An update script may define the
⟨port_tree⟩_pre⟨action⟩()
and
⟨port_tree⟩_post⟨action⟩()
function hooks, where action is one of
update, clone_to,
copy_to or
merge_to.
To configure the official FreeBSD ports tree as a source
ports tree, create a /usr/local/etc/portshaker.d/ports
shell script containing:
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="portsnap"
run_portshaker_command "$@"
To configure the BSD# ports tree as a source
ports tree, create a
/usr/local/etc/portshaker.d/bsd_sharp shell script
containing:
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="svn"
svn_checkout_path="http://bsd-sharp.googlecode.com/svn/trunk/"
run_portshaker_command "$@"
If you want only a subset of ports from the (huge) FreeBSD tree as
a source ports tree (probably to merge with some other
tree), create a
/usr/local/etc/portshaker.d/freebsd_subset shell
script containing:
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="svn+subtrees"
svn_checkout_path="svn://svn.freebsd.org/ports/head"
svn_checkout_subtrees="
emulators/mame
net/samba34@319916
"
run_portshaker_command "$@"
To setup a dynamic redports source ports
tree, create a /usr/local/etc/portshaker.d/redports
shell script containing:
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
username="$1"
extra_info=":${username}"
shift
method="svn"
svn_checkout_path="http://svn.redports.org/${username}"
run_portshaker_command "$@"
You can then specify the foo and
bar ports tree at redports specifying the
redports:foo and redports:bar
source ports tree in your
portshaker.conf configuration file.
To use git as the source ports tree using
submodules, create a
/usr/local/etc/portshaker.d/git_ports shell script
containing:
#!/bin/sh
. /usr/local/share/portshaker/portshaker.subr
if [ "$1" != '--' ]; then
err 1 "Extra arguments"
fi
shift
method="git"
git_clone_uri="git@github.com:freebsd/freebsd-ports.git"
git_branch="master"
git_submodules="yes"
git_submodules_branch="development"
run_portshaker_command "$@"
Romain Tartière
⟨romain@blogreen.org⟩