ports/devel/py-buildbot-worker/files/buildbot-worker.in
Kubilay Kocak 02cbe9e030 devel/py-buildbot{-*}: Update to 1.5.0
All ports (where necessary):

  - Fix and equalize *_DEPENDS (and specified versions) to setup.py.
  - Match COMMENT to setup.py:description.
  - Add commented LICENSE_FILE describing why its not defined.

py-buildbot{-worker}:

  - Enable concurrent (Multiple Python version) installation.
  - Update test targets to set PYTHONPATH, so that the package in WRKSRC.
    is tested, not installed packages.

py-buildbot:

  - Remove post-patch target, no longer necessary.
  - Add test dependency not declared in setup.py:test_requires, that cause
    tests to fail when not installed, unlike other dependencies that are
    skipped.
  - Add an un-referenced compulsory RUN_DEPENDS on pyyaml reported and
    resolved upstream [1].

py-buildbot-worker:

  - Update patch-setup.py to actually fix (package/install) the VERSION
    file, rather than just not installing it. The worker passes this files
    contents to the master for display in the frontend if it exists,
    otherwise sending the string 'latest' or the modification datestamp of
    another file. [1]
  - Fix startup script to use the filename of itself (the executed script),
    not a filename that uses the ${name} variable, which doesnt exist as it
    contains an underscore (not a dash), causing the following error when
    executed:

    /usr/local/etc/rc.d/buildbot-worker: /usr/local/etc/rc.d/buildbot_worker: not found

Changelog:

  http://docs.buildbot.net/current/relnotes/index.html#buildbot-1-5-0-2018-10-09

[1] https://github.com/buildbot/buildbot/pull/4394

Requested by:		Tao Zhou <tao ish com au>
Reviewed_by:		Nathan Owens <ndowens yahoo com>, 0mp
Differential Revision:	D17821
2018-11-07 03:24:59 +00:00

121 lines
4 KiB
Bash

#!/bin/sh
# $FreeBSD$
# PROVIDE: buildbot-worker
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to run buildbot-worker:
#
# buildbot_worker_enable (bool): Set to "YES" to enable buildbot-worker.
# Default: "NO"
#
# buildbot_worker_flags (flags): Set extra command flags here. See buildbot-worker(8)
# Default: Empty ("").
#
# buildbot_worker_uid (user): User to run buildbot-worker as.
# Default: "buildbot"
#
# buildbot_worker_gid (group): Group to run buildbot-worker as.
# Default: "buildbot"
#
# buildbot_worker_basedir (path): Location for buildbot-worker base directory
# Default: %%PREFIX%%/etc/buildbot-worker
#
# buildbot_worker_profiles (str): Define profiles names. Space-delimited.
# Default: Empty ("")
#
# This rc.d script supports multiple "profiles". When profiles are
# specified, the non-profile specific parameters become defaults.
#
# Example:
#
# buildbot_worker_profiles="foo bar"
#
# buildbot_worker_foo_enable="YES"
# buildbot_worker_foo_basedir="/usr/home/foo/buildbot"
# buildbot_worker_foo_uid="foo"
# buildbot_worker_foo_gid="foo"
#
# buildbot_worker_bar_enable="YES"
# buildbot_worker_bar_basedir="/usr/home/buildbot/"
. /etc/rc.subr
export PATH=${PATH}:%%LOCALBASE%%/bin
name=buildbot_worker
desc="Buildbot Buildworker"
rcvar=buildbot_worker_enable
load_rc_config ${name}
# These are just the defaults, they might get overriden for a specific profile.
eval ": \${${name}_enable:=\"NO\"}"
eval ": \${${name}_flags:=\"\"}"
eval ": \${${name}_uid:=\"buildbot\"}"
eval ": \${${name}_gid:=\"buildbot\"}"
eval ": \${${name}_basedir:=\"%%PREFIX%%/etc/${name}\"}"
command="%%PREFIX%%/bin/twistd-%%PYTHON_VER%%"
command_interpreter="%%PYTHON_CMD%%"
pidfile="${buildbot_worker_basedir}/twistd.pid"
# A specific profile is specified in the command
if [ -n "$2" ]; then
profile="$2"
# Override defaults with profile-specific values
if [ -n "${buildbot_worker_profiles}" ]; then
eval buildbot_worker_enable="\${buildbot_worker_${profile}_enable:-${buildbot_worker_enable}}"
eval buildbot_worker_flags="\${buildbot_worker_${profile}_flags:-${buildbot_worker_flags}}"
eval buildbot_worker_uid="\${buildbot_worker_${profile}_uid:-${buildbot_worker_uid}}"
eval buildbot_worker_gid="\${buildbot_worker_${profile}_gid:-${buildbot_worker_gid}}"
eval buildbot_worker_basedir="\${buildbot_worker_${profile}_basedir:-${buildbot_worker_basedir}}"
eval pidfile="\${buildbot_worker_${profile}_basedir:-${buildbot_worker_basedir}}/twistd.pid"
else
echo "$0: extra argument ignored"
fi
# A specific profile is not in the command
else
# Check if any profiles are defined
if [ -n "$1" -a -n "${buildbot_worker_profiles}" ]; then
# Loop through them
for profile in ${buildbot_worker_profiles}; do
eval _enable="\${buildbot_worker_${profile}_enable}"
case "${_enable:-${buildbot_worker_enable}}" in
[Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0)
continue
;;
[Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
;;
*)
if test -z "$_enable"; then
_var=buildbot_worker_enable
else
_var=buildbot_worker_"${profile}"_enable
fi
warn "Bad value" \
"'${_enable:-${buildbot_worker_enable}}'" \
"for ${_var}. " \
"Profile ${profile} skipped."
continue
;;
esac
echo "===> ${name} profile: ${profile}"
if $0 $1 ${profile}; then
success="${profile} ${success:-}"
else
failed="${profile} (${retcode}) ${failed:-}"
fi
done
# Exit so that non-profile rc.d is not started when there are profiles
exit 0
fi
fi
# run_rc_command would send ${name}_flags as parameters to $command (daemon)
# This ensures they are actually passed to fcgiwrap instead.
actual_buildbot_worker_flags="${buildbot_worker_flags}"
buildbot_worker_flags=""
command_args="--uid=${buildbot_worker_uid} --gid=${buildbot_worker_gid} --pidfile=${pidfile} --python=${buildbot_worker_basedir}/buildbot.tac ${actual_buildbot_worker_flags}"
run_rc_command "$1"