Bug 178738

Summary: databases/py-swift: add rc.d script and fix posix_fadvise
Product: Ports & Packages Reporter: Mikolaj Golub <trociny>
Component: Individual Port(s)Assignee: Ruslan Makhmatkhanov <rm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Mikolaj Golub freebsd_committer freebsd_triage 2013-05-18 13:20:00 UTC
* Add rc.d script

* Add the patch that fixes posix_fadvise64 linuxism: swift tries to call posix_fadvise64, which does not exists on FreeBSD and does not needed because off_t is 8 bytes on both 32 and 64-bit platforms, so posix_fadvise should be called instead. This has been reported upstream (#1179268) but there is no reaction so far.

Fix: Patch attached with submission follows:
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-18 13:20:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->freebsd-python

freebsd-python@ wants this port PRs (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-18 13:20:09 UTC
Maintainer of databases/py-swift,

Please note that PR ports/178738 has just been submitted.

If it contains a patch for an upgrade, an enhancement or a bug fix
you agree on, reply to this email stating that you approve the patch
and a committer will take care of it.

The full text of the PR can be found at:
    http://www.freebsd.org/cgi/query-pr.cgi?pr=ports/178738

-- 
Edwin Groothuis via the GNATS Auto Assign Tool
edwin@FreeBSD.org
Comment 3 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-18 13:20:10 UTC
State Changed
From-To: open->feedback

Awaiting maintainers feedback (via the GNATS Auto Assign Tool)
Comment 4 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2013-06-10 09:31:58 UTC
Responsible Changed
From-To: freebsd-python->rm

I will take it.
Comment 5 dfilter service freebsd_committer freebsd_triage 2013-06-11 19:29:02 UTC
Author: rm
Date: Tue Jun 11 18:28:30 2013
New Revision: 320622
URL: http://svnweb.freebsd.org/changeset/ports/320622

Log:
  - add rc.d script
  - add the patch that fixes posix_fadvise64 linuxism: swift tries to call
    posix_fadvise64, which does not exists on FreeBSD and does not needed
    because off_t is 8 bytes on both 32 and 64-bit platforms, so posix_fadvise
    should be called instead. This has been reported upstream (#1179268) but
    there is no reaction so far.
  - bump PORTREVISION
  
  PR:		178738
  Submitted by:	trociny
  Approved by:	maintainer timeout (3 weeks)

Added:
  head/databases/py-swift/files/
  head/databases/py-swift/files/patch-utils.py   (contents, props changed)
  head/databases/py-swift/files/swift.in   (contents, props changed)
Modified:
  head/databases/py-swift/Makefile   (contents, props changed)

Modified: head/databases/py-swift/Makefile
==============================================================================
--- head/databases/py-swift/Makefile	Tue Jun 11 18:25:17 2013	(r320621)
+++ head/databases/py-swift/Makefile	Tue Jun 11 18:28:30 2013	(r320622)
@@ -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}even
 
 USE_PYTHON=	-2.7
 USE_PYDISTUTILS=	easy_install
+USE_RC_SUBR=	swift
 
 MAN1=		swift-account-auditor.1 \
 		swift-account-reaper.1 \

Added: head/databases/py-swift/files/patch-utils.py
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/py-swift/files/patch-utils.py	Tue Jun 11 18:28:30 2013	(r320622)
@@ -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))
+ 
+ 

Added: head/databases/py-swift/files/swift.in
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/databases/py-swift/files/swift.in	Tue Jun 11 18:28:30 2013	(r320622)
@@ -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"
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 6 Ruslan Makhmatkhanov freebsd_committer freebsd_triage 2013-06-11 19:30:59 UTC
State Changed
From-To: feedback->closed

Committed, thank you!