diff options
author | Ruslan Makhmatkhanov <rm@FreeBSD.org> | 2013-06-11 18:28:30 +0000 |
---|---|---|
committer | Ruslan Makhmatkhanov <rm@FreeBSD.org> | 2013-06-11 18:28:30 +0000 |
commit | c04a63505f96b1079024b861118236b130212bf0 (patch) | |
tree | 85f36bc101cb816fdbd3dd63ed30e677381c6e83 | |
parent | 350839d292c6274a33ec1f32040763fd044c1c2d (diff) | |
download | ports-c04a63505f96b1079024b861118236b130212bf0.tar.gz ports-c04a63505f96b1079024b861118236b130212bf0.zip |
Notes
-rw-r--r-- | databases/py-swift/Makefile | 2 | ||||
-rw-r--r-- | databases/py-swift/files/patch-utils.py | 17 | ||||
-rw-r--r-- | databases/py-swift/files/swift.in | 116 |
3 files changed, 135 insertions, 0 deletions
diff --git a/databases/py-swift/Makefile b/databases/py-swift/Makefile index 8391740474d1..0eeb84570ac9 100644 --- a/databases/py-swift/Makefile +++ b/databases/py-swift/Makefile @@ -3,6 +3,7 @@ PORTNAME= swift PORTVERSION= 1.8.0 +PORTREVISION= 1 CATEGORIES= databases python MASTER_SITES= http://launchpadlibrarian.net/136145662/ PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} @@ -24,6 +25,7 @@ RUN_DEPENDS= ${PYTHON_PKGNAMEPREFIX}eventlet>=0.9.8:${PORTSDIR}/net/py-eventlet USE_PYTHON= -2.7 USE_PYDISTUTILS= easy_install +USE_RC_SUBR= swift MAN1= swift-account-auditor.1 \ swift-account-reaper.1 \ diff --git a/databases/py-swift/files/patch-utils.py b/databases/py-swift/files/patch-utils.py new file mode 100644 index 000000000000..4675a9812c2e --- /dev/null +++ b/databases/py-swift/files/patch-utils.py @@ -0,0 +1,17 @@ +--- swift/common/utils.py.orig 2013-05-18 14:10:21.000000000 +0300 ++++ swift/common/utils.py 2013-05-18 14:09:06.000000000 +0300 +@@ -274,12 +274,12 @@ def drop_buffer_cache(fd, offset, length + """ + global _posix_fadvise + if _posix_fadvise is None: +- _posix_fadvise = load_libc_function('posix_fadvise64') ++ _posix_fadvise = load_libc_function('posix_fadvise') + # 4 means "POSIX_FADV_DONTNEED" + ret = _posix_fadvise(fd, ctypes.c_uint64(offset), + ctypes.c_uint64(length), 4) + if ret != 0: +- logging.warn("posix_fadvise64(%s, %s, %s, 4) -> %s" ++ logging.warn("posix_fadvise(%s, %s, %s, 4) -> %s" + % (fd, offset, length, ret)) + + diff --git a/databases/py-swift/files/swift.in b/databases/py-swift/files/swift.in new file mode 100644 index 000000000000..e663a45e3756 --- /dev/null +++ b/databases/py-swift/files/swift.in @@ -0,0 +1,116 @@ +#!/bin/sh +# +# $FreeBSD$ +# +# PROVIDE: swift +# REQUIRE: LOGIN +# KEYWORD: shutdown +# +# Add the following lines to /etc/rc.conf to enable swift: +# +# swift_enable (bool): Set it to "YES" to enable swift. +# Default is "NO". +# swift_servers (list): Specify servers to run as a space separated +# list of possible values: +# account, account-reaper, account-replicator, +# container, container-auditor, container-replicator, +# container-sync, container-updater, +# object, object-auditor, object-expirer, +# object-replicator, object-updater, +# proxy. +# The following aliases may be used: +# "ACCOUNT" -- all account servers; +# "EXPIRER" -- object-expirer; +# "CONTAINER" -- all container server; +# "OBJECT" -- all object servers; +# "PROXY" -- all proxy servers; +# "STORAGE" -- all storage node servers +# (alias for "ACCOUNT CONTAINER OBJECT"); +# "ALL" -- all servers +# (alias for "ACCOUNT CONTAINER EXPIRER OBJECT PROXY"). +# Default is "ALL". + +. /etc/rc.subr + +name="swift" +rcvar=swift_enable + +extra_commands="reload shutdown status" +reload_cmd="swift_init reload" +shutdown_cmd="swift_init shutdown" +start_cmd="swift_init start" +status_cmd="swift_init status" +stop_cmd="swift_init stop" + +required_files=%%PREFIX%%/etc/swift/swift.conf + +PATH=%%PREFIX%%/bin:$PATH + +load_rc_config $name + +: ${swift_enable:="NO"} +: ${swift_servers:="ALL"} + +swift_expand_servers() +{ + local x + + for x; do + case "${x}" in + ALL) + swift_expand_servers PROXY + swift_expand_servers EXPIRER + ;& + STORAGE) + swift_expand_servers ACCOUNT + swift_expand_servers CONTAINER + swift_expand_servers OBJECT + ;; + ACCOUNT) + echo account + echo account-reaper + echo account-replicator + ;; + EXPIRER) + echo object-expirer + ;; + CONTAINER) + echo container + echo container-auditor + echo container-replicator + echo container-sync + echo container-updater + ;; + OBJECT) + echo object + echo object-auditor + echo object-replicator + echo object-updater + ;; + PROXY) + echo proxy + ;; + account|account-reaper|account-replicator|\ + container|container-auditor|container-replicator|\ + container-sync|container-updater|\ + object|object-auditor|object-expirer|object-replicator|\ + object-updater|\ + proxy) + echo "${x}" + ;; + *) + warn "unknown service: ${x}" + exit 1 + ;; + esac + done | sort -u +} + +swift_init() +{ + local cmd=$1 + + swift-init `swift_expand_servers ${swift_servers}` ${cmd} +} + +run_rc_command "$1" |