[openstack-swift] Initial import

Silas Sewell silas at fedoraproject.org
Wed Sep 8 02:36:35 UTC 2010


commit f3dc2f6e4d7546319ec80035139a324e7f3fd78f
Author: Silas Sewell <silas at sewell.ch>
Date:   Tue Sep 7 22:36:31 2010 -0400

    Initial import

 .gitignore                          |    1 +
 openstack-swift-account.init        |   78 +++++++
 openstack-swift-auth.init           |   78 +++++++
 openstack-swift-container.init      |   78 +++++++
 openstack-swift-create-man-stubs.py |  384 +++++++++++++++++++++++++++++++++++
 openstack-swift-functions           |   63 ++++++
 openstack-swift-object.init         |   79 +++++++
 openstack-swift-proxy.init          |   79 +++++++
 openstack-swift.spec                |  378 ++++++++++++++++++++++++++++++++++
 sources                             |    1 +
 10 files changed, 1219 insertions(+), 0 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index e69de29..01e7e6c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/swift-1.0.2.tar.gz
diff --git a/openstack-swift-account.init b/openstack-swift-account.init
new file mode 100644
index 0000000..3ef6ddd
--- /dev/null
+++ b/openstack-swift-account.init
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          openstack-swift-account
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Stop:      0 1 6
+# Short-Description: Swift account server
+# Description:       Account server for swift.
+### END INIT INFO
+
+# openstack-swift-account: swift account server
+#
+# chkconfig: - 20 80
+# description: Account server for swift.
+
+. /etc/rc.d/init.d/functions
+. /usr/share/openstack-swift/functions
+
+name="account"
+
+[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"
+
+lockfile="/var/lock/subsys/openstack-swift-account"
+
+start() {
+    swift_action "$name" start
+    retval=$?
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    swift_action "$name" stop
+    retval=$?
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    swift_action "$name" status
+}
+
+rh_status_q() {
+    rh_status &> /dev/null
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-swift-auth.init b/openstack-swift-auth.init
new file mode 100644
index 0000000..1547ea7
--- /dev/null
+++ b/openstack-swift-auth.init
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          openstack-swift-auth
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Stop:      0 1 6
+# Short-Description: Swift auth server
+# Description:       Auth server for swift.
+### END INIT INFO
+
+# openstack-swift-auth: swift auth server
+#
+# chkconfig: - 20 80
+# description: Auth server for swift.
+
+. /etc/rc.d/init.d/functions
+. /usr/share/openstack-swift/functions
+
+name="auth"
+
+[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"
+
+lockfile="/var/lock/subsys/openstack-swift-auth"
+
+start() {
+    swift_action "$name" start
+    retval=$?
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    swift_action "$name" stop
+    retval=$?
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    swift_action "$name" status
+}
+
+rh_status_q() {
+    rh_status &> /dev/null
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-swift-container.init b/openstack-swift-container.init
new file mode 100644
index 0000000..355d777
--- /dev/null
+++ b/openstack-swift-container.init
@@ -0,0 +1,78 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          openstack-swift-container
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Stop:      0 1 6
+# Short-Description: Swift container server
+# Description:       Container server for swift.
+### END INIT INFO
+
+# openstack-swift-container: swift container server
+#
+# chkconfig: - 20 80
+# description: Container server for swift.
+
+. /etc/rc.d/init.d/functions
+. /usr/share/openstack-swift/functions
+
+name="container"
+
+[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"
+
+lockfile="/var/lock/subsys/openstack-swift-container"
+
+start() {
+    swift_action "$name" start
+    retval=$?
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    swift_action "$name" stop
+    retval=$?
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    swift_action "$name" status
+}
+
+rh_status_q() {
+    rh_status &> /dev/null
+}
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-swift-create-man-stubs.py b/openstack-swift-create-man-stubs.py
new file mode 100644
index 0000000..9fa508f
--- /dev/null
+++ b/openstack-swift-create-man-stubs.py
@@ -0,0 +1,384 @@
+import datetime
+import gzip
+import optparse
+import os
+import jinja2
+
+template = jinja2.Template("""
+.TH {{ name.upper() }} {{ section }} "{{ date.strftime("%B, %d %Y") }}"
+.SH NAME
+{{ name }} - {{ short_description }}
+.SH SYNOPSIS
+.PP
+.B {{ name }}{% if synposis_list %}
+{{ '\n'.join(synposis_list) }}{% endif %}
+.SH DESCRIPTION
+.PP
+{{ long_description }}{% if option_list %}
+.SH OPTIONS
+{% for option in option_list %}.TP
+.B {{ option.flags }}
+{{ option.description }}{% endfor %}{% endif %}
+.SH "AUTHOR"
+.PP
+This stub was created by Silas Sewell for the Fedora Project.
+{% if see_also %}.SH "SEE ALSO"
+{{ see_also }}{% endif %}
+""".lstrip())
+
+def create_dir(path):
+    if not os.path.exists(path):
+        os.makedirs(path)
+
+def create_man(**kwargs):
+    kwargs['date'] = datetime.datetime.now()
+    f = None
+    try:
+        dir_path = os.path.join(kwargs['options'].mandir, 'man%s' % kwargs['section'])
+        create_dir(dir_path)
+        man_path = os.path.join(dir_path, '%s.%s.gz' % (kwargs['name'], kwargs['section']))
+        f = gzip.open(man_path, 'wb')
+        f.write(template.render(**kwargs))
+    finally:
+        if f is not None:
+            f.close()
+
+def main(options):
+    def create(**kwargs):
+        kwargs['options'] = options
+        create_man(**kwargs)
+    create(
+        name='st',
+        section=8,
+        short_description='manage swift containers',
+        long_description='Perform operations on swift containers such a stat, list, upload, download and delete.',
+        synposis_list=[
+            '[options]',
+            '[command]',
+            '[args]',
+        ],
+        option_list=[
+            {'flags': '-h, --help', 'description': 'show help information'},
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-account-audit',
+        section=8,
+        short_description='manually audit swift accounts',
+        long_description='Manually checks the integrity of swift accounts.',
+        synposis_list=[
+            '[options]',
+            '[url 1]',
+            '[url 2]',
+        ],
+        option_list=[
+            {'flags': '-c [concurrency]', 'description': 'Set the concurrency, default 50'},
+            {'flags': '-r [ring dir]', 'description': 'Ring locations, default /etc/swift'},
+            {'flags': '-e [filename]', 'description': 'File for writing a list of inconsistent urls'},
+            {'flags': '-d', 'description': 'Also download files and verify md5'},
+        ],
+        see_also='swift-account-auditor(8)',
+    )
+    create(
+        name='swift-account-auditor',
+        section=8,
+        short_description='daemon that audits swift accounts',
+        long_description='Daemon that checks the integrity of accounts.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='swift-account-audit(8)',
+    )
+    create(
+        name='swift-account-reaper',
+        section=8,
+        short_description='daemon that removes data from deleted swift accounts',
+        long_description='Removes data from status=DELETED accounts. The account is not deleted immediately by the services call, but instead the account is simply marked for deletion by setting the status column in the account_stat table of the account database. This account reaper scans for such accounts and removes the data in the background. The background deletion process will occur on the primary account server for the account.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-account-replicator',
+        section=8,
+        short_description='daemon that replicates swift accounts',
+        long_description='Replicate account data to other servers.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-account-server',
+        section=8,
+        short_description='daemon that serves swift account data',
+        long_description='Daemon that exposes swift account data via a RESTful interface.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-auth-create-account',
+        section=8,
+        short_description='create swift user account',
+        long_description='Creates swift user accounts.',
+        synposis_list=[
+            '<new_account>',
+            '<new_user>',
+            '<new_password>',
+            '[conf_file]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-auth-recreate-accounts',
+        section=8,
+        short_description='re-create user accounts',
+        long_description='Re-creates the accounts from the existing auth database in the swift cluster.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-auth-server',
+        section=8,
+        short_description='swift user account daemon',
+        long_description='Daemon that serves and manages user accounts.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-container-auditor',
+        section=8,
+        short_description='daemon that audits swift containers',
+        long_description='Daemon that checks the integrity of containers.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-container-replicator',
+        section=8,
+        short_description='daemon that replicates swift containers',
+        long_description='Replicate container data to other servers.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-container-server',
+        section=8,
+        short_description='daemon that lists the content of containers',
+        long_description='The Container Server\'s primary job is to handle listings of objects. It doesn\'t know where those object\'s are, just what objects are in a specific container.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-container-updater',
+        section=8,
+        short_description='daemon that updates container information',
+        long_description='The Container Updater updates information in account listings.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-drive-audit',
+        section=8,
+        short_description='update drive information',
+        long_description='Update drive information.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-get-nodes',
+        section=8,
+        short_description='show responsible node',
+        long_description='Shows the nodes responsible for the item specified.',
+        synposis_list=[
+            '<ring.gz>',
+            '<account>',
+            '[<container>]',
+            '[<object>]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-init',
+        section=8,
+        short_description='manage swift servers',
+        long_description='Start, stop and reload swift servers.',
+        synposis_list=[
+            '<server-name>',
+            '[start|stop|reload]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-object-auditor',
+        short_description='daemon that audits swift objects',
+        long_description='Daemon that checks the integrity of objects.',
+        section=8,
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-object-info',
+        section=8,
+        short_description='display object info',
+        long_description='Display information about an object such as account, container, hash and content type.',
+        synposis_list=[
+            'OBJECT_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-object-replicator',
+        section=8,
+        short_description='daemon that replicates swift objects',
+        long_description='Replicate object data to other servers.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-object-server',
+        section=8,
+        short_description='daemon that serves objects',
+        long_description='Daemon that exposes swift object data via a RESTful interface.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-object-updater',
+        section=8,
+        short_description='update object information in container listings',
+        long_description='Object Updater updates object information in container listings.',
+        synposis_list=[
+            'CONFIG_FILE',
+            '[once]',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-proxy-server',
+        section=8,
+        short_description='centralize swift daemon',
+        long_description='The Proxy Server is responsible for tying the other servers together. For each request, it will look up the location of the account, container, or object in the ring and route the request accordingly. The public API is also exposed through the Proxy Server.',
+        synposis_list=[
+            'CONFIG_FILE',
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-ring-builder',
+        section=8,
+        short_description='assigns partitions to devices and writes ring structure',
+        long_description='The ring-builder assigns partitions to devices and writes an optimized Python ring structure to a gzipped, pickled file on disk for shipping out to the servers.',
+        synposis_list=[
+        ],
+        option_list=[
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-stats-populate',
+        section=8,
+        short_description='run dispersion and performance population',
+        long_description='Run dispersion and performance population.',
+        synposis_list=[
+        ],
+        option_list=[
+            {'flags': '-h, --help', 'description': 'show help information'},
+        ],
+        see_also='',
+    )
+    create(
+        name='swift-stats-report',
+        section=8,
+        short_description='run various swift reports',
+        long_description='Run swift reports such as audit checks, dispersion reports and performance reports.',
+        synposis_list=[],
+        option_list=[
+            {'flags': '-h, --help', 'description': 'show help information'},
+        ],
+        see_also='',
+    )
+
+if __name__ == '__main__':
+    parser = optparse.OptionParser()
+    parser.add_option(
+        '--mandir',
+        dest='mandir',
+        help='use PATH as base mandir',
+        metavar='PATH',
+        default='.',
+    )
+    options, args = parser.parse_args()
+    main(options)
diff --git a/openstack-swift-functions b/openstack-swift-functions
new file mode 100644
index 0000000..1ee905a
--- /dev/null
+++ b/openstack-swift-functions
@@ -0,0 +1,63 @@
+# vim: filetype=sh
+
+. /etc/rc.d/init.d/functions
+
+swift_action() {
+  retval=0
+  server="$1"
+  call="swift_$2"
+
+  if [[ -f "/etc/swift/$server-server.conf" ]]; then
+    $call "$server" \
+          "/etc/swift/$server-server.conf" \
+          "/var/run/swift/$server-server.pid"
+    [ $? -ne 0 ] && retval=1
+  elif [[ -d "/etc/swift/$server-server/" ]]; then
+    declare -i count=0
+    for name in $( ls "/etc/swift/$server-server/" ); do
+      $call "$server" \
+            "/etc/swift/$server-server/$name" \
+            "/var/run/swift/$server-server/$count.pid"
+      [ $? -ne 0 ] && retval=1
+      count=$count+1
+    done
+  fi
+  return $retval
+}
+
+swift_start() {
+  name="$1"
+  long_name="$name-server"
+  conf_file="$2"
+  pid_file="$3"
+
+  ulimit -n ${SWIFT_MAX_FILES-32768}
+  echo -n "Starting swift-$long_name: "
+  daemon --pidfile $pid_file \
+    "/usr/bin/swift-$long_name $conf_file &>/dev/null & echo \$! > $pid_file"
+  retval=$?
+  echo
+  return $retval
+}
+
+swift_stop() {
+  name="$1"
+  long_name="$name-server"
+  conf_name="$2"
+  pid_file="$3"
+
+  echo -n "Stopping swift-$long_name: "
+  killproc -p $pid_file -d ${SWIFT_STOP_DELAY-15} $long_name
+  retval=$?
+  echo
+  return $retval
+}
+
+swift_status() {
+  name="$1"
+  long_name="$name-server"
+  conf_name="$2"
+  pid_file="$3"
+
+  status -p $pid_file $long_name
+}
diff --git a/openstack-swift-object.init b/openstack-swift-object.init
new file mode 100644
index 0000000..c4de57d
--- /dev/null
+++ b/openstack-swift-object.init
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          openstack-swift-object
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Stop:      0 1 6
+# Short-Description: Swift object server
+# Description:       Object server for swift.
+### END INIT INFO
+
+# openstack-swift-object: swift object server
+#
+# chkconfig: - 20 80
+# description: Object server for swift.
+
+. /etc/rc.d/init.d/functions
+. /usr/share/openstack-swift/functions
+
+name="object"
+
+[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"
+
+lockfile="/var/lock/subsys/openstack-swift-object"
+
+start() {
+    swift_action "$name" start
+    retval=$?
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    swift_action "$name" stop
+    retval=$?
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    swift_action "$name" status
+}
+
+rh_status_q() {
+    rh_status &> /dev/null
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-swift-proxy.init b/openstack-swift-proxy.init
new file mode 100644
index 0000000..b10bca0
--- /dev/null
+++ b/openstack-swift-proxy.init
@@ -0,0 +1,79 @@
+#!/bin/sh
+
+### BEGIN INIT INFO
+# Provides:          openstack-swift-proxy
+# Required-Start:    $remote_fs
+# Required-Stop:     $remote_fs
+# Default-Stop:      0 1 6
+# Short-Description: Swift proxy server
+# Description:       Account server for swift.
+### END INIT INFO
+
+# openstack-swift-proxy: swift proxy server
+#
+# chkconfig: - 20 80
+# description: Proxy server for swift.
+
+. /etc/rc.d/init.d/functions
+. /usr/share/openstack-swift/functions
+
+name="proxy"
+
+[ -e "/etc/sysconfig/openstack-swift-$name" ] && . "/etc/sysconfig/openstack-swift-$name"
+
+lockfile="/var/lock/subsys/openstack-swift-proxy"
+
+start() {
+    swift_action "$name" start
+    retval=$?
+    [ $retval -eq 0 ] && touch $lockfile
+    return $retval
+}
+
+stop() {
+    swift_action "$name" stop
+    retval=$?
+    [ $retval -eq 0 ] && rm -f $lockfile
+    return $retval
+}
+
+restart() {
+    stop
+    start
+}
+
+rh_status() {
+    swift_action "$name" status
+}
+
+rh_status_q() {
+    rh_status &> /dev/null
+}
+
+
+case "$1" in
+    start)
+        rh_status_q && exit 0
+        $1
+        ;;
+    stop)
+        rh_status_q || exit 0
+        $1
+        ;;
+    restart)
+        $1
+        ;;
+    reload)
+        ;;
+    status)
+        rh_status
+        ;;
+    condrestart|try-restart)
+        rh_status_q || exit 0
+        restart
+        ;;
+    *)
+        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart}"
+        exit 2
+esac
+exit $?
diff --git a/openstack-swift.spec b/openstack-swift.spec
new file mode 100644
index 0000000..a058d29
--- /dev/null
+++ b/openstack-swift.spec
@@ -0,0 +1,378 @@
+%if ! (0%{?fedora} > 12 || 0%{?rhel} > 5)
+%{!?python_sitelib: %global python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
+%endif
+
+Name:             openstack-swift
+Version:          1.0.2
+Release:          5%{?dist}
+Summary:          OpenStack Object Storage (swift)
+
+Group:            Development/Languages
+License:          ASL 2.0
+URL:              http://launchpad.net/swift
+Source0:          http://launchpad.net/swift/1.0/%{version}/+download/swift-%{version}.tar.gz
+Source1:          %{name}-functions
+Source2:          %{name}-account.init
+Source3:          %{name}-auth.init
+Source4:          %{name}-container.init
+Source5:          %{name}-object.init
+Source6:          %{name}-proxy.init
+Source20:         %{name}-create-man-stubs.py
+BuildRoot:        %{_tmppath}/swift-%{version}-%{release}-root-%(%{__id_u} -n)
+
+BuildArch:        noarch
+BuildRequires:    dos2unix
+BuildRequires:    python-devel
+BuildRequires:    python-setuptools
+
+Requires:         python-configobj
+Requires:         python-eventlet >= 0.9.8
+Requires:         python-greenlet >= 0.3.1
+Requires:         python-simplejson
+Requires:         python-webob
+Requires:         pyxattr
+
+Requires(post):   chkconfig
+Requires(postun): initscripts
+Requires(preun):  chkconfig
+Requires(pre):    shadow-utils
+
+%description
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+Objects are written to multiple hardware devices in the data center, with the
+OpenStack software responsible for ensuring data replication and integrity
+across the cluster. Storage clusters can scale horizontally by adding new nodes,
+which are automatically configured. Should a node fail, OpenStack works to
+replicate its content from other active nodes. Because OpenStack uses software
+logic to ensure data replication and distribution across different devices,
+inexpensive commodity hard drives and servers can be used in lieu of more
+expensive equipment.
+
+%package          account
+Summary:          A swift account server
+Group:            Applications/System
+
+Requires:         %{name} = %{version}-%{release}
+
+%description      account
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains the %{name} account server.
+
+%package          auth
+Summary:          A swift auth server
+Group:            Applications/System
+
+Requires:         %{name} = %{version}-%{release}
+
+%description      auth
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains the %{name} auth server.
+
+%package          container
+Summary:          A swift container server
+Group:            Applications/System
+
+Requires:         %{name} = %{version}-%{release}
+
+%description      container
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains the %{name} container server.
+
+%package          object
+Summary:          A swift object server
+Group:            Applications/System
+
+Requires:         %{name} = %{version}-%{release}
+
+%description      object
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains the %{name} object server.
+
+%package          proxy
+Summary:          A swift proxy server
+Group:            Applications/System
+
+Requires:         %{name} = %{version}-%{release}
+
+%description      proxy
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains the %{name} proxy server.
+
+%package doc
+Summary:          Documentation for %{name}
+Group:            Documentation
+
+BuildRequires:    python-sphinx
+# Required for generating docs
+BuildRequires:    python-eventlet
+BuildRequires:    python-simplejson
+BuildRequires:    python-webob
+BuildRequires:    pyxattr
+
+%description      doc
+OpenStack Object Storage (swift) aggregates commodity servers to work together
+in clusters for reliable, redundant, and large-scale storage of static objects.
+
+This package contains documentation files for %{name}.
+
+%prep
+%setup -q -n swift-%{version}
+# Fix wrong-file-end-of-line-encoding warning
+dos2unix LICENSE
+
+%build
+%{__python} setup.py build
+# Build docs
+pushd doc; make html; popd
+# Fix hidden-file-or-dir warning 
+rm doc/build/html/.buildinfo
+# Build man stubs
+%{__python} %{SOURCE20} --mandir=./man
+
+%install
+rm -rf %{buildroot}
+%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+# Init helper functions
+install -p -D -m 644 %{SOURCE1} %{buildroot}%{_datarootdir}/%{name}/functions
+# Init scripts
+install -p -D -m 755 %{SOURCE2} %{buildroot}%{_initrddir}/%{name}-account
+install -p -D -m 755 %{SOURCE3} %{buildroot}%{_initrddir}/%{name}-auth
+install -p -D -m 755 %{SOURCE4} %{buildroot}%{_initrddir}/%{name}-container
+install -p -D -m 755 %{SOURCE5} %{buildroot}%{_initrddir}/%{name}-object
+install -p -D -m 755 %{SOURCE6} %{buildroot}%{_initrddir}/%{name}-proxy
+# Install man stubs
+for name in $( ls ./man ); do
+    mkdir -p "%{buildroot}%{_mandir}/$name"
+    cp "./man/$name/"*.gz "%{buildroot}%{_mandir}/$name"
+done
+# Remove tests
+rm -fr %{buildroot}/%{python_sitelib}/test
+# Misc other
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift/account-server
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift/auth-server
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift/container-server
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift/object-server
+install -d -m 755 %{buildroot}%{_sysconfdir}/swift/proxy-server
+# Install pid directory
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/account-server
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/auth-server
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/container-server
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/object-server
+install -d -m 755 %{buildroot}%{_localstatedir}/run/swift/proxy-server
+
+%clean
+rm -rf %{buildroot}
+
+%pre
+getent group swift >/dev/null || groupadd -r swift
+getent passwd swift >/dev/null || \
+useradd -r -g swift -d %{_sharedstatedir}/swift -s /sbin/nologin \
+-c "OpenStack Swift Daemons" swift
+exit 0
+
+%post account
+/sbin/chkconfig --add swift-account
+
+%preun account
+if [ $1 = 0 ] ; then
+    /sbin/service swift-account stop >/dev/null 2>&1
+    /sbin/chkconfig --del swift-account
+fi
+
+%postun account
+if [ "$1" -ge "1" ] ; then
+    /sbin/service swift-account condrestart >/dev/null 2>&1 || :
+fi
+
+%post auth
+/sbin/chkconfig --add swift-auth
+
+%preun auth
+if [ $1 = 0 ] ; then
+    /sbin/service swift-auth stop >/dev/null 2>&1
+    /sbin/chkconfig --del swift-auth
+fi
+
+%postun auth
+if [ "$1" -ge "1" ] ; then
+    /sbin/service swift-auth condrestart >/dev/null 2>&1 || :
+fi
+
+%post container
+/sbin/chkconfig --add swift-container
+
+%preun container
+if [ $1 = 0 ] ; then
+    /sbin/service swift-container stop >/dev/null 2>&1
+    /sbin/chkconfig --del swift-container
+fi
+
+%postun container
+if [ "$1" -ge "1" ] ; then
+    /sbin/service swift-container condrestart >/dev/null 2>&1 || :
+fi
+
+%post object
+/sbin/chkconfig --add swift-object
+
+%preun object
+if [ $1 = 0 ] ; then
+    /sbin/service swift-object stop >/dev/null 2>&1
+    /sbin/chkconfig --del swift-object
+fi
+
+%postun object
+if [ "$1" -ge "1" ] ; then
+    /sbin/service swift-object condrestart >/dev/null 2>&1 || :
+fi
+
+%post proxy
+/sbin/chkconfig --add swift-proxy
+
+%preun proxy
+if [ $1 = 0 ] ; then
+    /sbin/service swift-proxy stop >/dev/null 2>&1
+    /sbin/chkconfig --del swift-proxy
+fi
+
+%postun proxy
+if [ "$1" -ge "1" ] ; then
+    /sbin/service swift-proxy condrestart >/dev/null 2>&1 || :
+fi
+
+%files
+%defattr(-,root,root,-)
+%doc AUTHORS LICENSE README
+%dir %{_datarootdir}/%{name}/functions
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift
+%dir %{_sysconfdir}/swift
+%dir %{python_sitelib}/swift
+%{_bindir}/st
+%{_bindir}/swift-account-audit
+%{_bindir}/swift-drive-audit
+%{_bindir}/swift-get-nodes
+%{_bindir}/swift-init
+%{_bindir}/swift-ring-builder
+%{_bindir}/swift-stats-populate
+%{_bindir}/swift-stats-report
+%{_mandir}/man8/st.8.gz
+%{_mandir}/man8/swift-account-audit.8.gz
+%{_mandir}/man8/swift-drive-audit.8.gz
+%{_mandir}/man8/swift-get-nodes.8.gz
+%{_mandir}/man8/swift-init.8.gz
+%{_mandir}/man8/swift-ring-builder.8.gz
+%{_mandir}/man8/swift-stats-populate.8.gz
+%{_mandir}/man8/swift-stats-report.8.gz
+%{python_sitelib}/swift/*.py*
+%{python_sitelib}/swift/common
+%{python_sitelib}/swift-%{version}-*.egg-info
+
+%files account
+%defattr(-,root,root,-)
+%doc etc/account-server.conf-sample
+%dir %{_initrddir}/%{name}-account
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/account-server
+%dir %{_sysconfdir}/swift/account-server
+%{_bindir}/swift-account-auditor
+%{_bindir}/swift-account-reaper
+%{_bindir}/swift-account-replicator
+%{_bindir}/swift-account-server
+%{_mandir}/man8/swift-account-auditor.8.gz
+%{_mandir}/man8/swift-account-reaper.8.gz
+%{_mandir}/man8/swift-account-replicator.8.gz
+%{_mandir}/man8/swift-account-server.8.gz
+%{python_sitelib}/swift/account
+
+%files auth
+%defattr(-,root,root,-)
+%doc etc/auth-server.conf-sample
+%dir %{_initrddir}/%{name}-auth
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/auth-server
+%dir %{_sysconfdir}/swift/auth-server
+%{_bindir}/swift-auth-create-account
+%{_bindir}/swift-auth-recreate-accounts
+%{_bindir}/swift-auth-server
+%{_mandir}/man8/swift-auth-create-account.8.gz
+%{_mandir}/man8/swift-auth-recreate-accounts.8.gz
+%{_mandir}/man8/swift-auth-server.8.gz
+%{python_sitelib}/swift/auth
+
+%files container
+%defattr(-,root,root,-)
+%doc etc/container-server.conf-sample
+%dir %{_initrddir}/%{name}-container
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/container-server
+%dir %{_sysconfdir}/swift/container-server
+%{_bindir}/swift-container-auditor
+%{_bindir}/swift-container-server
+%{_bindir}/swift-container-replicator
+%{_bindir}/swift-container-updater
+%{_mandir}/man8/swift-container-auditor.8.gz
+%{_mandir}/man8/swift-container-server.8.gz
+%{_mandir}/man8/swift-container-replicator.8.gz
+%{_mandir}/man8/swift-container-updater.8.gz
+%{python_sitelib}/swift/container
+
+%files object
+%defattr(-,root,root,-)
+%doc etc/account-server.conf-sample etc/rsyncd.conf-sample
+%dir %{_initrddir}/%{name}-object
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/object-server
+%dir %{_sysconfdir}/swift/object-server
+%{_bindir}/swift-object-auditor
+%{_bindir}/swift-object-info
+%{_bindir}/swift-object-replicator
+%{_bindir}/swift-object-server
+%{_bindir}/swift-object-updater
+%{_mandir}/man8/swift-object-auditor.8.gz
+%{_mandir}/man8/swift-object-info.8.gz
+%{_mandir}/man8/swift-object-replicator.8.gz
+%{_mandir}/man8/swift-object-server.8.gz
+%{_mandir}/man8/swift-object-updater.8.gz
+%{python_sitelib}/swift/obj
+
+%files proxy
+%defattr(-,root,root,-)
+%doc etc/proxy-server.conf-sample
+%dir %{_initrddir}/%{name}-proxy
+%dir %attr(0755, swift, root) %{_localstatedir}/run/swift/proxy-server
+%dir %{_sysconfdir}/swift/proxy-server
+%{_bindir}/swift-proxy-server
+%{_mandir}/man8/swift-proxy-server.8.gz
+%{python_sitelib}/swift/proxy
+
+%files doc
+%defattr(-,root,root,-)
+%doc LICENSE doc/build/html
+
+%changelog
+* Sun Aug 08 2010 Silas Sewell <silas at sewell.ch> - 1.0.2-5
+- Update for new Python macro guidelines
+- Use dos2unix instead of sed
+- Make gecos field more descriptive
+
+* Wed Jul 28 2010 Silas Sewell <silas at sewell.ch> - 1.0.2-4
+- Rename to openstack-swift
+
+* Wed Jul 28 2010 Silas Sewell <silas at sewell.ch> - 1.0.2-3
+- Fix return value in swift-functions
+
+* Tue Jul 27 2010 Silas Sewell <silas at sewell.ch> - 1.0.2-2
+- Add swift user
+- Update init scripts
+
+* Sun Jul 18 2010 Silas Sewell <silas at sewell.ch> - 1.0.2-1
+- Initial build
diff --git a/sources b/sources
index e69de29..6aa74ca 100644
--- a/sources
+++ b/sources
@@ -0,0 +1 @@
+6937c520d5db340bae8a63944e84174f  swift-1.0.2.tar.gz


More information about the scm-commits mailing list